Coverage Report

Created: 2026-03-19 07:34

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_boolean.h"
27
#include "exprs/function/cast/cast_to_date.h"
28
#include "exprs/function/cast/cast_to_decimal.h"
29
#include "exprs/function/cast/cast_to_float.h"
30
#include "exprs/function/cast/cast_to_int.h"
31
#include "exprs/function/cast/cast_to_ip.h"
32
#include "exprs/function/cast/cast_to_jsonb.h"
33
#include "exprs/function/cast/cast_to_map.h"
34
#include "exprs/function/cast/cast_to_string.h"
35
#include "exprs/function/cast/cast_to_struct.h"
36
#include "exprs/function/cast/cast_to_timestamptz.h"
37
#include "exprs/function/cast/cast_to_variant.h"
38
#include "exprs/function/simple_function_factory.h"
39
40
namespace doris {
41
42
namespace CastWrapper {
43
44
WrapperType create_hll_wrapper(FunctionContext* context, const DataTypePtr& from_type_untyped,
45
6
                               const DataTypeHLL& to_type) {
46
    /// Conversion from String through parsing.
47
6
    if (check_and_get_data_type<DataTypeString>(from_type_untyped.get())) {
48
6
        return cast_from_string_to_generic;
49
6
    }
50
51
0
    return CastWrapper::create_unsupport_wrapper("Cast to HLL only support from String type");
52
6
}
53
54
WrapperType create_bitmap_wrapper(FunctionContext* context, const DataTypePtr& from_type_untyped,
55
5
                                  const DataTypeBitMap& to_type) {
56
    /// Conversion from String through parsing.
57
5
    if (check_and_get_data_type<DataTypeString>(from_type_untyped.get())) {
58
5
        return cast_from_string_to_generic;
59
5
    }
60
61
0
    return CastWrapper::create_unsupport_wrapper("Cast to BitMap only support from String type");
62
5
}
63
64
WrapperType create_quantile_state_wrapper(FunctionContext* context,
65
                                          const DataTypePtr& from_type_untyped,
66
2
                                          const DataTypeQuantileState& to_type) {
67
    /// Conversion from String through parsing.
68
2
    if (check_and_get_data_type<DataTypeString>(from_type_untyped.get())) {
69
2
        return cast_from_string_to_generic;
70
2
    }
71
72
0
    return CastWrapper::create_unsupport_wrapper(
73
0
            "Cast to QuantileState only support from String type");
74
2
}
75
76
2
WrapperType create_varbinary_wrapper(const DataTypePtr& from_type_untyped) {
77
    /// Conversion from String through parsing.
78
2
    if (check_and_get_data_type<DataTypeString>(from_type_untyped.get())) {
79
2
        return cast_from_string_to_generic;
80
2
    }
81
82
0
    return CastWrapper::create_unsupport_wrapper("Cast to Varbinary only support from String type");
83
2
}
84
85
WrapperType prepare_unpack_dictionaries(FunctionContext* context, const DataTypePtr& from_type,
86
422k
                                        const DataTypePtr& to_type) {
87
422k
    const auto& from_nested = from_type;
88
422k
    const auto& to_nested = to_type;
89
90
422k
    if (from_type->is_null_literal()) {
91
2.15k
        if (!to_nested->is_nullable()) {
92
0
            return CastWrapper::create_unsupport_wrapper(
93
0
                    "Cannot convert NULL to a non-nullable type");
94
0
        }
95
96
2.15k
        return [](FunctionContext* context, Block& block, const ColumnNumbers&, uint32_t result,
97
2.15k
                  size_t input_rows_count, const NullMap::value_type* null_map = nullptr) {
98
            /// TODO: remove this in the future.
99
2.15k
            auto& res = block.get_by_position(result);
100
2.15k
            res.column = res.type->create_column_const_with_default_value(input_rows_count)
101
2.15k
                                 ->convert_to_full_column_if_const();
102
2.15k
            return Status::OK();
103
2.15k
        };
104
2.15k
    }
105
106
419k
    auto wrapper = prepare_remove_nullable(context, from_nested, to_nested);
107
108
419k
    return wrapper;
109
422k
}
110
111
bool need_replace_null_data_to_default(FunctionContext* context, const DataTypePtr& from_type,
112
391k
                                       const DataTypePtr& to_type) {
113
391k
    if (from_type->equals(*to_type)) {
114
70.5k
        return false;
115
70.5k
    }
116
117
320k
    auto make_default_wrapper = [&](const auto& types) -> bool {
118
233k
        using Types = std::decay_t<decltype(types)>;
119
233k
        using ToDataType = typename Types::LeftType;
120
121
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
122
                        IsDatelikeV2Types<ToDataType> ||
123
38.1k
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
124
38.1k
            return false;
125
38.1k
        }
126
0
        return call_on_index_and_data_type<
127
233k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
174k
            using Types2 = std::decay_t<decltype(types2)>;
129
174k
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
87.4k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
87.4k
                return false;
134
87.4k
            }
135
56.6k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
56.6k
                using FromFieldType = typename FromDataType::FieldType;
137
56.6k
                using ToFieldType = typename ToDataType::FieldType;
138
56.6k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
56.6k
                UInt32 from_scale = 0;
140
141
56.6k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
24.7k
                    const auto* from_decimal_type =
143
24.7k
                            check_and_get_data_type<FromDataType>(from_type.get());
144
24.7k
                    from_precision =
145
24.7k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
24.7k
                    from_scale = from_decimal_type->get_scale();
147
24.7k
                }
148
149
56.6k
                UInt32 to_max_digits = 0;
150
56.6k
                UInt32 to_precision = 0;
151
56.6k
                UInt32 to_scale = 0;
152
153
56.6k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
50.4k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
50.4k
                    const auto* to_decimal_type =
157
50.4k
                            check_and_get_data_type<ToDataType>(to_type.get());
158
50.4k
                    to_precision = to_decimal_type->get_precision();
159
50.4k
                    ToDataType::check_type_precision(to_precision);
160
161
50.4k
                    to_scale = to_decimal_type->get_scale();
162
50.4k
                    ToDataType::check_type_scale(to_scale);
163
50.4k
                }
164
56.6k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
6.16k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
6.16k
                    to_precision = to_max_digits;
167
6.16k
                }
168
169
56.6k
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
56.6k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
56.6k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
56.6k
                if (to_scale > from_scale) {
174
12.6k
                    multiply_may_overflow &=
175
12.6k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
12.6k
                }
177
56.6k
                return narrow_integral || multiply_may_overflow;
178
56.6k
            }
179
0
            return false;
180
174k
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE2EEEvEEEEbRKT_ENKUlSI_E_clINSB_ISE_SE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE2EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_3EEESE_EEEEbSI_
Line
Count
Source
127
23
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
23
            using Types2 = std::decay_t<decltype(types2)>;
129
23
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
23
            return false;
180
23
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE2EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_4EEESE_EEEEbSI_
Line
Count
Source
127
14
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
14
            using Types2 = std::decay_t<decltype(types2)>;
129
14
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
14
            return false;
180
14
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE2EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_5EEESE_EEEEbSI_
Line
Count
Source
127
31
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
31
            using Types2 = std::decay_t<decltype(types2)>;
129
31
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
31
            return false;
180
31
        });
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
127
97
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
97
            using Types2 = std::decay_t<decltype(types2)>;
129
97
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
97
            return false;
180
97
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE2EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_7EEESE_EEEEbSI_
Line
Count
Source
127
7
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
7
            using Types2 = std::decay_t<decltype(types2)>;
129
7
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
7
            return false;
180
7
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE2EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_8EEESE_EEEEbSI_
Line
Count
Source
127
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
2
            using Types2 = std::decay_t<decltype(types2)>;
129
2
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
2
            return false;
180
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
127
7
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
7
            using Types2 = std::decay_t<decltype(types2)>;
129
7
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
7
            return false;
180
7
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE2EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_28EEESE_EEEEbSI_
Line
Count
Source
127
10
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
10
            using Types2 = std::decay_t<decltype(types2)>;
129
10
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
10
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
10
                using FromFieldType = typename FromDataType::FieldType;
137
10
                using ToFieldType = typename ToDataType::FieldType;
138
10
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
10
                UInt32 from_scale = 0;
140
141
10
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
10
                    const auto* from_decimal_type =
143
10
                            check_and_get_data_type<FromDataType>(from_type.get());
144
10
                    from_precision =
145
10
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
10
                    from_scale = from_decimal_type->get_scale();
147
10
                }
148
149
10
                UInt32 to_max_digits = 0;
150
10
                UInt32 to_precision = 0;
151
10
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
10
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
10
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
10
                    to_precision = to_max_digits;
167
10
                }
168
169
10
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
10
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
10
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
10
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
10
                return narrow_integral || multiply_may_overflow;
178
10
            }
179
0
            return false;
180
10
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE2EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_29EEESE_EEEEbSI_
Line
Count
Source
127
5
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
5
            using Types2 = std::decay_t<decltype(types2)>;
129
5
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
5
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
5
                using FromFieldType = typename FromDataType::FieldType;
137
5
                using ToFieldType = typename ToDataType::FieldType;
138
5
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
5
                UInt32 from_scale = 0;
140
141
5
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
5
                    const auto* from_decimal_type =
143
5
                            check_and_get_data_type<FromDataType>(from_type.get());
144
5
                    from_precision =
145
5
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
5
                    from_scale = from_decimal_type->get_scale();
147
5
                }
148
149
5
                UInt32 to_max_digits = 0;
150
5
                UInt32 to_precision = 0;
151
5
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
5
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
5
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
5
                    to_precision = to_max_digits;
167
5
                }
168
169
5
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
5
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
5
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
5
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
5
                return narrow_integral || multiply_may_overflow;
178
5
            }
179
0
            return false;
180
5
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE2EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_20EEESE_EEEEbSI_
Line
Count
Source
127
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
2
            using Types2 = std::decay_t<decltype(types2)>;
129
2
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
2
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
2
                using FromFieldType = typename FromDataType::FieldType;
137
2
                using ToFieldType = typename ToDataType::FieldType;
138
2
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
2
                UInt32 from_scale = 0;
140
141
2
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
2
                    const auto* from_decimal_type =
143
2
                            check_and_get_data_type<FromDataType>(from_type.get());
144
2
                    from_precision =
145
2
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
2
                    from_scale = from_decimal_type->get_scale();
147
2
                }
148
149
2
                UInt32 to_max_digits = 0;
150
2
                UInt32 to_precision = 0;
151
2
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
2
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
2
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
2
                    to_precision = to_max_digits;
167
2
                }
168
169
2
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
2
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
2
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
2
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
2
                return narrow_integral || multiply_may_overflow;
178
2
            }
179
0
            return false;
180
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
127
5
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
5
            using Types2 = std::decay_t<decltype(types2)>;
129
5
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
5
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
5
                using FromFieldType = typename FromDataType::FieldType;
137
5
                using ToFieldType = typename ToDataType::FieldType;
138
5
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
5
                UInt32 from_scale = 0;
140
141
5
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
5
                    const auto* from_decimal_type =
143
5
                            check_and_get_data_type<FromDataType>(from_type.get());
144
5
                    from_precision =
145
5
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
5
                    from_scale = from_decimal_type->get_scale();
147
5
                }
148
149
5
                UInt32 to_max_digits = 0;
150
5
                UInt32 to_precision = 0;
151
5
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
5
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
5
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
5
                    to_precision = to_max_digits;
167
5
                }
168
169
5
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
5
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
5
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
5
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
5
                return narrow_integral || multiply_may_overflow;
178
5
            }
179
0
            return false;
180
5
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE2EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_35EEESE_EEEEbSI_
Line
Count
Source
127
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
2
            using Types2 = std::decay_t<decltype(types2)>;
129
2
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
2
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
2
                using FromFieldType = typename FromDataType::FieldType;
137
2
                using ToFieldType = typename ToDataType::FieldType;
138
2
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
2
                UInt32 from_scale = 0;
140
141
2
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
2
                    const auto* from_decimal_type =
143
2
                            check_and_get_data_type<FromDataType>(from_type.get());
144
2
                    from_precision =
145
2
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
2
                    from_scale = from_decimal_type->get_scale();
147
2
                }
148
149
2
                UInt32 to_max_digits = 0;
150
2
                UInt32 to_precision = 0;
151
2
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
2
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
2
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
2
                    to_precision = to_max_digits;
167
2
                }
168
169
2
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
2
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
2
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
2
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
2
                return narrow_integral || multiply_may_overflow;
178
2
            }
179
0
            return false;
180
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
127
770
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
770
            using Types2 = std::decay_t<decltype(types2)>;
129
770
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
770
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
770
                return false;
134
770
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
770
            return false;
180
770
        });
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
127
798
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
798
            using Types2 = std::decay_t<decltype(types2)>;
129
798
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
798
            return false;
180
798
        });
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
127
10
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
10
            using Types2 = std::decay_t<decltype(types2)>;
129
10
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
10
            return false;
180
10
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_5EEESE_EEEEbSI_
Line
Count
Source
127
143
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
143
            using Types2 = std::decay_t<decltype(types2)>;
129
143
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
143
            return false;
180
143
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_6EEESE_EEEEbSI_
Line
Count
Source
127
276
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
276
            using Types2 = std::decay_t<decltype(types2)>;
129
276
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
276
            return false;
180
276
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_7EEESE_EEEEbSI_
Line
Count
Source
127
7
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
7
            using Types2 = std::decay_t<decltype(types2)>;
129
7
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
7
            return false;
180
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
127
23
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
23
            using Types2 = std::decay_t<decltype(types2)>;
129
23
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
23
            return false;
180
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
127
30
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
30
            using Types2 = std::decay_t<decltype(types2)>;
129
30
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
30
            return false;
180
30
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_28EEESE_EEEEbSI_
Line
Count
Source
127
20
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
20
            using Types2 = std::decay_t<decltype(types2)>;
129
20
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
20
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
20
                using FromFieldType = typename FromDataType::FieldType;
137
20
                using ToFieldType = typename ToDataType::FieldType;
138
20
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
20
                UInt32 from_scale = 0;
140
141
20
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
20
                    const auto* from_decimal_type =
143
20
                            check_and_get_data_type<FromDataType>(from_type.get());
144
20
                    from_precision =
145
20
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
20
                    from_scale = from_decimal_type->get_scale();
147
20
                }
148
149
20
                UInt32 to_max_digits = 0;
150
20
                UInt32 to_precision = 0;
151
20
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
20
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
20
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
20
                    to_precision = to_max_digits;
167
20
                }
168
169
20
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
20
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
20
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
20
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
20
                return narrow_integral || multiply_may_overflow;
178
20
            }
179
0
            return false;
180
20
        });
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
127
24
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
24
            using Types2 = std::decay_t<decltype(types2)>;
129
24
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
24
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
24
                using FromFieldType = typename FromDataType::FieldType;
137
24
                using ToFieldType = typename ToDataType::FieldType;
138
24
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
24
                UInt32 from_scale = 0;
140
141
24
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
24
                    const auto* from_decimal_type =
143
24
                            check_and_get_data_type<FromDataType>(from_type.get());
144
24
                    from_precision =
145
24
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
24
                    from_scale = from_decimal_type->get_scale();
147
24
                }
148
149
24
                UInt32 to_max_digits = 0;
150
24
                UInt32 to_precision = 0;
151
24
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
24
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
24
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
24
                    to_precision = to_max_digits;
167
24
                }
168
169
24
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
24
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
24
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
24
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
24
                return narrow_integral || multiply_may_overflow;
178
24
            }
179
0
            return false;
180
24
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_20EEESE_EEEEbSI_
Line
Count
Source
127
8
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
8
            using Types2 = std::decay_t<decltype(types2)>;
129
8
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
8
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
8
                using FromFieldType = typename FromDataType::FieldType;
137
8
                using ToFieldType = typename ToDataType::FieldType;
138
8
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
8
                UInt32 from_scale = 0;
140
141
8
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
8
                    const auto* from_decimal_type =
143
8
                            check_and_get_data_type<FromDataType>(from_type.get());
144
8
                    from_precision =
145
8
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
8
                    from_scale = from_decimal_type->get_scale();
147
8
                }
148
149
8
                UInt32 to_max_digits = 0;
150
8
                UInt32 to_precision = 0;
151
8
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
8
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
8
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
8
                    to_precision = to_max_digits;
167
8
                }
168
169
8
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
8
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
8
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
8
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
8
                return narrow_integral || multiply_may_overflow;
178
8
            }
179
0
            return false;
180
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
127
24
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
24
            using Types2 = std::decay_t<decltype(types2)>;
129
24
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
24
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
24
                using FromFieldType = typename FromDataType::FieldType;
137
24
                using ToFieldType = typename ToDataType::FieldType;
138
24
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
24
                UInt32 from_scale = 0;
140
141
24
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
24
                    const auto* from_decimal_type =
143
24
                            check_and_get_data_type<FromDataType>(from_type.get());
144
24
                    from_precision =
145
24
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
24
                    from_scale = from_decimal_type->get_scale();
147
24
                }
148
149
24
                UInt32 to_max_digits = 0;
150
24
                UInt32 to_precision = 0;
151
24
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
24
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
24
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
24
                    to_precision = to_max_digits;
167
24
                }
168
169
24
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
24
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
24
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
24
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
24
                return narrow_integral || multiply_may_overflow;
178
24
            }
179
0
            return false;
180
24
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_35EEESE_EEEEbSI_
Line
Count
Source
127
25
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
25
            using Types2 = std::decay_t<decltype(types2)>;
129
25
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
25
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
25
                using FromFieldType = typename FromDataType::FieldType;
137
25
                using ToFieldType = typename ToDataType::FieldType;
138
25
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
25
                UInt32 from_scale = 0;
140
141
25
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
25
                    const auto* from_decimal_type =
143
25
                            check_and_get_data_type<FromDataType>(from_type.get());
144
25
                    from_precision =
145
25
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
25
                    from_scale = from_decimal_type->get_scale();
147
25
                }
148
149
25
                UInt32 to_max_digits = 0;
150
25
                UInt32 to_precision = 0;
151
25
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
25
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
25
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
25
                    to_precision = to_max_digits;
167
25
                }
168
169
25
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
25
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
25
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
25
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
25
                return narrow_integral || multiply_may_overflow;
178
25
            }
179
0
            return false;
180
25
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeDateESE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeDateV2ESE_EEEEbSI_
Line
Count
Source
127
72
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
72
            using Types2 = std::decay_t<decltype(types2)>;
129
72
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
72
            return false;
180
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
127
24
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
24
            using Types2 = std::decay_t<decltype(types2)>;
129
24
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
24
            return false;
180
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
127
320
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
320
            using Types2 = std::decay_t<decltype(types2)>;
129
320
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
320
            return false;
180
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
127
3.11k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
3.11k
            using Types2 = std::decay_t<decltype(types2)>;
129
3.11k
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
3.11k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
3.11k
                return false;
134
3.11k
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
3.11k
            return false;
180
3.11k
        });
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
127
136
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
136
            using Types2 = std::decay_t<decltype(types2)>;
129
136
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
136
            return false;
180
136
        });
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
127
2.11k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
2.11k
            using Types2 = std::decay_t<decltype(types2)>;
129
2.11k
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
2.11k
            return false;
180
2.11k
        });
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
127
149
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
149
            using Types2 = std::decay_t<decltype(types2)>;
129
149
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
149
            return false;
180
149
        });
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
127
100
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
100
            using Types2 = std::decay_t<decltype(types2)>;
129
100
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
100
            return false;
180
100
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_7EEESE_EEEEbSI_
Line
Count
Source
127
20
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
20
            using Types2 = std::decay_t<decltype(types2)>;
129
20
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
20
            return false;
180
20
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_8EEESE_EEEEbSI_
Line
Count
Source
127
21
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
21
            using Types2 = std::decay_t<decltype(types2)>;
129
21
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
21
            return false;
180
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
127
25
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
25
            using Types2 = std::decay_t<decltype(types2)>;
129
25
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
25
            return false;
180
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
127
22
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
22
            using Types2 = std::decay_t<decltype(types2)>;
129
22
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
22
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
22
                using FromFieldType = typename FromDataType::FieldType;
137
22
                using ToFieldType = typename ToDataType::FieldType;
138
22
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
22
                UInt32 from_scale = 0;
140
141
22
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
22
                    const auto* from_decimal_type =
143
22
                            check_and_get_data_type<FromDataType>(from_type.get());
144
22
                    from_precision =
145
22
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
22
                    from_scale = from_decimal_type->get_scale();
147
22
                }
148
149
22
                UInt32 to_max_digits = 0;
150
22
                UInt32 to_precision = 0;
151
22
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
22
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
22
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
22
                    to_precision = to_max_digits;
167
22
                }
168
169
22
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
22
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
22
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
22
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
22
                return narrow_integral || multiply_may_overflow;
178
22
            }
179
0
            return false;
180
22
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_29EEESE_EEEEbSI_
Line
Count
Source
127
25
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
25
            using Types2 = std::decay_t<decltype(types2)>;
129
25
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
25
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
25
                using FromFieldType = typename FromDataType::FieldType;
137
25
                using ToFieldType = typename ToDataType::FieldType;
138
25
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
25
                UInt32 from_scale = 0;
140
141
25
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
25
                    const auto* from_decimal_type =
143
25
                            check_and_get_data_type<FromDataType>(from_type.get());
144
25
                    from_precision =
145
25
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
25
                    from_scale = from_decimal_type->get_scale();
147
25
                }
148
149
25
                UInt32 to_max_digits = 0;
150
25
                UInt32 to_precision = 0;
151
25
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
25
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
25
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
25
                    to_precision = to_max_digits;
167
25
                }
168
169
25
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
25
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
25
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
25
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
25
                return narrow_integral || multiply_may_overflow;
178
25
            }
179
0
            return false;
180
25
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_20EEESE_EEEEbSI_
Line
Count
Source
127
8
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
8
            using Types2 = std::decay_t<decltype(types2)>;
129
8
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
8
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
8
                using FromFieldType = typename FromDataType::FieldType;
137
8
                using ToFieldType = typename ToDataType::FieldType;
138
8
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
8
                UInt32 from_scale = 0;
140
141
8
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
8
                    const auto* from_decimal_type =
143
8
                            check_and_get_data_type<FromDataType>(from_type.get());
144
8
                    from_precision =
145
8
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
8
                    from_scale = from_decimal_type->get_scale();
147
8
                }
148
149
8
                UInt32 to_max_digits = 0;
150
8
                UInt32 to_precision = 0;
151
8
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
8
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
8
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
8
                    to_precision = to_max_digits;
167
8
                }
168
169
8
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
8
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
8
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
8
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
8
                return narrow_integral || multiply_may_overflow;
178
8
            }
179
0
            return false;
180
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
127
25
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
25
            using Types2 = std::decay_t<decltype(types2)>;
129
25
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
25
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
25
                using FromFieldType = typename FromDataType::FieldType;
137
25
                using ToFieldType = typename ToDataType::FieldType;
138
25
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
25
                UInt32 from_scale = 0;
140
141
25
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
25
                    const auto* from_decimal_type =
143
25
                            check_and_get_data_type<FromDataType>(from_type.get());
144
25
                    from_precision =
145
25
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
25
                    from_scale = from_decimal_type->get_scale();
147
25
                }
148
149
25
                UInt32 to_max_digits = 0;
150
25
                UInt32 to_precision = 0;
151
25
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
25
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
25
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
25
                    to_precision = to_max_digits;
167
25
                }
168
169
25
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
25
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
25
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
25
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
25
                return narrow_integral || multiply_may_overflow;
178
25
            }
179
0
            return false;
180
25
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_35EEESE_EEEEbSI_
Line
Count
Source
127
26
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
26
            using Types2 = std::decay_t<decltype(types2)>;
129
26
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
26
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
26
                using FromFieldType = typename FromDataType::FieldType;
137
26
                using ToFieldType = typename ToDataType::FieldType;
138
26
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
26
                UInt32 from_scale = 0;
140
141
26
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
26
                    const auto* from_decimal_type =
143
26
                            check_and_get_data_type<FromDataType>(from_type.get());
144
26
                    from_precision =
145
26
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
26
                    from_scale = from_decimal_type->get_scale();
147
26
                }
148
149
26
                UInt32 to_max_digits = 0;
150
26
                UInt32 to_precision = 0;
151
26
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
26
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
26
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
26
                    to_precision = to_max_digits;
167
26
                }
168
169
26
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
26
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
26
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
26
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
26
                return narrow_integral || multiply_may_overflow;
178
26
            }
179
0
            return false;
180
26
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeDateESE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeDateV2ESE_EEEEbSI_
Line
Count
Source
127
72
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
72
            using Types2 = std::decay_t<decltype(types2)>;
129
72
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
72
            return false;
180
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
127
24
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
24
            using Types2 = std::decay_t<decltype(types2)>;
129
24
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
24
            return false;
180
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
127
320
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
320
            using Types2 = std::decay_t<decltype(types2)>;
129
320
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
320
            return false;
180
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
127
2.48k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
2.48k
            using Types2 = std::decay_t<decltype(types2)>;
129
2.48k
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
2.48k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
2.48k
                return false;
134
2.48k
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
2.48k
            return false;
180
2.48k
        });
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
127
44
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
44
            using Types2 = std::decay_t<decltype(types2)>;
129
44
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
44
            return false;
180
44
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_3EEESE_EEEEbSI_
Line
Count
Source
127
3.52k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
3.52k
            using Types2 = std::decay_t<decltype(types2)>;
129
3.52k
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
3.52k
            return false;
180
3.52k
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_4EEESE_EEEEbSI_
Line
Count
Source
127
400
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
400
            using Types2 = std::decay_t<decltype(types2)>;
129
400
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
400
            return false;
180
400
        });
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
127
1.56k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
1.56k
            using Types2 = std::decay_t<decltype(types2)>;
129
1.56k
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
1.56k
            return false;
180
1.56k
        });
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
127
13
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
13
            using Types2 = std::decay_t<decltype(types2)>;
129
13
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
13
            return false;
180
13
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_8EEESE_EEEEbSI_
Line
Count
Source
127
20
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
20
            using Types2 = std::decay_t<decltype(types2)>;
129
20
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
20
            return false;
180
20
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_9EEESE_EEEEbSI_
Line
Count
Source
127
130
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
130
            using Types2 = std::decay_t<decltype(types2)>;
129
130
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
130
            return false;
180
130
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_28EEESE_EEEEbSI_
Line
Count
Source
127
21
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
21
            using Types2 = std::decay_t<decltype(types2)>;
129
21
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
21
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
21
                using FromFieldType = typename FromDataType::FieldType;
137
21
                using ToFieldType = typename ToDataType::FieldType;
138
21
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
21
                UInt32 from_scale = 0;
140
141
21
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
21
                    const auto* from_decimal_type =
143
21
                            check_and_get_data_type<FromDataType>(from_type.get());
144
21
                    from_precision =
145
21
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
21
                    from_scale = from_decimal_type->get_scale();
147
21
                }
148
149
21
                UInt32 to_max_digits = 0;
150
21
                UInt32 to_precision = 0;
151
21
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
21
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
21
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
21
                    to_precision = to_max_digits;
167
21
                }
168
169
21
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
21
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
21
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
21
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
21
                return narrow_integral || multiply_may_overflow;
178
21
            }
179
0
            return false;
180
21
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_29EEESE_EEEEbSI_
Line
Count
Source
127
38
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
38
            using Types2 = std::decay_t<decltype(types2)>;
129
38
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
38
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
38
                using FromFieldType = typename FromDataType::FieldType;
137
38
                using ToFieldType = typename ToDataType::FieldType;
138
38
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
38
                UInt32 from_scale = 0;
140
141
38
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
38
                    const auto* from_decimal_type =
143
38
                            check_and_get_data_type<FromDataType>(from_type.get());
144
38
                    from_precision =
145
38
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
38
                    from_scale = from_decimal_type->get_scale();
147
38
                }
148
149
38
                UInt32 to_max_digits = 0;
150
38
                UInt32 to_precision = 0;
151
38
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
38
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
38
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
38
                    to_precision = to_max_digits;
167
38
                }
168
169
38
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
38
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
38
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
38
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
38
                return narrow_integral || multiply_may_overflow;
178
38
            }
179
0
            return false;
180
38
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_20EEESE_EEEEbSI_
Line
Count
Source
127
8
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
8
            using Types2 = std::decay_t<decltype(types2)>;
129
8
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
8
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
8
                using FromFieldType = typename FromDataType::FieldType;
137
8
                using ToFieldType = typename ToDataType::FieldType;
138
8
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
8
                UInt32 from_scale = 0;
140
141
8
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
8
                    const auto* from_decimal_type =
143
8
                            check_and_get_data_type<FromDataType>(from_type.get());
144
8
                    from_precision =
145
8
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
8
                    from_scale = from_decimal_type->get_scale();
147
8
                }
148
149
8
                UInt32 to_max_digits = 0;
150
8
                UInt32 to_precision = 0;
151
8
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
8
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
8
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
8
                    to_precision = to_max_digits;
167
8
                }
168
169
8
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
8
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
8
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
8
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
8
                return narrow_integral || multiply_may_overflow;
178
8
            }
179
0
            return false;
180
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
127
250
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
250
            using Types2 = std::decay_t<decltype(types2)>;
129
250
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
250
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
250
                using FromFieldType = typename FromDataType::FieldType;
137
250
                using ToFieldType = typename ToDataType::FieldType;
138
250
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
250
                UInt32 from_scale = 0;
140
141
250
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
250
                    const auto* from_decimal_type =
143
250
                            check_and_get_data_type<FromDataType>(from_type.get());
144
250
                    from_precision =
145
250
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
250
                    from_scale = from_decimal_type->get_scale();
147
250
                }
148
149
250
                UInt32 to_max_digits = 0;
150
250
                UInt32 to_precision = 0;
151
250
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
250
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
250
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
250
                    to_precision = to_max_digits;
167
250
                }
168
169
250
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
250
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
250
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
250
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
250
                return narrow_integral || multiply_may_overflow;
178
250
            }
179
0
            return false;
180
250
        });
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
127
22
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
22
            using Types2 = std::decay_t<decltype(types2)>;
129
22
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
22
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
22
                using FromFieldType = typename FromDataType::FieldType;
137
22
                using ToFieldType = typename ToDataType::FieldType;
138
22
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
22
                UInt32 from_scale = 0;
140
141
22
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
22
                    const auto* from_decimal_type =
143
22
                            check_and_get_data_type<FromDataType>(from_type.get());
144
22
                    from_precision =
145
22
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
22
                    from_scale = from_decimal_type->get_scale();
147
22
                }
148
149
22
                UInt32 to_max_digits = 0;
150
22
                UInt32 to_precision = 0;
151
22
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
22
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
22
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
22
                    to_precision = to_max_digits;
167
22
                }
168
169
22
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
22
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
22
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
22
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
22
                return narrow_integral || multiply_may_overflow;
178
22
            }
179
0
            return false;
180
22
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeDateESE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeDateV2ESE_EEEEbSI_
Line
Count
Source
127
16
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
16
            using Types2 = std::decay_t<decltype(types2)>;
129
16
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
16
            return false;
180
16
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_18DataTypeDateTimeV2ESE_EEEEbSI_
Line
Count
Source
127
24
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
24
            using Types2 = std::decay_t<decltype(types2)>;
129
24
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
24
            return false;
180
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
127
276
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
276
            using Types2 = std::decay_t<decltype(types2)>;
129
276
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
276
            return false;
180
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
127
18.2k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
18.2k
            using Types2 = std::decay_t<decltype(types2)>;
129
18.2k
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
18.2k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
18.2k
                return false;
134
18.2k
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
18.2k
            return false;
180
18.2k
        });
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
127
486
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
486
            using Types2 = std::decay_t<decltype(types2)>;
129
486
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
486
            return false;
180
486
        });
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
127
1.29k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
1.29k
            using Types2 = std::decay_t<decltype(types2)>;
129
1.29k
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
1.29k
            return false;
180
1.29k
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_4EEESE_EEEEbSI_
Line
Count
Source
127
593
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
593
            using Types2 = std::decay_t<decltype(types2)>;
129
593
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
593
            return false;
180
593
        });
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
127
7.80k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
7.80k
            using Types2 = std::decay_t<decltype(types2)>;
129
7.80k
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
7.80k
            return false;
180
7.80k
        });
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
127
315
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
315
            using Types2 = std::decay_t<decltype(types2)>;
129
315
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
315
            return false;
180
315
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_8EEESE_EEEEbSI_
Line
Count
Source
127
642
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
642
            using Types2 = std::decay_t<decltype(types2)>;
129
642
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
642
            return false;
180
642
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_9EEESE_EEEEbSI_
Line
Count
Source
127
2.32k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
2.32k
            using Types2 = std::decay_t<decltype(types2)>;
129
2.32k
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
2.32k
            return false;
180
2.32k
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_28EEESE_EEEEbSI_
Line
Count
Source
127
310
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
310
            using Types2 = std::decay_t<decltype(types2)>;
129
310
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
310
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
310
                using FromFieldType = typename FromDataType::FieldType;
137
310
                using ToFieldType = typename ToDataType::FieldType;
138
310
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
310
                UInt32 from_scale = 0;
140
141
310
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
310
                    const auto* from_decimal_type =
143
310
                            check_and_get_data_type<FromDataType>(from_type.get());
144
310
                    from_precision =
145
310
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
310
                    from_scale = from_decimal_type->get_scale();
147
310
                }
148
149
310
                UInt32 to_max_digits = 0;
150
310
                UInt32 to_precision = 0;
151
310
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
310
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
310
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
310
                    to_precision = to_max_digits;
167
310
                }
168
169
310
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
310
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
310
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
310
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
312
                return narrow_integral || multiply_may_overflow;
178
310
            }
179
0
            return false;
180
310
        });
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
127
315
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
315
            using Types2 = std::decay_t<decltype(types2)>;
129
315
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
315
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
315
                using FromFieldType = typename FromDataType::FieldType;
137
315
                using ToFieldType = typename ToDataType::FieldType;
138
315
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
315
                UInt32 from_scale = 0;
140
141
315
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
315
                    const auto* from_decimal_type =
143
315
                            check_and_get_data_type<FromDataType>(from_type.get());
144
315
                    from_precision =
145
315
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
315
                    from_scale = from_decimal_type->get_scale();
147
315
                }
148
149
315
                UInt32 to_max_digits = 0;
150
315
                UInt32 to_precision = 0;
151
315
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
315
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
315
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
315
                    to_precision = to_max_digits;
167
315
                }
168
169
315
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
315
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
315
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
315
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
317
                return narrow_integral || multiply_may_overflow;
178
315
            }
179
0
            return false;
180
315
        });
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
127
301
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
301
            using Types2 = std::decay_t<decltype(types2)>;
129
301
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
301
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
301
                using FromFieldType = typename FromDataType::FieldType;
137
301
                using ToFieldType = typename ToDataType::FieldType;
138
301
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
301
                UInt32 from_scale = 0;
140
141
301
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
301
                    const auto* from_decimal_type =
143
301
                            check_and_get_data_type<FromDataType>(from_type.get());
144
301
                    from_precision =
145
301
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
301
                    from_scale = from_decimal_type->get_scale();
147
301
                }
148
149
301
                UInt32 to_max_digits = 0;
150
301
                UInt32 to_precision = 0;
151
301
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
301
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
301
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
301
                    to_precision = to_max_digits;
167
301
                }
168
169
301
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
301
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
301
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
301
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
301
                return narrow_integral || multiply_may_overflow;
178
301
            }
179
0
            return false;
180
301
        });
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
127
744
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
744
            using Types2 = std::decay_t<decltype(types2)>;
129
744
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
744
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
744
                using FromFieldType = typename FromDataType::FieldType;
137
744
                using ToFieldType = typename ToDataType::FieldType;
138
744
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
744
                UInt32 from_scale = 0;
140
141
744
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
744
                    const auto* from_decimal_type =
143
744
                            check_and_get_data_type<FromDataType>(from_type.get());
144
744
                    from_precision =
145
744
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
744
                    from_scale = from_decimal_type->get_scale();
147
744
                }
148
149
744
                UInt32 to_max_digits = 0;
150
744
                UInt32 to_precision = 0;
151
744
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
744
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
744
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
744
                    to_precision = to_max_digits;
167
744
                }
168
169
744
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
744
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
744
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
744
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
744
                return narrow_integral || multiply_may_overflow;
178
744
            }
179
0
            return false;
180
744
        });
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
127
22
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
22
            using Types2 = std::decay_t<decltype(types2)>;
129
22
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
22
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
22
                using FromFieldType = typename FromDataType::FieldType;
137
22
                using ToFieldType = typename ToDataType::FieldType;
138
22
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
22
                UInt32 from_scale = 0;
140
141
22
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
22
                    const auto* from_decimal_type =
143
22
                            check_and_get_data_type<FromDataType>(from_type.get());
144
22
                    from_precision =
145
22
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
22
                    from_scale = from_decimal_type->get_scale();
147
22
                }
148
149
22
                UInt32 to_max_digits = 0;
150
22
                UInt32 to_precision = 0;
151
22
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
22
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
22
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
22
                    to_precision = to_max_digits;
167
22
                }
168
169
22
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
22
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
22
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
22
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
22
                return narrow_integral || multiply_may_overflow;
178
22
            }
179
0
            return false;
180
22
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeDateESE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeDateV2ESE_EEEEbSI_
Line
Count
Source
127
1.25k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
1.25k
            using Types2 = std::decay_t<decltype(types2)>;
129
1.25k
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
1.25k
            return false;
180
1.25k
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_18DataTypeDateTimeV2ESE_EEEEbSI_
Line
Count
Source
127
1.25k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
1.25k
            using Types2 = std::decay_t<decltype(types2)>;
129
1.25k
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
1.25k
            return false;
180
1.25k
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_16DataTypeDateTimeESE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeTimeV2ESE_EEEEbSI_
Line
Count
Source
127
4
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
4
            using Types2 = std::decay_t<decltype(types2)>;
129
4
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
4
            return false;
180
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
127
20.1k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
20.1k
            using Types2 = std::decay_t<decltype(types2)>;
129
20.1k
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
20.1k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
20.1k
                return false;
134
20.1k
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
20.1k
            return false;
180
20.1k
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_2EEESE_EEEEbSI_
Line
Count
Source
127
134
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
134
            using Types2 = std::decay_t<decltype(types2)>;
129
134
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
134
            return false;
180
134
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_3EEESE_EEEEbSI_
Line
Count
Source
127
109
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
109
            using Types2 = std::decay_t<decltype(types2)>;
129
109
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
109
            return false;
180
109
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_4EEESE_EEEEbSI_
Line
Count
Source
127
79
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
79
            using Types2 = std::decay_t<decltype(types2)>;
129
79
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
79
            return false;
180
79
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_5EEESE_EEEEbSI_
Line
Count
Source
127
133
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
133
            using Types2 = std::decay_t<decltype(types2)>;
129
133
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
133
            return false;
180
133
        });
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
127
586
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
586
            using Types2 = std::decay_t<decltype(types2)>;
129
586
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
586
            return false;
180
586
        });
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
127
9
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
9
            using Types2 = std::decay_t<decltype(types2)>;
129
9
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
9
            return false;
180
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
127
13
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
13
            using Types2 = std::decay_t<decltype(types2)>;
129
13
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
13
            return false;
180
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
127
18
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
18
            using Types2 = std::decay_t<decltype(types2)>;
129
18
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
18
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
18
                using FromFieldType = typename FromDataType::FieldType;
137
18
                using ToFieldType = typename ToDataType::FieldType;
138
18
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
18
                UInt32 from_scale = 0;
140
141
18
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
18
                    const auto* from_decimal_type =
143
18
                            check_and_get_data_type<FromDataType>(from_type.get());
144
18
                    from_precision =
145
18
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
18
                    from_scale = from_decimal_type->get_scale();
147
18
                }
148
149
18
                UInt32 to_max_digits = 0;
150
18
                UInt32 to_precision = 0;
151
18
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
18
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
18
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
18
                    to_precision = to_max_digits;
167
18
                }
168
169
18
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
18
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
18
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
18
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
18
                return narrow_integral || multiply_may_overflow;
178
18
            }
179
0
            return false;
180
18
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_29EEESE_EEEEbSI_
Line
Count
Source
127
21
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
21
            using Types2 = std::decay_t<decltype(types2)>;
129
21
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
21
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
21
                using FromFieldType = typename FromDataType::FieldType;
137
21
                using ToFieldType = typename ToDataType::FieldType;
138
21
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
21
                UInt32 from_scale = 0;
140
141
21
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
21
                    const auto* from_decimal_type =
143
21
                            check_and_get_data_type<FromDataType>(from_type.get());
144
21
                    from_precision =
145
21
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
21
                    from_scale = from_decimal_type->get_scale();
147
21
                }
148
149
21
                UInt32 to_max_digits = 0;
150
21
                UInt32 to_precision = 0;
151
21
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
21
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
21
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
21
                    to_precision = to_max_digits;
167
21
                }
168
169
21
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
21
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
21
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
21
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
21
                return narrow_integral || multiply_may_overflow;
178
21
            }
179
0
            return false;
180
21
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_20EEESE_EEEEbSI_
Line
Count
Source
127
8
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
8
            using Types2 = std::decay_t<decltype(types2)>;
129
8
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
8
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
8
                using FromFieldType = typename FromDataType::FieldType;
137
8
                using ToFieldType = typename ToDataType::FieldType;
138
8
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
8
                UInt32 from_scale = 0;
140
141
8
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
8
                    const auto* from_decimal_type =
143
8
                            check_and_get_data_type<FromDataType>(from_type.get());
144
8
                    from_precision =
145
8
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
8
                    from_scale = from_decimal_type->get_scale();
147
8
                }
148
149
8
                UInt32 to_max_digits = 0;
150
8
                UInt32 to_precision = 0;
151
8
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
8
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
8
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
8
                    to_precision = to_max_digits;
167
8
                }
168
169
8
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
8
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
8
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
8
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
8
                return narrow_integral || multiply_may_overflow;
178
8
            }
179
0
            return false;
180
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
127
21
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
21
            using Types2 = std::decay_t<decltype(types2)>;
129
21
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
21
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
21
                using FromFieldType = typename FromDataType::FieldType;
137
21
                using ToFieldType = typename ToDataType::FieldType;
138
21
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
21
                UInt32 from_scale = 0;
140
141
21
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
21
                    const auto* from_decimal_type =
143
21
                            check_and_get_data_type<FromDataType>(from_type.get());
144
21
                    from_precision =
145
21
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
21
                    from_scale = from_decimal_type->get_scale();
147
21
                }
148
149
21
                UInt32 to_max_digits = 0;
150
21
                UInt32 to_precision = 0;
151
21
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
21
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
21
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
21
                    to_precision = to_max_digits;
167
21
                }
168
169
21
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
21
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
21
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
21
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
21
                return narrow_integral || multiply_may_overflow;
178
21
            }
179
0
            return false;
180
21
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_35EEESE_EEEEbSI_
Line
Count
Source
127
783
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
783
            using Types2 = std::decay_t<decltype(types2)>;
129
783
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
783
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
783
                using FromFieldType = typename FromDataType::FieldType;
137
783
                using ToFieldType = typename ToDataType::FieldType;
138
783
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
783
                UInt32 from_scale = 0;
140
141
783
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
783
                    const auto* from_decimal_type =
143
783
                            check_and_get_data_type<FromDataType>(from_type.get());
144
783
                    from_precision =
145
783
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
783
                    from_scale = from_decimal_type->get_scale();
147
783
                }
148
149
783
                UInt32 to_max_digits = 0;
150
783
                UInt32 to_precision = 0;
151
783
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
783
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
783
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
783
                    to_precision = to_max_digits;
167
783
                }
168
169
783
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
783
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
783
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
783
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
783
                return narrow_integral || multiply_may_overflow;
178
783
            }
179
0
            return false;
180
783
        });
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
127
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
2
            using Types2 = std::decay_t<decltype(types2)>;
129
2
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
2
            return false;
180
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
127
16
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
16
            using Types2 = std::decay_t<decltype(types2)>;
129
16
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
16
            return false;
180
16
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_16DataTypeDateTimeESE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeTimeV2ESE_EEEEbSI_
Line
Count
Source
127
4
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
4
            using Types2 = std::decay_t<decltype(types2)>;
129
4
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
4
            return false;
180
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
127
2.31k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
2.31k
            using Types2 = std::decay_t<decltype(types2)>;
129
2.31k
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
2.31k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
2.31k
                return false;
134
2.31k
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
2.31k
            return false;
180
2.31k
        });
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
127
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
2
            using Types2 = std::decay_t<decltype(types2)>;
129
2
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
2
            return false;
180
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
127
29
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
29
            using Types2 = std::decay_t<decltype(types2)>;
129
29
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
29
            return false;
180
29
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE8EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_4EEESE_EEEEbSI_
Line
Count
Source
127
6
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
6
            using Types2 = std::decay_t<decltype(types2)>;
129
6
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
6
            return false;
180
6
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE8EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_5EEESE_EEEEbSI_
Line
Count
Source
127
18
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
18
            using Types2 = std::decay_t<decltype(types2)>;
129
18
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
18
            return false;
180
18
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE8EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_6EEESE_EEEEbSI_
Line
Count
Source
127
6
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
6
            using Types2 = std::decay_t<decltype(types2)>;
129
6
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
6
            return false;
180
6
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE8EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_7EEESE_EEEEbSI_
Line
Count
Source
127
115
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
115
            using Types2 = std::decay_t<decltype(types2)>;
129
115
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
115
            return false;
180
115
        });
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
127
89
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
89
            using Types2 = std::decay_t<decltype(types2)>;
129
89
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
89
            return false;
180
89
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE8EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_28EEESE_EEEEbSI_
Line
Count
Source
127
117
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
117
            using Types2 = std::decay_t<decltype(types2)>;
129
117
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
117
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
117
                using FromFieldType = typename FromDataType::FieldType;
137
117
                using ToFieldType = typename ToDataType::FieldType;
138
117
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
117
                UInt32 from_scale = 0;
140
141
117
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
117
                    const auto* from_decimal_type =
143
117
                            check_and_get_data_type<FromDataType>(from_type.get());
144
117
                    from_precision =
145
117
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
117
                    from_scale = from_decimal_type->get_scale();
147
117
                }
148
149
117
                UInt32 to_max_digits = 0;
150
117
                UInt32 to_precision = 0;
151
117
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
117
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
117
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
117
                    to_precision = to_max_digits;
167
117
                }
168
169
117
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
117
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
117
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
117
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
117
                return narrow_integral || multiply_may_overflow;
178
117
            }
179
0
            return false;
180
117
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE8EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_29EEESE_EEEEbSI_
Line
Count
Source
127
112
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
112
            using Types2 = std::decay_t<decltype(types2)>;
129
112
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
112
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
112
                using FromFieldType = typename FromDataType::FieldType;
137
112
                using ToFieldType = typename ToDataType::FieldType;
138
112
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
112
                UInt32 from_scale = 0;
140
141
112
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
112
                    const auto* from_decimal_type =
143
112
                            check_and_get_data_type<FromDataType>(from_type.get());
144
112
                    from_precision =
145
112
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
112
                    from_scale = from_decimal_type->get_scale();
147
112
                }
148
149
112
                UInt32 to_max_digits = 0;
150
112
                UInt32 to_precision = 0;
151
112
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
112
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
112
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
112
                    to_precision = to_max_digits;
167
112
                }
168
169
112
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
112
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
112
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
112
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
112
                return narrow_integral || multiply_may_overflow;
178
112
            }
179
0
            return false;
180
112
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE8EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_20EEESE_EEEEbSI_
Line
Count
Source
127
14
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
14
            using Types2 = std::decay_t<decltype(types2)>;
129
14
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
14
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
14
                using FromFieldType = typename FromDataType::FieldType;
137
14
                using ToFieldType = typename ToDataType::FieldType;
138
14
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
14
                UInt32 from_scale = 0;
140
141
14
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
14
                    const auto* from_decimal_type =
143
14
                            check_and_get_data_type<FromDataType>(from_type.get());
144
14
                    from_precision =
145
14
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
14
                    from_scale = from_decimal_type->get_scale();
147
14
                }
148
149
14
                UInt32 to_max_digits = 0;
150
14
                UInt32 to_precision = 0;
151
14
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
14
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
14
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
14
                    to_precision = to_max_digits;
167
14
                }
168
169
14
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
14
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
14
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
14
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
14
                return narrow_integral || multiply_may_overflow;
178
14
            }
179
0
            return false;
180
14
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE8EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_30EEESE_EEEEbSI_
Line
Count
Source
127
99
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
99
            using Types2 = std::decay_t<decltype(types2)>;
129
99
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
99
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
99
                using FromFieldType = typename FromDataType::FieldType;
137
99
                using ToFieldType = typename ToDataType::FieldType;
138
99
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
99
                UInt32 from_scale = 0;
140
141
99
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
99
                    const auto* from_decimal_type =
143
99
                            check_and_get_data_type<FromDataType>(from_type.get());
144
99
                    from_precision =
145
99
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
99
                    from_scale = from_decimal_type->get_scale();
147
99
                }
148
149
99
                UInt32 to_max_digits = 0;
150
99
                UInt32 to_precision = 0;
151
99
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
99
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
99
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
99
                    to_precision = to_max_digits;
167
99
                }
168
169
99
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
99
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
99
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
99
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
99
                return narrow_integral || multiply_may_overflow;
178
99
            }
179
0
            return false;
180
99
        });
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
127
554
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
554
            using Types2 = std::decay_t<decltype(types2)>;
129
554
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
554
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
554
                using FromFieldType = typename FromDataType::FieldType;
137
554
                using ToFieldType = typename ToDataType::FieldType;
138
554
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
554
                UInt32 from_scale = 0;
140
141
554
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
554
                    const auto* from_decimal_type =
143
554
                            check_and_get_data_type<FromDataType>(from_type.get());
144
554
                    from_precision =
145
554
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
554
                    from_scale = from_decimal_type->get_scale();
147
554
                }
148
149
554
                UInt32 to_max_digits = 0;
150
554
                UInt32 to_precision = 0;
151
554
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
554
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
554
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
554
                    to_precision = to_max_digits;
167
554
                }
168
169
554
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
554
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
554
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
554
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
554
                return narrow_integral || multiply_may_overflow;
178
554
            }
179
0
            return false;
180
554
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE8EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeDateESE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE8EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeDateV2ESE_EEEEbSI_
Line
Count
Source
127
39
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
39
            using Types2 = std::decay_t<decltype(types2)>;
129
39
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
39
            return false;
180
39
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE8EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_18DataTypeDateTimeV2ESE_EEEEbSI_
Line
Count
Source
127
7.78k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
7.78k
            using Types2 = std::decay_t<decltype(types2)>;
129
7.78k
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
7.78k
            return false;
180
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
127
162
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
162
            using Types2 = std::decay_t<decltype(types2)>;
129
162
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
162
            return false;
180
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
127
1.63k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
1.63k
            using Types2 = std::decay_t<decltype(types2)>;
129
1.63k
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
1.63k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
1.63k
                return false;
134
1.63k
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
1.63k
            return false;
180
1.63k
        });
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
127
417
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
417
            using Types2 = std::decay_t<decltype(types2)>;
129
417
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
417
            return false;
180
417
        });
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
127
543
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
543
            using Types2 = std::decay_t<decltype(types2)>;
129
543
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
543
            return false;
180
543
        });
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
127
1.09k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
1.09k
            using Types2 = std::decay_t<decltype(types2)>;
129
1.09k
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
1.09k
            return false;
180
1.09k
        });
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
127
1.14k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
1.14k
            using Types2 = std::decay_t<decltype(types2)>;
129
1.14k
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
1.14k
            return false;
180
1.14k
        });
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
127
1.51k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
1.51k
            using Types2 = std::decay_t<decltype(types2)>;
129
1.51k
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
1.51k
            return false;
180
1.51k
        });
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
127
196
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
196
            using Types2 = std::decay_t<decltype(types2)>;
129
196
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
196
            return false;
180
196
        });
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
127
1.25k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
1.25k
            using Types2 = std::decay_t<decltype(types2)>;
129
1.25k
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
1.25k
            return false;
180
1.25k
        });
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
127
539
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
539
            using Types2 = std::decay_t<decltype(types2)>;
129
539
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
539
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
539
                using FromFieldType = typename FromDataType::FieldType;
137
539
                using ToFieldType = typename ToDataType::FieldType;
138
539
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
539
                UInt32 from_scale = 0;
140
141
539
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
539
                    const auto* from_decimal_type =
143
539
                            check_and_get_data_type<FromDataType>(from_type.get());
144
539
                    from_precision =
145
539
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
539
                    from_scale = from_decimal_type->get_scale();
147
539
                }
148
149
539
                UInt32 to_max_digits = 0;
150
539
                UInt32 to_precision = 0;
151
539
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
539
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
539
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
539
                    to_precision = to_max_digits;
167
539
                }
168
169
539
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
539
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
539
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
539
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
539
                return narrow_integral || multiply_may_overflow;
178
539
            }
179
0
            return false;
180
539
        });
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
127
313
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
313
            using Types2 = std::decay_t<decltype(types2)>;
129
313
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
313
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
313
                using FromFieldType = typename FromDataType::FieldType;
137
313
                using ToFieldType = typename ToDataType::FieldType;
138
313
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
313
                UInt32 from_scale = 0;
140
141
313
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
313
                    const auto* from_decimal_type =
143
313
                            check_and_get_data_type<FromDataType>(from_type.get());
144
313
                    from_precision =
145
313
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
313
                    from_scale = from_decimal_type->get_scale();
147
313
                }
148
149
313
                UInt32 to_max_digits = 0;
150
313
                UInt32 to_precision = 0;
151
313
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
313
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
313
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
313
                    to_precision = to_max_digits;
167
313
                }
168
169
313
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
313
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
313
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
313
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
314
                return narrow_integral || multiply_may_overflow;
178
313
            }
179
0
            return false;
180
313
        });
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
127
54
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
54
            using Types2 = std::decay_t<decltype(types2)>;
129
54
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
54
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
54
                using FromFieldType = typename FromDataType::FieldType;
137
54
                using ToFieldType = typename ToDataType::FieldType;
138
54
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
54
                UInt32 from_scale = 0;
140
141
54
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
54
                    const auto* from_decimal_type =
143
54
                            check_and_get_data_type<FromDataType>(from_type.get());
144
54
                    from_precision =
145
54
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
54
                    from_scale = from_decimal_type->get_scale();
147
54
                }
148
149
54
                UInt32 to_max_digits = 0;
150
54
                UInt32 to_precision = 0;
151
54
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
54
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
54
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
54
                    to_precision = to_max_digits;
167
54
                }
168
169
54
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
54
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
54
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
54
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
54
                return narrow_integral || multiply_may_overflow;
178
54
            }
179
0
            return false;
180
54
        });
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
127
693
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
693
            using Types2 = std::decay_t<decltype(types2)>;
129
693
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
693
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
693
                using FromFieldType = typename FromDataType::FieldType;
137
693
                using ToFieldType = typename ToDataType::FieldType;
138
693
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
693
                UInt32 from_scale = 0;
140
141
693
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
693
                    const auto* from_decimal_type =
143
693
                            check_and_get_data_type<FromDataType>(from_type.get());
144
693
                    from_precision =
145
693
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
693
                    from_scale = from_decimal_type->get_scale();
147
693
                }
148
149
693
                UInt32 to_max_digits = 0;
150
693
                UInt32 to_precision = 0;
151
693
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
693
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
693
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
693
                    to_precision = to_max_digits;
167
693
                }
168
169
693
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
693
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
693
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
693
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
693
                return narrow_integral || multiply_may_overflow;
178
693
            }
179
0
            return false;
180
693
        });
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
127
542
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
542
            using Types2 = std::decay_t<decltype(types2)>;
129
542
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
542
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
542
                using FromFieldType = typename FromDataType::FieldType;
137
542
                using ToFieldType = typename ToDataType::FieldType;
138
542
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
542
                UInt32 from_scale = 0;
140
141
542
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
542
                    const auto* from_decimal_type =
143
542
                            check_and_get_data_type<FromDataType>(from_type.get());
144
542
                    from_precision =
145
542
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
542
                    from_scale = from_decimal_type->get_scale();
147
542
                }
148
149
542
                UInt32 to_max_digits = 0;
150
542
                UInt32 to_precision = 0;
151
542
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
542
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
542
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
542
                    to_precision = to_max_digits;
167
542
                }
168
169
542
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
542
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
542
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
542
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
542
                return narrow_integral || multiply_may_overflow;
178
542
            }
179
0
            return false;
180
542
        });
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
127
202
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
202
            using Types2 = std::decay_t<decltype(types2)>;
129
202
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
202
            return false;
180
202
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE9EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_18DataTypeDateTimeV2ESE_EEEEbSI_
Line
Count
Source
127
7.95k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
7.95k
            using Types2 = std::decay_t<decltype(types2)>;
129
7.95k
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
7.95k
            return false;
180
7.95k
        });
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
127
162
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
162
            using Types2 = std::decay_t<decltype(types2)>;
129
162
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
162
            return false;
180
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
127
7.20k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
7.20k
            using Types2 = std::decay_t<decltype(types2)>;
129
7.20k
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
7.20k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
7.20k
                return false;
134
7.20k
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
7.20k
            return false;
180
7.20k
        });
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
127
19
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
19
            using Types2 = std::decay_t<decltype(types2)>;
129
19
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
19
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
19
                using FromFieldType = typename FromDataType::FieldType;
137
19
                using ToFieldType = typename ToDataType::FieldType;
138
19
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
19
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
19
                UInt32 to_max_digits = 0;
150
19
                UInt32 to_precision = 0;
151
19
                UInt32 to_scale = 0;
152
153
19
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
19
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
19
                    const auto* to_decimal_type =
157
19
                            check_and_get_data_type<ToDataType>(to_type.get());
158
19
                    to_precision = to_decimal_type->get_precision();
159
19
                    ToDataType::check_type_precision(to_precision);
160
161
19
                    to_scale = to_decimal_type->get_scale();
162
19
                    ToDataType::check_type_scale(to_scale);
163
19
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
19
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
19
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
19
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
19
                if (to_scale > from_scale) {
174
18
                    multiply_may_overflow &=
175
18
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
18
                }
177
19
                return narrow_integral || multiply_may_overflow;
178
19
            }
179
0
            return false;
180
19
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_3EEESE_EEEEbSI_
Line
Count
Source
127
509
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
509
            using Types2 = std::decay_t<decltype(types2)>;
129
509
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
509
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
509
                using FromFieldType = typename FromDataType::FieldType;
137
509
                using ToFieldType = typename ToDataType::FieldType;
138
509
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
509
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
509
                UInt32 to_max_digits = 0;
150
509
                UInt32 to_precision = 0;
151
509
                UInt32 to_scale = 0;
152
153
509
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
509
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
509
                    const auto* to_decimal_type =
157
509
                            check_and_get_data_type<ToDataType>(to_type.get());
158
509
                    to_precision = to_decimal_type->get_precision();
159
509
                    ToDataType::check_type_precision(to_precision);
160
161
509
                    to_scale = to_decimal_type->get_scale();
162
509
                    ToDataType::check_type_scale(to_scale);
163
509
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
509
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
509
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
509
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
509
                if (to_scale > from_scale) {
174
304
                    multiply_may_overflow &=
175
304
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
304
                }
177
509
                return narrow_integral || multiply_may_overflow;
178
509
            }
179
0
            return false;
180
509
        });
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
127
516
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
516
            using Types2 = std::decay_t<decltype(types2)>;
129
516
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
516
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
516
                using FromFieldType = typename FromDataType::FieldType;
137
516
                using ToFieldType = typename ToDataType::FieldType;
138
516
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
516
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
516
                UInt32 to_max_digits = 0;
150
516
                UInt32 to_precision = 0;
151
516
                UInt32 to_scale = 0;
152
153
516
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
516
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
516
                    const auto* to_decimal_type =
157
516
                            check_and_get_data_type<ToDataType>(to_type.get());
158
516
                    to_precision = to_decimal_type->get_precision();
159
516
                    ToDataType::check_type_precision(to_precision);
160
161
516
                    to_scale = to_decimal_type->get_scale();
162
516
                    ToDataType::check_type_scale(to_scale);
163
516
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
516
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
516
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
516
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
516
                if (to_scale > from_scale) {
174
262
                    multiply_may_overflow &=
175
262
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
262
                }
177
516
                return narrow_integral || multiply_may_overflow;
178
516
            }
179
0
            return false;
180
516
        });
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
127
553
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
553
            using Types2 = std::decay_t<decltype(types2)>;
129
553
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
553
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
553
                using FromFieldType = typename FromDataType::FieldType;
137
553
                using ToFieldType = typename ToDataType::FieldType;
138
553
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
553
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
553
                UInt32 to_max_digits = 0;
150
553
                UInt32 to_precision = 0;
151
553
                UInt32 to_scale = 0;
152
153
553
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
553
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
553
                    const auto* to_decimal_type =
157
553
                            check_and_get_data_type<ToDataType>(to_type.get());
158
553
                    to_precision = to_decimal_type->get_precision();
159
553
                    ToDataType::check_type_precision(to_precision);
160
161
553
                    to_scale = to_decimal_type->get_scale();
162
553
                    ToDataType::check_type_scale(to_scale);
163
553
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
553
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
553
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
553
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
553
                if (to_scale > from_scale) {
174
280
                    multiply_may_overflow &=
175
280
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
280
                }
177
553
                return narrow_integral || multiply_may_overflow;
178
553
            }
179
0
            return false;
180
553
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_6EEESE_EEEEbSI_
Line
Count
Source
127
612
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
612
            using Types2 = std::decay_t<decltype(types2)>;
129
612
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
612
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
612
                using FromFieldType = typename FromDataType::FieldType;
137
612
                using ToFieldType = typename ToDataType::FieldType;
138
612
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
612
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
612
                UInt32 to_max_digits = 0;
150
612
                UInt32 to_precision = 0;
151
612
                UInt32 to_scale = 0;
152
153
612
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
612
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
612
                    const auto* to_decimal_type =
157
612
                            check_and_get_data_type<ToDataType>(to_type.get());
158
612
                    to_precision = to_decimal_type->get_precision();
159
612
                    ToDataType::check_type_precision(to_precision);
160
161
612
                    to_scale = to_decimal_type->get_scale();
162
612
                    ToDataType::check_type_scale(to_scale);
163
612
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
612
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
612
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
612
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
612
                if (to_scale > from_scale) {
174
266
                    multiply_may_overflow &=
175
266
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
266
                }
177
612
                return narrow_integral || multiply_may_overflow;
178
612
            }
179
0
            return false;
180
612
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_7EEESE_EEEEbSI_
Line
Count
Source
127
549
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
549
            using Types2 = std::decay_t<decltype(types2)>;
129
549
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
549
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
549
                using FromFieldType = typename FromDataType::FieldType;
137
549
                using ToFieldType = typename ToDataType::FieldType;
138
549
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
549
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
549
                UInt32 to_max_digits = 0;
150
549
                UInt32 to_precision = 0;
151
549
                UInt32 to_scale = 0;
152
153
549
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
549
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
549
                    const auto* to_decimal_type =
157
549
                            check_and_get_data_type<ToDataType>(to_type.get());
158
549
                    to_precision = to_decimal_type->get_precision();
159
549
                    ToDataType::check_type_precision(to_precision);
160
161
549
                    to_scale = to_decimal_type->get_scale();
162
549
                    ToDataType::check_type_scale(to_scale);
163
549
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
549
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
549
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
549
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
549
                if (to_scale > from_scale) {
174
278
                    multiply_may_overflow &=
175
278
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
278
                }
177
549
                return narrow_integral || multiply_may_overflow;
178
549
            }
179
0
            return false;
180
549
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_8EEESE_EEEEbSI_
Line
Count
Source
127
104
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
104
            using Types2 = std::decay_t<decltype(types2)>;
129
104
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
104
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
104
                using FromFieldType = typename FromDataType::FieldType;
137
104
                using ToFieldType = typename ToDataType::FieldType;
138
104
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
104
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
104
                UInt32 to_max_digits = 0;
150
104
                UInt32 to_precision = 0;
151
104
                UInt32 to_scale = 0;
152
153
104
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
104
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
104
                    const auto* to_decimal_type =
157
104
                            check_and_get_data_type<ToDataType>(to_type.get());
158
104
                    to_precision = to_decimal_type->get_precision();
159
104
                    ToDataType::check_type_precision(to_precision);
160
161
104
                    to_scale = to_decimal_type->get_scale();
162
104
                    ToDataType::check_type_scale(to_scale);
163
104
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
104
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
104
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
104
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
104
                if (to_scale > from_scale) {
174
68
                    multiply_may_overflow &=
175
68
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
68
                }
177
104
                return narrow_integral || multiply_may_overflow;
178
104
            }
179
0
            return false;
180
104
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_9EEESE_EEEEbSI_
Line
Count
Source
127
308
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
308
            using Types2 = std::decay_t<decltype(types2)>;
129
308
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
308
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
308
                using FromFieldType = typename FromDataType::FieldType;
137
308
                using ToFieldType = typename ToDataType::FieldType;
138
308
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
308
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
308
                UInt32 to_max_digits = 0;
150
308
                UInt32 to_precision = 0;
151
308
                UInt32 to_scale = 0;
152
153
308
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
308
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
308
                    const auto* to_decimal_type =
157
308
                            check_and_get_data_type<ToDataType>(to_type.get());
158
308
                    to_precision = to_decimal_type->get_precision();
159
308
                    ToDataType::check_type_precision(to_precision);
160
161
308
                    to_scale = to_decimal_type->get_scale();
162
308
                    ToDataType::check_type_scale(to_scale);
163
308
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
308
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
308
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
308
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
308
                if (to_scale > from_scale) {
174
258
                    multiply_may_overflow &=
175
258
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
258
                }
177
308
                return narrow_integral || multiply_may_overflow;
178
308
            }
179
0
            return false;
180
308
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_ISE_SE_EEEEbSI_
Line
Count
Source
127
417
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
417
            using Types2 = std::decay_t<decltype(types2)>;
129
417
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
417
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
417
                using FromFieldType = typename FromDataType::FieldType;
137
417
                using ToFieldType = typename ToDataType::FieldType;
138
417
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
417
                UInt32 from_scale = 0;
140
141
417
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
417
                    const auto* from_decimal_type =
143
417
                            check_and_get_data_type<FromDataType>(from_type.get());
144
417
                    from_precision =
145
417
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
417
                    from_scale = from_decimal_type->get_scale();
147
417
                }
148
149
417
                UInt32 to_max_digits = 0;
150
417
                UInt32 to_precision = 0;
151
417
                UInt32 to_scale = 0;
152
153
417
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
417
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
417
                    const auto* to_decimal_type =
157
417
                            check_and_get_data_type<ToDataType>(to_type.get());
158
417
                    to_precision = to_decimal_type->get_precision();
159
417
                    ToDataType::check_type_precision(to_precision);
160
161
417
                    to_scale = to_decimal_type->get_scale();
162
417
                    ToDataType::check_type_scale(to_scale);
163
417
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
417
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
417
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
417
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
417
                if (to_scale > from_scale) {
174
90
                    multiply_may_overflow &=
175
90
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
90
                }
177
417
                return narrow_integral || multiply_may_overflow;
178
417
            }
179
0
            return false;
180
417
        });
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
127
620
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
620
            using Types2 = std::decay_t<decltype(types2)>;
129
620
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
620
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
620
                using FromFieldType = typename FromDataType::FieldType;
137
620
                using ToFieldType = typename ToDataType::FieldType;
138
620
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
620
                UInt32 from_scale = 0;
140
141
620
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
620
                    const auto* from_decimal_type =
143
620
                            check_and_get_data_type<FromDataType>(from_type.get());
144
620
                    from_precision =
145
620
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
620
                    from_scale = from_decimal_type->get_scale();
147
620
                }
148
149
620
                UInt32 to_max_digits = 0;
150
620
                UInt32 to_precision = 0;
151
620
                UInt32 to_scale = 0;
152
153
620
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
620
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
620
                    const auto* to_decimal_type =
157
620
                            check_and_get_data_type<ToDataType>(to_type.get());
158
620
                    to_precision = to_decimal_type->get_precision();
159
620
                    ToDataType::check_type_precision(to_precision);
160
161
620
                    to_scale = to_decimal_type->get_scale();
162
620
                    ToDataType::check_type_scale(to_scale);
163
620
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
620
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
620
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
620
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
620
                if (to_scale > from_scale) {
174
198
                    multiply_may_overflow &=
175
198
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
198
                }
177
620
                return narrow_integral || multiply_may_overflow;
178
620
            }
179
0
            return false;
180
620
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_20EEESE_EEEEbSI_
Line
Count
Source
127
206
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
206
            using Types2 = std::decay_t<decltype(types2)>;
129
206
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
206
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
206
                using FromFieldType = typename FromDataType::FieldType;
137
206
                using ToFieldType = typename ToDataType::FieldType;
138
206
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
206
                UInt32 from_scale = 0;
140
141
206
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
206
                    const auto* from_decimal_type =
143
206
                            check_and_get_data_type<FromDataType>(from_type.get());
144
206
                    from_precision =
145
206
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
206
                    from_scale = from_decimal_type->get_scale();
147
206
                }
148
149
206
                UInt32 to_max_digits = 0;
150
206
                UInt32 to_precision = 0;
151
206
                UInt32 to_scale = 0;
152
153
206
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
206
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
206
                    const auto* to_decimal_type =
157
206
                            check_and_get_data_type<ToDataType>(to_type.get());
158
206
                    to_precision = to_decimal_type->get_precision();
159
206
                    ToDataType::check_type_precision(to_precision);
160
161
206
                    to_scale = to_decimal_type->get_scale();
162
206
                    ToDataType::check_type_scale(to_scale);
163
206
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
206
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
206
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
206
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
206
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
206
                return narrow_integral || multiply_may_overflow;
178
206
            }
179
0
            return false;
180
206
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_30EEESE_EEEEbSI_
Line
Count
Source
127
434
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
434
            using Types2 = std::decay_t<decltype(types2)>;
129
434
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
434
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
434
                using FromFieldType = typename FromDataType::FieldType;
137
434
                using ToFieldType = typename ToDataType::FieldType;
138
434
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
434
                UInt32 from_scale = 0;
140
141
434
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
434
                    const auto* from_decimal_type =
143
434
                            check_and_get_data_type<FromDataType>(from_type.get());
144
434
                    from_precision =
145
434
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
434
                    from_scale = from_decimal_type->get_scale();
147
434
                }
148
149
434
                UInt32 to_max_digits = 0;
150
434
                UInt32 to_precision = 0;
151
434
                UInt32 to_scale = 0;
152
153
434
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
434
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
434
                    const auto* to_decimal_type =
157
434
                            check_and_get_data_type<ToDataType>(to_type.get());
158
434
                    to_precision = to_decimal_type->get_precision();
159
434
                    ToDataType::check_type_precision(to_precision);
160
161
434
                    to_scale = to_decimal_type->get_scale();
162
434
                    ToDataType::check_type_scale(to_scale);
163
434
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
434
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
434
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
434
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
434
                if (to_scale > from_scale) {
174
141
                    multiply_may_overflow &=
175
141
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
141
                }
177
434
                return narrow_integral || multiply_may_overflow;
178
434
            }
179
0
            return false;
180
434
        });
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
127
303
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
303
            using Types2 = std::decay_t<decltype(types2)>;
129
303
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
303
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
303
                using FromFieldType = typename FromDataType::FieldType;
137
303
                using ToFieldType = typename ToDataType::FieldType;
138
303
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
303
                UInt32 from_scale = 0;
140
141
303
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
303
                    const auto* from_decimal_type =
143
303
                            check_and_get_data_type<FromDataType>(from_type.get());
144
303
                    from_precision =
145
303
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
303
                    from_scale = from_decimal_type->get_scale();
147
303
                }
148
149
303
                UInt32 to_max_digits = 0;
150
303
                UInt32 to_precision = 0;
151
303
                UInt32 to_scale = 0;
152
153
303
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
303
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
303
                    const auto* to_decimal_type =
157
303
                            check_and_get_data_type<ToDataType>(to_type.get());
158
303
                    to_precision = to_decimal_type->get_precision();
159
303
                    ToDataType::check_type_precision(to_precision);
160
161
303
                    to_scale = to_decimal_type->get_scale();
162
303
                    ToDataType::check_type_scale(to_scale);
163
303
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
303
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
303
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
303
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
303
                if (to_scale > from_scale) {
174
79
                    multiply_may_overflow &=
175
79
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
79
                }
177
303
                return narrow_integral || multiply_may_overflow;
178
303
            }
179
0
            return false;
180
303
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeDateESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeDateV2ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_18DataTypeDateTimeV2ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_16DataTypeDateTimeESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeTimeV2ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_19DataTypeTimeStampTzESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeIPv4ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeIPv6ESE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeStringESE_EEEEbSI_
Line
Count
Source
127
2.81k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
2.81k
            using Types2 = std::decay_t<decltype(types2)>;
129
2.81k
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
2.81k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
2.81k
                return false;
134
2.81k
            }
135
2.81k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
2.81k
                using FromFieldType = typename FromDataType::FieldType;
137
2.81k
                using ToFieldType = typename ToDataType::FieldType;
138
2.81k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
2.81k
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
2.81k
                UInt32 to_max_digits = 0;
150
2.81k
                UInt32 to_precision = 0;
151
2.81k
                UInt32 to_scale = 0;
152
153
2.81k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
2.81k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
2.81k
                    const auto* to_decimal_type =
157
2.81k
                            check_and_get_data_type<ToDataType>(to_type.get());
158
2.81k
                    to_precision = to_decimal_type->get_precision();
159
2.81k
                    ToDataType::check_type_precision(to_precision);
160
161
2.81k
                    to_scale = to_decimal_type->get_scale();
162
2.81k
                    ToDataType::check_type_scale(to_scale);
163
2.81k
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
2.81k
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
2.81k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
2.81k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
2.81k
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
2.81k
                return narrow_integral || multiply_may_overflow;
178
2.81k
            }
179
0
            return false;
180
2.81k
        });
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
127
17
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
17
            using Types2 = std::decay_t<decltype(types2)>;
129
17
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
17
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
17
                using FromFieldType = typename FromDataType::FieldType;
137
17
                using ToFieldType = typename ToDataType::FieldType;
138
17
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
17
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
17
                UInt32 to_max_digits = 0;
150
17
                UInt32 to_precision = 0;
151
17
                UInt32 to_scale = 0;
152
153
17
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
17
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
17
                    const auto* to_decimal_type =
157
17
                            check_and_get_data_type<ToDataType>(to_type.get());
158
17
                    to_precision = to_decimal_type->get_precision();
159
17
                    ToDataType::check_type_precision(to_precision);
160
161
17
                    to_scale = to_decimal_type->get_scale();
162
17
                    ToDataType::check_type_scale(to_scale);
163
17
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
17
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
17
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
17
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
17
                if (to_scale > from_scale) {
174
16
                    multiply_may_overflow &=
175
16
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
16
                }
177
17
                return narrow_integral || multiply_may_overflow;
178
17
            }
179
0
            return false;
180
17
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_3EEESE_EEEEbSI_
Line
Count
Source
127
72
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
72
            using Types2 = std::decay_t<decltype(types2)>;
129
72
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
72
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
72
                using FromFieldType = typename FromDataType::FieldType;
137
72
                using ToFieldType = typename ToDataType::FieldType;
138
72
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
72
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
72
                UInt32 to_max_digits = 0;
150
72
                UInt32 to_precision = 0;
151
72
                UInt32 to_scale = 0;
152
153
72
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
72
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
72
                    const auto* to_decimal_type =
157
72
                            check_and_get_data_type<ToDataType>(to_type.get());
158
72
                    to_precision = to_decimal_type->get_precision();
159
72
                    ToDataType::check_type_precision(to_precision);
160
161
72
                    to_scale = to_decimal_type->get_scale();
162
72
                    ToDataType::check_type_scale(to_scale);
163
72
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
72
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
72
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
72
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
72
                if (to_scale > from_scale) {
174
59
                    multiply_may_overflow &=
175
59
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
59
                }
177
72
                return narrow_integral || multiply_may_overflow;
178
72
            }
179
0
            return false;
180
72
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_4EEESE_EEEEbSI_
Line
Count
Source
127
49
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
49
            using Types2 = std::decay_t<decltype(types2)>;
129
49
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
49
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
49
                using FromFieldType = typename FromDataType::FieldType;
137
49
                using ToFieldType = typename ToDataType::FieldType;
138
49
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
49
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
49
                UInt32 to_max_digits = 0;
150
49
                UInt32 to_precision = 0;
151
49
                UInt32 to_scale = 0;
152
153
49
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
49
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
49
                    const auto* to_decimal_type =
157
49
                            check_and_get_data_type<ToDataType>(to_type.get());
158
49
                    to_precision = to_decimal_type->get_precision();
159
49
                    ToDataType::check_type_precision(to_precision);
160
161
49
                    to_scale = to_decimal_type->get_scale();
162
49
                    ToDataType::check_type_scale(to_scale);
163
49
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
49
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
49
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
49
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
49
                if (to_scale > from_scale) {
174
38
                    multiply_may_overflow &=
175
38
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
38
                }
177
49
                return narrow_integral || multiply_may_overflow;
178
49
            }
179
0
            return false;
180
49
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_5EEESE_EEEEbSI_
Line
Count
Source
127
536
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
536
            using Types2 = std::decay_t<decltype(types2)>;
129
536
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
536
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
536
                using FromFieldType = typename FromDataType::FieldType;
137
536
                using ToFieldType = typename ToDataType::FieldType;
138
536
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
536
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
536
                UInt32 to_max_digits = 0;
150
536
                UInt32 to_precision = 0;
151
536
                UInt32 to_scale = 0;
152
153
536
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
536
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
536
                    const auto* to_decimal_type =
157
536
                            check_and_get_data_type<ToDataType>(to_type.get());
158
536
                    to_precision = to_decimal_type->get_precision();
159
536
                    ToDataType::check_type_precision(to_precision);
160
161
536
                    to_scale = to_decimal_type->get_scale();
162
536
                    ToDataType::check_type_scale(to_scale);
163
536
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
536
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
536
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
536
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
536
                if (to_scale > from_scale) {
174
378
                    multiply_may_overflow &=
175
378
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
378
                }
177
536
                return narrow_integral || multiply_may_overflow;
178
536
            }
179
0
            return false;
180
536
        });
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
127
50
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
50
            using Types2 = std::decay_t<decltype(types2)>;
129
50
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
50
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
50
                using FromFieldType = typename FromDataType::FieldType;
137
50
                using ToFieldType = typename ToDataType::FieldType;
138
50
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
50
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
50
                UInt32 to_max_digits = 0;
150
50
                UInt32 to_precision = 0;
151
50
                UInt32 to_scale = 0;
152
153
50
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
50
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
50
                    const auto* to_decimal_type =
157
50
                            check_and_get_data_type<ToDataType>(to_type.get());
158
50
                    to_precision = to_decimal_type->get_precision();
159
50
                    ToDataType::check_type_precision(to_precision);
160
161
50
                    to_scale = to_decimal_type->get_scale();
162
50
                    ToDataType::check_type_scale(to_scale);
163
50
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
50
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
50
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
50
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
50
                if (to_scale > from_scale) {
174
29
                    multiply_may_overflow &=
175
29
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
29
                }
177
50
                return narrow_integral || multiply_may_overflow;
178
50
            }
179
0
            return false;
180
50
        });
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
127
65
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
65
            using Types2 = std::decay_t<decltype(types2)>;
129
65
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
65
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
65
                using FromFieldType = typename FromDataType::FieldType;
137
65
                using ToFieldType = typename ToDataType::FieldType;
138
65
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
65
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
65
                UInt32 to_max_digits = 0;
150
65
                UInt32 to_precision = 0;
151
65
                UInt32 to_scale = 0;
152
153
65
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
65
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
65
                    const auto* to_decimal_type =
157
65
                            check_and_get_data_type<ToDataType>(to_type.get());
158
65
                    to_precision = to_decimal_type->get_precision();
159
65
                    ToDataType::check_type_precision(to_precision);
160
161
65
                    to_scale = to_decimal_type->get_scale();
162
65
                    ToDataType::check_type_scale(to_scale);
163
65
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
65
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
65
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
65
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
65
                if (to_scale > from_scale) {
174
39
                    multiply_may_overflow &=
175
39
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
39
                }
177
65
                return narrow_integral || multiply_may_overflow;
178
65
            }
179
0
            return false;
180
65
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_8EEESE_EEEEbSI_
Line
Count
Source
127
107
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
107
            using Types2 = std::decay_t<decltype(types2)>;
129
107
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
107
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
107
                using FromFieldType = typename FromDataType::FieldType;
137
107
                using ToFieldType = typename ToDataType::FieldType;
138
107
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
107
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
107
                UInt32 to_max_digits = 0;
150
107
                UInt32 to_precision = 0;
151
107
                UInt32 to_scale = 0;
152
153
107
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
107
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
107
                    const auto* to_decimal_type =
157
107
                            check_and_get_data_type<ToDataType>(to_type.get());
158
107
                    to_precision = to_decimal_type->get_precision();
159
107
                    ToDataType::check_type_precision(to_precision);
160
161
107
                    to_scale = to_decimal_type->get_scale();
162
107
                    ToDataType::check_type_scale(to_scale);
163
107
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
107
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
107
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
107
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
107
                if (to_scale > from_scale) {
174
65
                    multiply_may_overflow &=
175
65
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
65
                }
177
107
                return narrow_integral || multiply_may_overflow;
178
107
            }
179
0
            return false;
180
107
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_9EEESE_EEEEbSI_
Line
Count
Source
127
210
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
210
            using Types2 = std::decay_t<decltype(types2)>;
129
210
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
210
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
210
                using FromFieldType = typename FromDataType::FieldType;
137
210
                using ToFieldType = typename ToDataType::FieldType;
138
210
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
210
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
210
                UInt32 to_max_digits = 0;
150
210
                UInt32 to_precision = 0;
151
210
                UInt32 to_scale = 0;
152
153
210
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
210
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
210
                    const auto* to_decimal_type =
157
210
                            check_and_get_data_type<ToDataType>(to_type.get());
158
210
                    to_precision = to_decimal_type->get_precision();
159
210
                    ToDataType::check_type_precision(to_precision);
160
161
210
                    to_scale = to_decimal_type->get_scale();
162
210
                    ToDataType::check_type_scale(to_scale);
163
210
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
210
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
210
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
210
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
210
                if (to_scale > from_scale) {
174
177
                    multiply_may_overflow &=
175
177
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
177
                }
177
210
                return narrow_integral || multiply_may_overflow;
178
210
            }
179
0
            return false;
180
210
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_28EEESE_EEEEbSI_
Line
Count
Source
127
1.11k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
1.11k
            using Types2 = std::decay_t<decltype(types2)>;
129
1.11k
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
1.11k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
1.11k
                using FromFieldType = typename FromDataType::FieldType;
137
1.11k
                using ToFieldType = typename ToDataType::FieldType;
138
1.11k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
1.11k
                UInt32 from_scale = 0;
140
141
1.11k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
1.11k
                    const auto* from_decimal_type =
143
1.11k
                            check_and_get_data_type<FromDataType>(from_type.get());
144
1.11k
                    from_precision =
145
1.11k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
1.11k
                    from_scale = from_decimal_type->get_scale();
147
1.11k
                }
148
149
1.11k
                UInt32 to_max_digits = 0;
150
1.11k
                UInt32 to_precision = 0;
151
1.11k
                UInt32 to_scale = 0;
152
153
1.11k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
1.11k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
1.11k
                    const auto* to_decimal_type =
157
1.11k
                            check_and_get_data_type<ToDataType>(to_type.get());
158
1.11k
                    to_precision = to_decimal_type->get_precision();
159
1.11k
                    ToDataType::check_type_precision(to_precision);
160
161
1.11k
                    to_scale = to_decimal_type->get_scale();
162
1.11k
                    ToDataType::check_type_scale(to_scale);
163
1.11k
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
1.11k
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
1.11k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
1.11k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
1.11k
                if (to_scale > from_scale) {
174
771
                    multiply_may_overflow &=
175
771
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
771
                }
177
1.11k
                return narrow_integral || multiply_may_overflow;
178
1.11k
            }
179
0
            return false;
180
1.11k
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_ISE_SE_EEEEbSI_
Line
Count
Source
127
4.59k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
4.59k
            using Types2 = std::decay_t<decltype(types2)>;
129
4.59k
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
4.59k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
4.59k
                using FromFieldType = typename FromDataType::FieldType;
137
4.59k
                using ToFieldType = typename ToDataType::FieldType;
138
4.59k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
4.59k
                UInt32 from_scale = 0;
140
141
4.59k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
4.59k
                    const auto* from_decimal_type =
143
4.59k
                            check_and_get_data_type<FromDataType>(from_type.get());
144
4.59k
                    from_precision =
145
4.59k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
4.59k
                    from_scale = from_decimal_type->get_scale();
147
4.59k
                }
148
149
4.59k
                UInt32 to_max_digits = 0;
150
4.59k
                UInt32 to_precision = 0;
151
4.59k
                UInt32 to_scale = 0;
152
153
4.59k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
4.59k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
4.59k
                    const auto* to_decimal_type =
157
4.59k
                            check_and_get_data_type<ToDataType>(to_type.get());
158
4.59k
                    to_precision = to_decimal_type->get_precision();
159
4.59k
                    ToDataType::check_type_precision(to_precision);
160
161
4.59k
                    to_scale = to_decimal_type->get_scale();
162
4.59k
                    ToDataType::check_type_scale(to_scale);
163
4.59k
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
4.59k
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
4.59k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
4.59k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
4.59k
                if (to_scale > from_scale) {
174
157
                    multiply_may_overflow &=
175
157
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
157
                }
177
4.59k
                return narrow_integral || multiply_may_overflow;
178
4.59k
            }
179
0
            return false;
180
4.59k
        });
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
127
216
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
216
            using Types2 = std::decay_t<decltype(types2)>;
129
216
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
216
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
216
                using FromFieldType = typename FromDataType::FieldType;
137
216
                using ToFieldType = typename ToDataType::FieldType;
138
216
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
216
                UInt32 from_scale = 0;
140
141
216
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
216
                    const auto* from_decimal_type =
143
216
                            check_and_get_data_type<FromDataType>(from_type.get());
144
216
                    from_precision =
145
216
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
216
                    from_scale = from_decimal_type->get_scale();
147
216
                }
148
149
216
                UInt32 to_max_digits = 0;
150
216
                UInt32 to_precision = 0;
151
216
                UInt32 to_scale = 0;
152
153
216
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
216
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
216
                    const auto* to_decimal_type =
157
216
                            check_and_get_data_type<ToDataType>(to_type.get());
158
216
                    to_precision = to_decimal_type->get_precision();
159
216
                    ToDataType::check_type_precision(to_precision);
160
161
216
                    to_scale = to_decimal_type->get_scale();
162
216
                    ToDataType::check_type_scale(to_scale);
163
216
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
216
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
216
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
216
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
216
                if (to_scale > from_scale) {
174
50
                    multiply_may_overflow &=
175
50
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
50
                }
177
216
                return narrow_integral || multiply_may_overflow;
178
216
            }
179
0
            return false;
180
216
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_30EEESE_EEEEbSI_
Line
Count
Source
127
429
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
429
            using Types2 = std::decay_t<decltype(types2)>;
129
429
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
429
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
429
                using FromFieldType = typename FromDataType::FieldType;
137
429
                using ToFieldType = typename ToDataType::FieldType;
138
429
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
429
                UInt32 from_scale = 0;
140
141
429
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
429
                    const auto* from_decimal_type =
143
429
                            check_and_get_data_type<FromDataType>(from_type.get());
144
429
                    from_precision =
145
429
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
429
                    from_scale = from_decimal_type->get_scale();
147
429
                }
148
149
429
                UInt32 to_max_digits = 0;
150
429
                UInt32 to_precision = 0;
151
429
                UInt32 to_scale = 0;
152
153
429
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
429
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
429
                    const auto* to_decimal_type =
157
429
                            check_and_get_data_type<ToDataType>(to_type.get());
158
429
                    to_precision = to_decimal_type->get_precision();
159
429
                    ToDataType::check_type_precision(to_precision);
160
161
429
                    to_scale = to_decimal_type->get_scale();
162
429
                    ToDataType::check_type_scale(to_scale);
163
429
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
429
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
429
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
429
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
429
                if (to_scale > from_scale) {
174
145
                    multiply_may_overflow &=
175
145
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
145
                }
177
429
                return narrow_integral || multiply_may_overflow;
178
429
            }
179
0
            return false;
180
429
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_35EEESE_EEEEbSI_
Line
Count
Source
127
401
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
401
            using Types2 = std::decay_t<decltype(types2)>;
129
401
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
401
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
401
                using FromFieldType = typename FromDataType::FieldType;
137
401
                using ToFieldType = typename ToDataType::FieldType;
138
401
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
401
                UInt32 from_scale = 0;
140
141
401
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
401
                    const auto* from_decimal_type =
143
401
                            check_and_get_data_type<FromDataType>(from_type.get());
144
401
                    from_precision =
145
401
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
401
                    from_scale = from_decimal_type->get_scale();
147
401
                }
148
149
401
                UInt32 to_max_digits = 0;
150
401
                UInt32 to_precision = 0;
151
401
                UInt32 to_scale = 0;
152
153
401
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
401
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
401
                    const auto* to_decimal_type =
157
401
                            check_and_get_data_type<ToDataType>(to_type.get());
158
401
                    to_precision = to_decimal_type->get_precision();
159
401
                    ToDataType::check_type_precision(to_precision);
160
161
401
                    to_scale = to_decimal_type->get_scale();
162
401
                    ToDataType::check_type_scale(to_scale);
163
401
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
401
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
401
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
401
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
401
                if (to_scale > from_scale) {
174
137
                    multiply_may_overflow &=
175
137
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
137
                }
177
401
                return narrow_integral || multiply_may_overflow;
178
401
            }
179
0
            return false;
180
401
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeDateESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeDateV2ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_18DataTypeDateTimeV2ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_16DataTypeDateTimeESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeTimeV2ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_19DataTypeTimeStampTzESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeIPv4ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeIPv6ESE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeStringESE_EEEEbSI_
Line
Count
Source
127
7.88k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
7.88k
            using Types2 = std::decay_t<decltype(types2)>;
129
7.88k
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
7.88k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
7.88k
                return false;
134
7.88k
            }
135
7.88k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
7.88k
                using FromFieldType = typename FromDataType::FieldType;
137
7.88k
                using ToFieldType = typename ToDataType::FieldType;
138
7.88k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
7.88k
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
7.88k
                UInt32 to_max_digits = 0;
150
7.88k
                UInt32 to_precision = 0;
151
7.88k
                UInt32 to_scale = 0;
152
153
7.88k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
7.88k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
7.88k
                    const auto* to_decimal_type =
157
7.88k
                            check_and_get_data_type<ToDataType>(to_type.get());
158
7.88k
                    to_precision = to_decimal_type->get_precision();
159
7.88k
                    ToDataType::check_type_precision(to_precision);
160
161
7.88k
                    to_scale = to_decimal_type->get_scale();
162
7.88k
                    ToDataType::check_type_scale(to_scale);
163
7.88k
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
7.88k
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
7.88k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
7.88k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
7.88k
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
7.88k
                return narrow_integral || multiply_may_overflow;
178
7.88k
            }
179
0
            return false;
180
7.88k
        });
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
127
20
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
20
            using Types2 = std::decay_t<decltype(types2)>;
129
20
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
20
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
20
                using FromFieldType = typename FromDataType::FieldType;
137
20
                using ToFieldType = typename ToDataType::FieldType;
138
20
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
20
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
20
                UInt32 to_max_digits = 0;
150
20
                UInt32 to_precision = 0;
151
20
                UInt32 to_scale = 0;
152
153
20
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
20
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
20
                    const auto* to_decimal_type =
157
20
                            check_and_get_data_type<ToDataType>(to_type.get());
158
20
                    to_precision = to_decimal_type->get_precision();
159
20
                    ToDataType::check_type_precision(to_precision);
160
161
20
                    to_scale = to_decimal_type->get_scale();
162
20
                    ToDataType::check_type_scale(to_scale);
163
20
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
20
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
20
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
20
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
20
                if (to_scale > from_scale) {
174
20
                    multiply_may_overflow &=
175
20
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
20
                }
177
20
                return narrow_integral || multiply_may_overflow;
178
20
            }
179
0
            return false;
180
20
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_3EEESE_EEEEbSI_
Line
Count
Source
127
16
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
16
            using Types2 = std::decay_t<decltype(types2)>;
129
16
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
16
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
16
                using FromFieldType = typename FromDataType::FieldType;
137
16
                using ToFieldType = typename ToDataType::FieldType;
138
16
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
16
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
16
                UInt32 to_max_digits = 0;
150
16
                UInt32 to_precision = 0;
151
16
                UInt32 to_scale = 0;
152
153
16
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
16
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
16
                    const auto* to_decimal_type =
157
16
                            check_and_get_data_type<ToDataType>(to_type.get());
158
16
                    to_precision = to_decimal_type->get_precision();
159
16
                    ToDataType::check_type_precision(to_precision);
160
161
16
                    to_scale = to_decimal_type->get_scale();
162
16
                    ToDataType::check_type_scale(to_scale);
163
16
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
16
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
16
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
16
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
16
                if (to_scale > from_scale) {
174
16
                    multiply_may_overflow &=
175
16
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
16
                }
177
16
                return narrow_integral || multiply_may_overflow;
178
16
            }
179
0
            return false;
180
16
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_4EEESE_EEEEbSI_
Line
Count
Source
127
16
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
16
            using Types2 = std::decay_t<decltype(types2)>;
129
16
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
16
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
16
                using FromFieldType = typename FromDataType::FieldType;
137
16
                using ToFieldType = typename ToDataType::FieldType;
138
16
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
16
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
16
                UInt32 to_max_digits = 0;
150
16
                UInt32 to_precision = 0;
151
16
                UInt32 to_scale = 0;
152
153
16
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
16
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
16
                    const auto* to_decimal_type =
157
16
                            check_and_get_data_type<ToDataType>(to_type.get());
158
16
                    to_precision = to_decimal_type->get_precision();
159
16
                    ToDataType::check_type_precision(to_precision);
160
161
16
                    to_scale = to_decimal_type->get_scale();
162
16
                    ToDataType::check_type_scale(to_scale);
163
16
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
16
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
16
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
16
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
16
                if (to_scale > from_scale) {
174
16
                    multiply_may_overflow &=
175
16
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
16
                }
177
16
                return narrow_integral || multiply_may_overflow;
178
16
            }
179
0
            return false;
180
16
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_5EEESE_EEEEbSI_
Line
Count
Source
127
14
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
14
            using Types2 = std::decay_t<decltype(types2)>;
129
14
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
14
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
14
                using FromFieldType = typename FromDataType::FieldType;
137
14
                using ToFieldType = typename ToDataType::FieldType;
138
14
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
14
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
14
                UInt32 to_max_digits = 0;
150
14
                UInt32 to_precision = 0;
151
14
                UInt32 to_scale = 0;
152
153
14
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
14
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
14
                    const auto* to_decimal_type =
157
14
                            check_and_get_data_type<ToDataType>(to_type.get());
158
14
                    to_precision = to_decimal_type->get_precision();
159
14
                    ToDataType::check_type_precision(to_precision);
160
161
14
                    to_scale = to_decimal_type->get_scale();
162
14
                    ToDataType::check_type_scale(to_scale);
163
14
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
14
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
16
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
14
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
16
                if (to_scale > from_scale) {
174
16
                    multiply_may_overflow &=
175
16
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
16
                }
177
16
                return narrow_integral || multiply_may_overflow;
178
14
            }
179
0
            return false;
180
14
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_6EEESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_7EEESE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_8EEESE_EEEEbSI_
Line
Count
Source
127
32
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
32
            using Types2 = std::decay_t<decltype(types2)>;
129
32
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
32
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
32
                using FromFieldType = typename FromDataType::FieldType;
137
32
                using ToFieldType = typename ToDataType::FieldType;
138
32
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
32
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
32
                UInt32 to_max_digits = 0;
150
32
                UInt32 to_precision = 0;
151
32
                UInt32 to_scale = 0;
152
153
32
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
32
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
32
                    const auto* to_decimal_type =
157
32
                            check_and_get_data_type<ToDataType>(to_type.get());
158
32
                    to_precision = to_decimal_type->get_precision();
159
32
                    ToDataType::check_type_precision(to_precision);
160
161
32
                    to_scale = to_decimal_type->get_scale();
162
32
                    ToDataType::check_type_scale(to_scale);
163
32
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
32
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
32
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
32
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
32
                if (to_scale > from_scale) {
174
32
                    multiply_may_overflow &=
175
32
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
32
                }
177
32
                return narrow_integral || multiply_may_overflow;
178
32
            }
179
0
            return false;
180
32
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_9EEESE_EEEEbSI_
Line
Count
Source
127
128
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
128
            using Types2 = std::decay_t<decltype(types2)>;
129
128
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
128
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
128
                using FromFieldType = typename FromDataType::FieldType;
137
128
                using ToFieldType = typename ToDataType::FieldType;
138
128
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
128
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
128
                UInt32 to_max_digits = 0;
150
128
                UInt32 to_precision = 0;
151
128
                UInt32 to_scale = 0;
152
153
128
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
128
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
128
                    const auto* to_decimal_type =
157
128
                            check_and_get_data_type<ToDataType>(to_type.get());
158
128
                    to_precision = to_decimal_type->get_precision();
159
128
                    ToDataType::check_type_precision(to_precision);
160
161
128
                    to_scale = to_decimal_type->get_scale();
162
128
                    ToDataType::check_type_scale(to_scale);
163
128
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
128
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
128
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
128
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
128
                if (to_scale > from_scale) {
174
128
                    multiply_may_overflow &=
175
128
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
128
                }
177
128
                return narrow_integral || multiply_may_overflow;
178
128
            }
179
0
            return false;
180
128
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_28EEESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_29EEESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_ISE_SE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_30EEESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_35EEESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeDateESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeDateV2ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_18DataTypeDateTimeV2ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_16DataTypeDateTimeESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeTimeV2ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_19DataTypeTimeStampTzESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeIPv4ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeIPv6ESE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeStringESE_EEEEbSI_
Line
Count
Source
127
1
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
1
            using Types2 = std::decay_t<decltype(types2)>;
129
1
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
1
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
1
                return false;
134
1
            }
135
1
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
1
                using FromFieldType = typename FromDataType::FieldType;
137
1
                using ToFieldType = typename ToDataType::FieldType;
138
1
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
1
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
1
                UInt32 to_max_digits = 0;
150
1
                UInt32 to_precision = 0;
151
1
                UInt32 to_scale = 0;
152
153
1
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
1
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
1
                    const auto* to_decimal_type =
157
1
                            check_and_get_data_type<ToDataType>(to_type.get());
158
1
                    to_precision = to_decimal_type->get_precision();
159
1
                    ToDataType::check_type_precision(to_precision);
160
161
1
                    to_scale = to_decimal_type->get_scale();
162
1
                    ToDataType::check_type_scale(to_scale);
163
1
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
1
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
1
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
1
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
1
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
1
                return narrow_integral || multiply_may_overflow;
178
1
            }
179
0
            return false;
180
1
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_2EEESE_EEEEbSI_
Line
Count
Source
127
23
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
23
            using Types2 = std::decay_t<decltype(types2)>;
129
23
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
23
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
23
                using FromFieldType = typename FromDataType::FieldType;
137
23
                using ToFieldType = typename ToDataType::FieldType;
138
23
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
23
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
23
                UInt32 to_max_digits = 0;
150
23
                UInt32 to_precision = 0;
151
23
                UInt32 to_scale = 0;
152
153
23
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
23
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
23
                    const auto* to_decimal_type =
157
23
                            check_and_get_data_type<ToDataType>(to_type.get());
158
23
                    to_precision = to_decimal_type->get_precision();
159
23
                    ToDataType::check_type_precision(to_precision);
160
161
23
                    to_scale = to_decimal_type->get_scale();
162
23
                    ToDataType::check_type_scale(to_scale);
163
23
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
23
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
23
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
23
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
23
                if (to_scale > from_scale) {
174
22
                    multiply_may_overflow &=
175
22
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
22
                }
177
23
                return narrow_integral || multiply_may_overflow;
178
23
            }
179
0
            return false;
180
23
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_3EEESE_EEEEbSI_
Line
Count
Source
127
179
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
179
            using Types2 = std::decay_t<decltype(types2)>;
129
179
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
179
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
179
                using FromFieldType = typename FromDataType::FieldType;
137
179
                using ToFieldType = typename ToDataType::FieldType;
138
179
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
179
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
179
                UInt32 to_max_digits = 0;
150
179
                UInt32 to_precision = 0;
151
179
                UInt32 to_scale = 0;
152
153
179
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
179
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
179
                    const auto* to_decimal_type =
157
179
                            check_and_get_data_type<ToDataType>(to_type.get());
158
179
                    to_precision = to_decimal_type->get_precision();
159
179
                    ToDataType::check_type_precision(to_precision);
160
161
179
                    to_scale = to_decimal_type->get_scale();
162
179
                    ToDataType::check_type_scale(to_scale);
163
179
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
179
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
179
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
179
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
179
                if (to_scale > from_scale) {
174
128
                    multiply_may_overflow &=
175
128
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
128
                }
177
179
                return narrow_integral || multiply_may_overflow;
178
179
            }
179
0
            return false;
180
179
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_4EEESE_EEEEbSI_
Line
Count
Source
127
166
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
166
            using Types2 = std::decay_t<decltype(types2)>;
129
166
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
166
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
166
                using FromFieldType = typename FromDataType::FieldType;
137
166
                using ToFieldType = typename ToDataType::FieldType;
138
166
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
166
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
166
                UInt32 to_max_digits = 0;
150
166
                UInt32 to_precision = 0;
151
166
                UInt32 to_scale = 0;
152
153
166
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
166
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
166
                    const auto* to_decimal_type =
157
166
                            check_and_get_data_type<ToDataType>(to_type.get());
158
166
                    to_precision = to_decimal_type->get_precision();
159
166
                    ToDataType::check_type_precision(to_precision);
160
161
166
                    to_scale = to_decimal_type->get_scale();
162
166
                    ToDataType::check_type_scale(to_scale);
163
166
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
166
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
166
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
166
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
166
                if (to_scale > from_scale) {
174
115
                    multiply_may_overflow &=
175
115
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
115
                }
177
166
                return narrow_integral || multiply_may_overflow;
178
166
            }
179
0
            return false;
180
166
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_5EEESE_EEEEbSI_
Line
Count
Source
127
456
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
456
            using Types2 = std::decay_t<decltype(types2)>;
129
456
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
456
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
456
                using FromFieldType = typename FromDataType::FieldType;
137
456
                using ToFieldType = typename ToDataType::FieldType;
138
456
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
456
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
456
                UInt32 to_max_digits = 0;
150
456
                UInt32 to_precision = 0;
151
456
                UInt32 to_scale = 0;
152
153
456
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
456
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
456
                    const auto* to_decimal_type =
157
456
                            check_and_get_data_type<ToDataType>(to_type.get());
158
456
                    to_precision = to_decimal_type->get_precision();
159
456
                    ToDataType::check_type_precision(to_precision);
160
161
456
                    to_scale = to_decimal_type->get_scale();
162
456
                    ToDataType::check_type_scale(to_scale);
163
456
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
456
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
456
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
456
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
456
                if (to_scale > from_scale) {
174
400
                    multiply_may_overflow &=
175
400
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
400
                }
177
456
                return narrow_integral || multiply_may_overflow;
178
456
            }
179
0
            return false;
180
456
        });
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
127
2.48k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
2.48k
            using Types2 = std::decay_t<decltype(types2)>;
129
2.48k
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
2.48k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
2.48k
                using FromFieldType = typename FromDataType::FieldType;
137
2.48k
                using ToFieldType = typename ToDataType::FieldType;
138
2.48k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
2.48k
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
2.48k
                UInt32 to_max_digits = 0;
150
2.48k
                UInt32 to_precision = 0;
151
2.48k
                UInt32 to_scale = 0;
152
153
2.48k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
2.48k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
2.48k
                    const auto* to_decimal_type =
157
2.48k
                            check_and_get_data_type<ToDataType>(to_type.get());
158
2.48k
                    to_precision = to_decimal_type->get_precision();
159
2.48k
                    ToDataType::check_type_precision(to_precision);
160
161
2.48k
                    to_scale = to_decimal_type->get_scale();
162
2.48k
                    ToDataType::check_type_scale(to_scale);
163
2.48k
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
2.48k
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
2.48k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
2.48k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
2.48k
                if (to_scale > from_scale) {
174
656
                    multiply_may_overflow &=
175
656
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
656
                }
177
2.48k
                return narrow_integral || multiply_may_overflow;
178
2.48k
            }
179
0
            return false;
180
2.48k
        });
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
127
363
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
363
            using Types2 = std::decay_t<decltype(types2)>;
129
363
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
363
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
363
                using FromFieldType = typename FromDataType::FieldType;
137
363
                using ToFieldType = typename ToDataType::FieldType;
138
363
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
363
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
363
                UInt32 to_max_digits = 0;
150
363
                UInt32 to_precision = 0;
151
363
                UInt32 to_scale = 0;
152
153
363
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
363
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
363
                    const auto* to_decimal_type =
157
363
                            check_and_get_data_type<ToDataType>(to_type.get());
158
363
                    to_precision = to_decimal_type->get_precision();
159
363
                    ToDataType::check_type_precision(to_precision);
160
161
363
                    to_scale = to_decimal_type->get_scale();
162
363
                    ToDataType::check_type_scale(to_scale);
163
363
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
363
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
363
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
363
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
363
                if (to_scale > from_scale) {
174
196
                    multiply_may_overflow &=
175
196
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
196
                }
177
363
                return narrow_integral || multiply_may_overflow;
178
363
            }
179
0
            return false;
180
363
        });
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
127
248
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
248
            using Types2 = std::decay_t<decltype(types2)>;
129
248
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
248
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
248
                using FromFieldType = typename FromDataType::FieldType;
137
248
                using ToFieldType = typename ToDataType::FieldType;
138
248
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
248
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
248
                UInt32 to_max_digits = 0;
150
248
                UInt32 to_precision = 0;
151
248
                UInt32 to_scale = 0;
152
153
248
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
248
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
248
                    const auto* to_decimal_type =
157
248
                            check_and_get_data_type<ToDataType>(to_type.get());
158
248
                    to_precision = to_decimal_type->get_precision();
159
248
                    ToDataType::check_type_precision(to_precision);
160
161
248
                    to_scale = to_decimal_type->get_scale();
162
248
                    ToDataType::check_type_scale(to_scale);
163
248
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
248
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
248
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
248
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
248
                if (to_scale > from_scale) {
174
130
                    multiply_may_overflow &=
175
130
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
130
                }
177
248
                return narrow_integral || multiply_may_overflow;
178
248
            }
179
0
            return false;
180
248
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_9EEESE_EEEEbSI_
Line
Count
Source
127
489
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
489
            using Types2 = std::decay_t<decltype(types2)>;
129
489
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
489
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
489
                using FromFieldType = typename FromDataType::FieldType;
137
489
                using ToFieldType = typename ToDataType::FieldType;
138
489
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
489
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
489
                UInt32 to_max_digits = 0;
150
489
                UInt32 to_precision = 0;
151
489
                UInt32 to_scale = 0;
152
153
489
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
489
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
489
                    const auto* to_decimal_type =
157
489
                            check_and_get_data_type<ToDataType>(to_type.get());
158
489
                    to_precision = to_decimal_type->get_precision();
159
489
                    ToDataType::check_type_precision(to_precision);
160
161
489
                    to_scale = to_decimal_type->get_scale();
162
489
                    ToDataType::check_type_scale(to_scale);
163
489
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
489
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
489
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
489
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
489
                if (to_scale > from_scale) {
174
379
                    multiply_may_overflow &=
175
379
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
379
                }
177
489
                return narrow_integral || multiply_may_overflow;
178
489
            }
179
0
            return false;
180
489
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_28EEESE_EEEEbSI_
Line
Count
Source
127
759
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
759
            using Types2 = std::decay_t<decltype(types2)>;
129
759
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
759
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
759
                using FromFieldType = typename FromDataType::FieldType;
137
759
                using ToFieldType = typename ToDataType::FieldType;
138
759
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
759
                UInt32 from_scale = 0;
140
141
759
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
759
                    const auto* from_decimal_type =
143
759
                            check_and_get_data_type<FromDataType>(from_type.get());
144
759
                    from_precision =
145
759
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
759
                    from_scale = from_decimal_type->get_scale();
147
759
                }
148
149
759
                UInt32 to_max_digits = 0;
150
759
                UInt32 to_precision = 0;
151
759
                UInt32 to_scale = 0;
152
153
759
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
759
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
759
                    const auto* to_decimal_type =
157
759
                            check_and_get_data_type<ToDataType>(to_type.get());
158
759
                    to_precision = to_decimal_type->get_precision();
159
759
                    ToDataType::check_type_precision(to_precision);
160
161
759
                    to_scale = to_decimal_type->get_scale();
162
759
                    ToDataType::check_type_scale(to_scale);
163
759
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
759
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
759
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
759
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
759
                if (to_scale > from_scale) {
174
606
                    multiply_may_overflow &=
175
606
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
606
                }
177
759
                return narrow_integral || multiply_may_overflow;
178
759
            }
179
0
            return false;
180
759
        });
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
127
1.05k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
1.05k
            using Types2 = std::decay_t<decltype(types2)>;
129
1.05k
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
1.05k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
1.05k
                using FromFieldType = typename FromDataType::FieldType;
137
1.05k
                using ToFieldType = typename ToDataType::FieldType;
138
1.05k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
1.05k
                UInt32 from_scale = 0;
140
141
1.05k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
1.05k
                    const auto* from_decimal_type =
143
1.05k
                            check_and_get_data_type<FromDataType>(from_type.get());
144
1.05k
                    from_precision =
145
1.05k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
1.05k
                    from_scale = from_decimal_type->get_scale();
147
1.05k
                }
148
149
1.05k
                UInt32 to_max_digits = 0;
150
1.05k
                UInt32 to_precision = 0;
151
1.05k
                UInt32 to_scale = 0;
152
153
1.05k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
1.05k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
1.05k
                    const auto* to_decimal_type =
157
1.05k
                            check_and_get_data_type<ToDataType>(to_type.get());
158
1.05k
                    to_precision = to_decimal_type->get_precision();
159
1.05k
                    ToDataType::check_type_precision(to_precision);
160
161
1.05k
                    to_scale = to_decimal_type->get_scale();
162
1.05k
                    ToDataType::check_type_scale(to_scale);
163
1.05k
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
1.05k
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
1.05k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
1.05k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
1.05k
                if (to_scale > from_scale) {
174
719
                    multiply_may_overflow &=
175
719
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
719
                }
177
1.05k
                return narrow_integral || multiply_may_overflow;
178
1.05k
            }
179
0
            return false;
180
1.05k
        });
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
127
257
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
257
            using Types2 = std::decay_t<decltype(types2)>;
129
257
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
257
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
257
                using FromFieldType = typename FromDataType::FieldType;
137
257
                using ToFieldType = typename ToDataType::FieldType;
138
257
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
257
                UInt32 from_scale = 0;
140
141
257
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
257
                    const auto* from_decimal_type =
143
257
                            check_and_get_data_type<FromDataType>(from_type.get());
144
257
                    from_precision =
145
257
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
257
                    from_scale = from_decimal_type->get_scale();
147
257
                }
148
149
257
                UInt32 to_max_digits = 0;
150
257
                UInt32 to_precision = 0;
151
257
                UInt32 to_scale = 0;
152
153
257
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
257
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
257
                    const auto* to_decimal_type =
157
257
                            check_and_get_data_type<ToDataType>(to_type.get());
158
257
                    to_precision = to_decimal_type->get_precision();
159
257
                    ToDataType::check_type_precision(to_precision);
160
161
257
                    to_scale = to_decimal_type->get_scale();
162
257
                    ToDataType::check_type_scale(to_scale);
163
257
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
257
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
257
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
257
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
257
                if (to_scale > from_scale) {
174
71
                    multiply_may_overflow &=
175
71
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
71
                }
177
257
                return narrow_integral || multiply_may_overflow;
178
257
            }
179
0
            return false;
180
257
        });
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
127
3.02k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
3.02k
            using Types2 = std::decay_t<decltype(types2)>;
129
3.02k
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
3.02k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
3.02k
                using FromFieldType = typename FromDataType::FieldType;
137
3.02k
                using ToFieldType = typename ToDataType::FieldType;
138
3.02k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
3.02k
                UInt32 from_scale = 0;
140
141
3.02k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
3.02k
                    const auto* from_decimal_type =
143
3.02k
                            check_and_get_data_type<FromDataType>(from_type.get());
144
3.02k
                    from_precision =
145
3.02k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
3.02k
                    from_scale = from_decimal_type->get_scale();
147
3.02k
                }
148
149
3.02k
                UInt32 to_max_digits = 0;
150
3.02k
                UInt32 to_precision = 0;
151
3.02k
                UInt32 to_scale = 0;
152
153
3.02k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
3.02k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
3.02k
                    const auto* to_decimal_type =
157
3.02k
                            check_and_get_data_type<ToDataType>(to_type.get());
158
3.02k
                    to_precision = to_decimal_type->get_precision();
159
3.02k
                    ToDataType::check_type_precision(to_precision);
160
161
3.02k
                    to_scale = to_decimal_type->get_scale();
162
3.02k
                    ToDataType::check_type_scale(to_scale);
163
3.02k
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
3.02k
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
3.02k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
3.02k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
3.02k
                if (to_scale > from_scale) {
174
740
                    multiply_may_overflow &=
175
740
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
740
                }
177
3.02k
                return narrow_integral || multiply_may_overflow;
178
3.02k
            }
179
0
            return false;
180
3.02k
        });
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
127
948
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
948
            using Types2 = std::decay_t<decltype(types2)>;
129
948
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
948
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
948
                using FromFieldType = typename FromDataType::FieldType;
137
948
                using ToFieldType = typename ToDataType::FieldType;
138
948
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
948
                UInt32 from_scale = 0;
140
141
948
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
948
                    const auto* from_decimal_type =
143
948
                            check_and_get_data_type<FromDataType>(from_type.get());
144
948
                    from_precision =
145
948
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
948
                    from_scale = from_decimal_type->get_scale();
147
948
                }
148
149
948
                UInt32 to_max_digits = 0;
150
948
                UInt32 to_precision = 0;
151
948
                UInt32 to_scale = 0;
152
153
948
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
948
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
948
                    const auto* to_decimal_type =
157
948
                            check_and_get_data_type<ToDataType>(to_type.get());
158
948
                    to_precision = to_decimal_type->get_precision();
159
948
                    ToDataType::check_type_precision(to_precision);
160
161
948
                    to_scale = to_decimal_type->get_scale();
162
948
                    ToDataType::check_type_scale(to_scale);
163
948
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
948
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
948
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
948
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
948
                if (to_scale > from_scale) {
174
394
                    multiply_may_overflow &=
175
394
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
394
                }
177
948
                return narrow_integral || multiply_may_overflow;
178
948
            }
179
0
            return false;
180
948
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeDateESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeDateV2ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_18DataTypeDateTimeV2ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_16DataTypeDateTimeESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeTimeV2ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_19DataTypeTimeStampTzESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeIPv4ESE_EEEEbSI_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_12DataTypeIPv6ESE_EEEEbSI_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeStringESE_EEEEbSI_
Line
Count
Source
127
5.20k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
5.20k
            using Types2 = std::decay_t<decltype(types2)>;
129
5.20k
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
5.20k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
5.20k
                return false;
134
5.20k
            }
135
5.20k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
5.20k
                using FromFieldType = typename FromDataType::FieldType;
137
5.20k
                using ToFieldType = typename ToDataType::FieldType;
138
5.20k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
5.20k
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
5.20k
                UInt32 to_max_digits = 0;
150
5.20k
                UInt32 to_precision = 0;
151
5.20k
                UInt32 to_scale = 0;
152
153
5.20k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
5.20k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
5.20k
                    const auto* to_decimal_type =
157
5.20k
                            check_and_get_data_type<ToDataType>(to_type.get());
158
5.20k
                    to_precision = to_decimal_type->get_precision();
159
5.20k
                    ToDataType::check_type_precision(to_precision);
160
161
5.20k
                    to_scale = to_decimal_type->get_scale();
162
5.20k
                    ToDataType::check_type_scale(to_scale);
163
5.20k
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
5.20k
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
5.20k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
5.20k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
5.20k
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
5.20k
                return narrow_integral || multiply_may_overflow;
178
5.20k
            }
179
0
            return false;
180
5.20k
        });
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
127
7
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
7
            using Types2 = std::decay_t<decltype(types2)>;
129
7
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
7
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
7
                using FromFieldType = typename FromDataType::FieldType;
137
7
                using ToFieldType = typename ToDataType::FieldType;
138
7
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
7
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
7
                UInt32 to_max_digits = 0;
150
7
                UInt32 to_precision = 0;
151
7
                UInt32 to_scale = 0;
152
153
7
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
7
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
7
                    const auto* to_decimal_type =
157
7
                            check_and_get_data_type<ToDataType>(to_type.get());
158
7
                    to_precision = to_decimal_type->get_precision();
159
7
                    ToDataType::check_type_precision(to_precision);
160
161
7
                    to_scale = to_decimal_type->get_scale();
162
7
                    ToDataType::check_type_scale(to_scale);
163
7
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
7
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
7
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
7
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
7
                if (to_scale > from_scale) {
174
6
                    multiply_may_overflow &=
175
6
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
6
                }
177
7
                return narrow_integral || multiply_may_overflow;
178
7
            }
179
0
            return false;
180
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
127
160
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
160
            using Types2 = std::decay_t<decltype(types2)>;
129
160
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
160
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
160
                using FromFieldType = typename FromDataType::FieldType;
137
160
                using ToFieldType = typename ToDataType::FieldType;
138
160
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
160
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
160
                UInt32 to_max_digits = 0;
150
160
                UInt32 to_precision = 0;
151
160
                UInt32 to_scale = 0;
152
153
160
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
160
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
160
                    const auto* to_decimal_type =
157
160
                            check_and_get_data_type<ToDataType>(to_type.get());
158
160
                    to_precision = to_decimal_type->get_precision();
159
160
                    ToDataType::check_type_precision(to_precision);
160
161
160
                    to_scale = to_decimal_type->get_scale();
162
160
                    ToDataType::check_type_scale(to_scale);
163
160
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
160
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
160
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
160
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
160
                if (to_scale > from_scale) {
174
109
                    multiply_may_overflow &=
175
109
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
109
                }
177
160
                return narrow_integral || multiply_may_overflow;
178
160
            }
179
0
            return false;
180
160
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_4EEESE_EEEEbSI_
Line
Count
Source
127
158
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
158
            using Types2 = std::decay_t<decltype(types2)>;
129
158
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
158
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
158
                using FromFieldType = typename FromDataType::FieldType;
137
158
                using ToFieldType = typename ToDataType::FieldType;
138
158
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
158
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
158
                UInt32 to_max_digits = 0;
150
158
                UInt32 to_precision = 0;
151
158
                UInt32 to_scale = 0;
152
153
158
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
158
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
158
                    const auto* to_decimal_type =
157
158
                            check_and_get_data_type<ToDataType>(to_type.get());
158
158
                    to_precision = to_decimal_type->get_precision();
159
158
                    ToDataType::check_type_precision(to_precision);
160
161
158
                    to_scale = to_decimal_type->get_scale();
162
158
                    ToDataType::check_type_scale(to_scale);
163
158
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
158
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
158
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
158
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
158
                if (to_scale > from_scale) {
174
107
                    multiply_may_overflow &=
175
107
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
107
                }
177
158
                return narrow_integral || multiply_may_overflow;
178
158
            }
179
0
            return false;
180
158
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_5EEESE_EEEEbSI_
Line
Count
Source
127
176
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
176
            using Types2 = std::decay_t<decltype(types2)>;
129
176
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
176
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
176
                using FromFieldType = typename FromDataType::FieldType;
137
176
                using ToFieldType = typename ToDataType::FieldType;
138
176
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
176
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
176
                UInt32 to_max_digits = 0;
150
176
                UInt32 to_precision = 0;
151
176
                UInt32 to_scale = 0;
152
153
176
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
176
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
176
                    const auto* to_decimal_type =
157
176
                            check_and_get_data_type<ToDataType>(to_type.get());
158
176
                    to_precision = to_decimal_type->get_precision();
159
176
                    ToDataType::check_type_precision(to_precision);
160
161
176
                    to_scale = to_decimal_type->get_scale();
162
176
                    ToDataType::check_type_scale(to_scale);
163
176
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
176
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
176
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
176
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
176
                if (to_scale > from_scale) {
174
120
                    multiply_may_overflow &=
175
120
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
120
                }
177
176
                return narrow_integral || multiply_may_overflow;
178
176
            }
179
0
            return false;
180
176
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_6EEESE_EEEEbSI_
Line
Count
Source
127
158
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
158
            using Types2 = std::decay_t<decltype(types2)>;
129
158
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
158
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
158
                using FromFieldType = typename FromDataType::FieldType;
137
158
                using ToFieldType = typename ToDataType::FieldType;
138
158
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
158
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
158
                UInt32 to_max_digits = 0;
150
158
                UInt32 to_precision = 0;
151
158
                UInt32 to_scale = 0;
152
153
158
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
158
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
158
                    const auto* to_decimal_type =
157
158
                            check_and_get_data_type<ToDataType>(to_type.get());
158
158
                    to_precision = to_decimal_type->get_precision();
159
158
                    ToDataType::check_type_precision(to_precision);
160
161
158
                    to_scale = to_decimal_type->get_scale();
162
158
                    ToDataType::check_type_scale(to_scale);
163
158
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
158
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
158
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
158
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
158
                if (to_scale > from_scale) {
174
107
                    multiply_may_overflow &=
175
107
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
107
                }
177
158
                return narrow_integral || multiply_may_overflow;
178
158
            }
179
0
            return false;
180
158
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_7EEESE_EEEEbSI_
Line
Count
Source
127
232
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
232
            using Types2 = std::decay_t<decltype(types2)>;
129
232
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
232
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
232
                using FromFieldType = typename FromDataType::FieldType;
137
232
                using ToFieldType = typename ToDataType::FieldType;
138
232
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
232
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
232
                UInt32 to_max_digits = 0;
150
232
                UInt32 to_precision = 0;
151
232
                UInt32 to_scale = 0;
152
153
232
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
232
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
232
                    const auto* to_decimal_type =
157
232
                            check_and_get_data_type<ToDataType>(to_type.get());
158
232
                    to_precision = to_decimal_type->get_precision();
159
232
                    ToDataType::check_type_precision(to_precision);
160
161
232
                    to_scale = to_decimal_type->get_scale();
162
232
                    ToDataType::check_type_scale(to_scale);
163
232
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
232
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
232
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
232
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
232
                if (to_scale > from_scale) {
174
170
                    multiply_may_overflow &=
175
170
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
170
                }
177
232
                return narrow_integral || multiply_may_overflow;
178
232
            }
179
0
            return false;
180
232
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_8EEESE_EEEEbSI_
Line
Count
Source
127
224
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
224
            using Types2 = std::decay_t<decltype(types2)>;
129
224
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
224
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
224
                using FromFieldType = typename FromDataType::FieldType;
137
224
                using ToFieldType = typename ToDataType::FieldType;
138
224
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
224
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
224
                UInt32 to_max_digits = 0;
150
224
                UInt32 to_precision = 0;
151
224
                UInt32 to_scale = 0;
152
153
224
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
224
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
224
                    const auto* to_decimal_type =
157
224
                            check_and_get_data_type<ToDataType>(to_type.get());
158
224
                    to_precision = to_decimal_type->get_precision();
159
224
                    ToDataType::check_type_precision(to_precision);
160
161
224
                    to_scale = to_decimal_type->get_scale();
162
224
                    ToDataType::check_type_scale(to_scale);
163
224
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
224
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
224
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
224
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
224
                if (to_scale > from_scale) {
174
126
                    multiply_may_overflow &=
175
126
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
126
                }
177
224
                return narrow_integral || multiply_may_overflow;
178
224
            }
179
0
            return false;
180
224
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_9EEESE_EEEEbSI_
Line
Count
Source
127
318
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
318
            using Types2 = std::decay_t<decltype(types2)>;
129
318
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
318
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
318
                using FromFieldType = typename FromDataType::FieldType;
137
318
                using ToFieldType = typename ToDataType::FieldType;
138
318
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
318
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
318
                UInt32 to_max_digits = 0;
150
318
                UInt32 to_precision = 0;
151
318
                UInt32 to_scale = 0;
152
153
318
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
318
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
318
                    const auto* to_decimal_type =
157
318
                            check_and_get_data_type<ToDataType>(to_type.get());
158
318
                    to_precision = to_decimal_type->get_precision();
159
318
                    ToDataType::check_type_precision(to_precision);
160
161
318
                    to_scale = to_decimal_type->get_scale();
162
318
                    ToDataType::check_type_scale(to_scale);
163
318
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
318
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
318
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
318
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
318
                if (to_scale > from_scale) {
174
208
                    multiply_may_overflow &=
175
208
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
208
                }
177
318
                return narrow_integral || multiply_may_overflow;
178
318
            }
179
0
            return false;
180
318
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_28EEESE_EEEEbSI_
Line
Count
Source
127
567
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
567
            using Types2 = std::decay_t<decltype(types2)>;
129
567
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
567
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
567
                using FromFieldType = typename FromDataType::FieldType;
137
567
                using ToFieldType = typename ToDataType::FieldType;
138
567
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
567
                UInt32 from_scale = 0;
140
141
567
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
567
                    const auto* from_decimal_type =
143
567
                            check_and_get_data_type<FromDataType>(from_type.get());
144
567
                    from_precision =
145
567
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
567
                    from_scale = from_decimal_type->get_scale();
147
567
                }
148
149
567
                UInt32 to_max_digits = 0;
150
567
                UInt32 to_precision = 0;
151
567
                UInt32 to_scale = 0;
152
153
567
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
567
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
567
                    const auto* to_decimal_type =
157
567
                            check_and_get_data_type<ToDataType>(to_type.get());
158
567
                    to_precision = to_decimal_type->get_precision();
159
567
                    ToDataType::check_type_precision(to_precision);
160
161
567
                    to_scale = to_decimal_type->get_scale();
162
567
                    ToDataType::check_type_scale(to_scale);
163
567
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
567
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
567
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
567
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
567
                if (to_scale > from_scale) {
174
499
                    multiply_may_overflow &=
175
499
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
499
                }
177
567
                return narrow_integral || multiply_may_overflow;
178
567
            }
179
0
            return false;
180
567
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_29EEESE_EEEEbSI_
Line
Count
Source
127
919
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
919
            using Types2 = std::decay_t<decltype(types2)>;
129
919
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
919
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
919
                using FromFieldType = typename FromDataType::FieldType;
137
919
                using ToFieldType = typename ToDataType::FieldType;
138
919
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
919
                UInt32 from_scale = 0;
140
141
919
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
919
                    const auto* from_decimal_type =
143
919
                            check_and_get_data_type<FromDataType>(from_type.get());
144
919
                    from_precision =
145
919
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
919
                    from_scale = from_decimal_type->get_scale();
147
919
                }
148
149
919
                UInt32 to_max_digits = 0;
150
919
                UInt32 to_precision = 0;
151
919
                UInt32 to_scale = 0;
152
153
919
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
919
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
919
                    const auto* to_decimal_type =
157
919
                            check_and_get_data_type<ToDataType>(to_type.get());
158
919
                    to_precision = to_decimal_type->get_precision();
159
919
                    ToDataType::check_type_precision(to_precision);
160
161
919
                    to_scale = to_decimal_type->get_scale();
162
919
                    ToDataType::check_type_scale(to_scale);
163
919
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
919
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
919
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
919
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
919
                if (to_scale > from_scale) {
174
792
                    multiply_may_overflow &=
175
792
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
792
                }
177
919
                return narrow_integral || multiply_may_overflow;
178
919
            }
179
0
            return false;
180
919
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_20EEESE_EEEEbSI_
Line
Count
Source
127
148
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
148
            using Types2 = std::decay_t<decltype(types2)>;
129
148
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
148
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
148
                using FromFieldType = typename FromDataType::FieldType;
137
148
                using ToFieldType = typename ToDataType::FieldType;
138
148
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
148
                UInt32 from_scale = 0;
140
141
148
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
148
                    const auto* from_decimal_type =
143
148
                            check_and_get_data_type<FromDataType>(from_type.get());
144
148
                    from_precision =
145
148
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
148
                    from_scale = from_decimal_type->get_scale();
147
148
                }
148
149
148
                UInt32 to_max_digits = 0;
150
148
                UInt32 to_precision = 0;
151
148
                UInt32 to_scale = 0;
152
153
148
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
148
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
148
                    const auto* to_decimal_type =
157
148
                            check_and_get_data_type<ToDataType>(to_type.get());
158
148
                    to_precision = to_decimal_type->get_precision();
159
148
                    ToDataType::check_type_precision(to_precision);
160
161
148
                    to_scale = to_decimal_type->get_scale();
162
148
                    ToDataType::check_type_scale(to_scale);
163
148
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
148
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
148
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
148
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
148
                if (to_scale > from_scale) {
174
84
                    multiply_may_overflow &=
175
84
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
84
                }
177
148
                return narrow_integral || multiply_may_overflow;
178
148
            }
179
0
            return false;
180
148
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_30EEESE_EEEEbSI_
Line
Count
Source
127
1.20k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
1.20k
            using Types2 = std::decay_t<decltype(types2)>;
129
1.20k
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
1.20k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
1.20k
                using FromFieldType = typename FromDataType::FieldType;
137
1.20k
                using ToFieldType = typename ToDataType::FieldType;
138
1.20k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
1.20k
                UInt32 from_scale = 0;
140
141
1.20k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
1.20k
                    const auto* from_decimal_type =
143
1.20k
                            check_and_get_data_type<FromDataType>(from_type.get());
144
1.20k
                    from_precision =
145
1.20k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
1.20k
                    from_scale = from_decimal_type->get_scale();
147
1.20k
                }
148
149
1.20k
                UInt32 to_max_digits = 0;
150
1.20k
                UInt32 to_precision = 0;
151
1.20k
                UInt32 to_scale = 0;
152
153
1.20k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
1.20k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
1.20k
                    const auto* to_decimal_type =
157
1.20k
                            check_and_get_data_type<ToDataType>(to_type.get());
158
1.20k
                    to_precision = to_decimal_type->get_precision();
159
1.20k
                    ToDataType::check_type_precision(to_precision);
160
161
1.20k
                    to_scale = to_decimal_type->get_scale();
162
1.20k
                    ToDataType::check_type_scale(to_scale);
163
1.20k
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
1.20k
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
1.20k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
1.20k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
1.20k
                if (to_scale > from_scale) {
174
742
                    multiply_may_overflow &=
175
742
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
742
                }
177
1.20k
                return narrow_integral || multiply_may_overflow;
178
1.20k
            }
179
0
            return false;
180
1.20k
        });
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
127
934
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
934
            using Types2 = std::decay_t<decltype(types2)>;
129
934
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
934
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
934
                using FromFieldType = typename FromDataType::FieldType;
137
934
                using ToFieldType = typename ToDataType::FieldType;
138
934
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
934
                UInt32 from_scale = 0;
140
141
934
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
934
                    const auto* from_decimal_type =
143
934
                            check_and_get_data_type<FromDataType>(from_type.get());
144
934
                    from_precision =
145
934
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
934
                    from_scale = from_decimal_type->get_scale();
147
934
                }
148
149
934
                UInt32 to_max_digits = 0;
150
934
                UInt32 to_precision = 0;
151
934
                UInt32 to_scale = 0;
152
153
934
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
934
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
934
                    const auto* to_decimal_type =
157
934
                            check_and_get_data_type<ToDataType>(to_type.get());
158
934
                    to_precision = to_decimal_type->get_precision();
159
934
                    ToDataType::check_type_precision(to_precision);
160
161
934
                    to_scale = to_decimal_type->get_scale();
162
934
                    ToDataType::check_type_scale(to_scale);
163
934
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
934
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
934
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
934
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
934
                if (to_scale > from_scale) {
174
452
                    multiply_may_overflow &=
175
452
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
452
                }
177
934
                return narrow_integral || multiply_may_overflow;
178
934
            }
179
0
            return false;
180
934
        });
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
127
5.67k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
5.67k
            using Types2 = std::decay_t<decltype(types2)>;
129
5.67k
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
5.67k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
5.67k
                return false;
134
5.67k
            }
135
5.67k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
5.67k
                using FromFieldType = typename FromDataType::FieldType;
137
5.67k
                using ToFieldType = typename ToDataType::FieldType;
138
5.67k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
5.67k
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
5.67k
                UInt32 to_max_digits = 0;
150
5.67k
                UInt32 to_precision = 0;
151
5.67k
                UInt32 to_scale = 0;
152
153
5.67k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
5.67k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
5.67k
                    const auto* to_decimal_type =
157
5.67k
                            check_and_get_data_type<ToDataType>(to_type.get());
158
5.67k
                    to_precision = to_decimal_type->get_precision();
159
5.67k
                    ToDataType::check_type_precision(to_precision);
160
161
5.67k
                    to_scale = to_decimal_type->get_scale();
162
5.67k
                    ToDataType::check_type_scale(to_scale);
163
5.67k
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
5.67k
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
5.67k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
5.67k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
5.67k
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
5.67k
                return narrow_integral || multiply_may_overflow;
178
5.67k
            }
179
0
            return false;
180
5.67k
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE2EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE3EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE4EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE5EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE6EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE7EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE8EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE9EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_ISC_SC_EEEEbSG_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeDateV2ESC_EEEEbSG_
Line
Count
Source
127
1
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
1
            using Types2 = std::decay_t<decltype(types2)>;
129
1
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
1
            return false;
180
1
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_18DataTypeDateTimeV2ESC_EEEEbSG_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_16DataTypeDateTimeESC_EEEEbSG_
Line
Count
Source
127
3
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
3
            using Types2 = std::decay_t<decltype(types2)>;
129
3
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
3
            return false;
180
3
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeTimeV2ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_19DataTypeTimeStampTzESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeIPv4ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeIPv6ESC_EEEEbSG_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeStringESC_EEEEbSG_
Line
Count
Source
127
26
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
26
            using Types2 = std::decay_t<decltype(types2)>;
129
26
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
26
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
26
                return false;
134
26
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
26
            return false;
180
26
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeDateV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE2EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeDateV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE3EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeDateV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE4EEESC_EEEEbSG_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeDateV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE5EEESC_EEEEbSG_
Line
Count
Source
127
10
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
10
            using Types2 = std::decay_t<decltype(types2)>;
129
10
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
10
            return false;
180
10
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeDateV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE6EEESC_EEEEbSG_
Line
Count
Source
127
7
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
7
            using Types2 = std::decay_t<decltype(types2)>;
129
7
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
7
            return false;
180
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
127
7
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
7
            using Types2 = std::decay_t<decltype(types2)>;
129
7
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
7
            return false;
180
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
127
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
2
            using Types2 = std::decay_t<decltype(types2)>;
129
2
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
2
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
2
                using FromFieldType = typename FromDataType::FieldType;
137
2
                using ToFieldType = typename ToDataType::FieldType;
138
2
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
2
                UInt32 from_scale = 0;
140
141
2
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
2
                    const auto* from_decimal_type =
143
2
                            check_and_get_data_type<FromDataType>(from_type.get());
144
2
                    from_precision =
145
2
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
2
                    from_scale = from_decimal_type->get_scale();
147
2
                }
148
149
2
                UInt32 to_max_digits = 0;
150
2
                UInt32 to_precision = 0;
151
2
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
2
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
2
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
2
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
2
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
2
                return narrow_integral || multiply_may_overflow;
178
2
            }
179
0
            return false;
180
2
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeDateV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeDateV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeDateV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEESC_EEEEbSG_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeDateV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeDateESC_EEEEbSG_
Line
Count
Source
127
35
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
35
            using Types2 = std::decay_t<decltype(types2)>;
129
35
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
35
            return false;
180
35
        });
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
127
238
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
238
            using Types2 = std::decay_t<decltype(types2)>;
129
238
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
238
            return false;
180
238
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeDateV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_16DataTypeDateTimeESC_EEEEbSG_
Line
Count
Source
127
1
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
1
            using Types2 = std::decay_t<decltype(types2)>;
129
1
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
1
            return false;
180
1
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeDateV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeTimeV2ESC_EEEEbSG_
Line
Count
Source
127
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
2
            using Types2 = std::decay_t<decltype(types2)>;
129
2
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
2
            return false;
180
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
127
5.69k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
5.69k
            using Types2 = std::decay_t<decltype(types2)>;
129
5.69k
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
5.69k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
5.69k
                return false;
134
5.69k
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
5.69k
            return false;
180
5.69k
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE2EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE3EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE4EEESC_EEEEbSG_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE5EEESC_EEEEbSG_
Line
Count
Source
127
13
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
13
            using Types2 = std::decay_t<decltype(types2)>;
129
13
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
13
            return false;
180
13
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE6EEESC_EEEEbSG_
Line
Count
Source
127
33
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
33
            using Types2 = std::decay_t<decltype(types2)>;
129
33
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
33
            return false;
180
33
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE7EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE8EEESC_EEEEbSG_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE9EEESC_EEEEbSG_
Line
Count
Source
127
12
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
12
            using Types2 = std::decay_t<decltype(types2)>;
129
12
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
12
            return false;
180
12
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEESC_EEEEbSG_
Line
Count
Source
127
18
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
18
            using Types2 = std::decay_t<decltype(types2)>;
129
18
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
18
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
18
                using FromFieldType = typename FromDataType::FieldType;
137
18
                using ToFieldType = typename ToDataType::FieldType;
138
18
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
18
                UInt32 from_scale = 0;
140
141
18
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
18
                    const auto* from_decimal_type =
143
18
                            check_and_get_data_type<FromDataType>(from_type.get());
144
18
                    from_precision =
145
18
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
18
                    from_scale = from_decimal_type->get_scale();
147
18
                }
148
149
18
                UInt32 to_max_digits = 0;
150
18
                UInt32 to_precision = 0;
151
18
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
18
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
18
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
18
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
18
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
18
                return narrow_integral || multiply_may_overflow;
178
18
            }
179
0
            return false;
180
18
        });
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
127
14
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
14
            using Types2 = std::decay_t<decltype(types2)>;
129
14
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
14
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
14
                using FromFieldType = typename FromDataType::FieldType;
137
14
                using ToFieldType = typename ToDataType::FieldType;
138
14
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
14
                UInt32 from_scale = 0;
140
141
14
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
14
                    const auto* from_decimal_type =
143
14
                            check_and_get_data_type<FromDataType>(from_type.get());
144
14
                    from_precision =
145
14
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
14
                    from_scale = from_decimal_type->get_scale();
147
14
                }
148
149
14
                UInt32 to_max_digits = 0;
150
14
                UInt32 to_precision = 0;
151
14
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
14
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
14
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
14
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
14
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
14
                return narrow_integral || multiply_may_overflow;
178
14
            }
179
0
            return false;
180
14
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEESC_EEEEbSG_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEESC_EEEEbSG_
Line
Count
Source
127
5
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
5
            using Types2 = std::decay_t<decltype(types2)>;
129
5
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
5
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
5
                using FromFieldType = typename FromDataType::FieldType;
137
5
                using ToFieldType = typename ToDataType::FieldType;
138
5
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
5
                UInt32 from_scale = 0;
140
141
5
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
5
                    const auto* from_decimal_type =
143
5
                            check_and_get_data_type<FromDataType>(from_type.get());
144
5
                    from_precision =
145
5
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
5
                    from_scale = from_decimal_type->get_scale();
147
5
                }
148
149
5
                UInt32 to_max_digits = 0;
150
5
                UInt32 to_precision = 0;
151
5
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
5
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
5
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
5
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
5
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
5
                return narrow_integral || multiply_may_overflow;
178
5
            }
179
0
            return false;
180
5
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeDateESC_EEEEbSG_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeDateV2ESC_EEEEbSG_
Line
Count
Source
127
420
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
420
            using Types2 = std::decay_t<decltype(types2)>;
129
420
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
420
            return false;
180
420
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_ISC_SC_EEEEbSG_
Line
Count
Source
127
113
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
113
            using Types2 = std::decay_t<decltype(types2)>;
129
113
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
113
            return false;
180
113
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_16DataTypeDateTimeESC_EEEEbSG_
Line
Count
Source
127
42
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
42
            using Types2 = std::decay_t<decltype(types2)>;
129
42
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
42
            return false;
180
42
        });
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
127
4
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
4
            using Types2 = std::decay_t<decltype(types2)>;
129
4
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
4
            return false;
180
4
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_19DataTypeTimeStampTzESC_EEEEbSG_
Line
Count
Source
127
46
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
46
            using Types2 = std::decay_t<decltype(types2)>;
129
46
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
46
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
46
                return false;
134
46
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
46
            return false;
180
46
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeIPv4ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeIPv6ESC_EEEEbSG_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeStringESC_EEEEbSG_
Line
Count
Source
127
3.88k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
3.88k
            using Types2 = std::decay_t<decltype(types2)>;
129
3.88k
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
3.88k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
3.88k
                return false;
134
3.88k
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
3.88k
            return false;
180
3.88k
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE2EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE3EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE4EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE5EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE6EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE7EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE8EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE9EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeDateESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeDateV2ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_18DataTypeDateTimeV2ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_ISC_SC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeTimeV2ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_19DataTypeTimeStampTzESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeIPv4ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeIPv6ESC_EEEEbSG_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeStringESC_EEEEbSG_
Line
Count
Source
127
25
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
25
            using Types2 = std::decay_t<decltype(types2)>;
129
25
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
25
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
25
                return false;
134
25
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
25
            return false;
180
25
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE2EEESC_EEEEbSG_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE3EEESC_EEEEbSG_
Line
Count
Source
127
28
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
28
            using Types2 = std::decay_t<decltype(types2)>;
129
28
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
28
            return false;
180
28
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE4EEESC_EEEEbSG_
Line
Count
Source
127
21
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
21
            using Types2 = std::decay_t<decltype(types2)>;
129
21
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
21
            return false;
180
21
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE5EEESC_EEEEbSG_
Line
Count
Source
127
33
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
33
            using Types2 = std::decay_t<decltype(types2)>;
129
33
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
33
            return false;
180
33
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE6EEESC_EEEEbSG_
Line
Count
Source
127
9
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
9
            using Types2 = std::decay_t<decltype(types2)>;
129
9
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
9
            return false;
180
9
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE7EEESC_EEEEbSG_
Line
Count
Source
127
3
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
3
            using Types2 = std::decay_t<decltype(types2)>;
129
3
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
3
            return false;
180
3
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE8EEESC_EEEEbSG_
Line
Count
Source
127
7
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
7
            using Types2 = std::decay_t<decltype(types2)>;
129
7
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
7
            return false;
180
7
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE9EEESC_EEEEbSG_
Line
Count
Source
127
18
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
18
            using Types2 = std::decay_t<decltype(types2)>;
129
18
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
18
            return false;
180
18
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEESC_EEEEbSG_
Line
Count
Source
127
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
2
            using Types2 = std::decay_t<decltype(types2)>;
129
2
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
2
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
2
                using FromFieldType = typename FromDataType::FieldType;
137
2
                using ToFieldType = typename ToDataType::FieldType;
138
2
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
2
                UInt32 from_scale = 0;
140
141
2
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
2
                    const auto* from_decimal_type =
143
2
                            check_and_get_data_type<FromDataType>(from_type.get());
144
2
                    from_precision =
145
2
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
2
                    from_scale = from_decimal_type->get_scale();
147
2
                }
148
149
2
                UInt32 to_max_digits = 0;
150
2
                UInt32 to_precision = 0;
151
2
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
2
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
2
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
2
                    to_precision = to_max_digits;
167
2
                }
168
169
2
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
2
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
2
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
2
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
2
                return narrow_integral || multiply_may_overflow;
178
2
            }
179
0
            return false;
180
2
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEESC_EEEEbSG_
Line
Count
Source
127
1
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
1
            using Types2 = std::decay_t<decltype(types2)>;
129
1
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
1
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
1
                using FromFieldType = typename FromDataType::FieldType;
137
1
                using ToFieldType = typename ToDataType::FieldType;
138
1
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
1
                UInt32 from_scale = 0;
140
141
1
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
1
                    const auto* from_decimal_type =
143
1
                            check_and_get_data_type<FromDataType>(from_type.get());
144
1
                    from_precision =
145
1
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
1
                    from_scale = from_decimal_type->get_scale();
147
1
                }
148
149
1
                UInt32 to_max_digits = 0;
150
1
                UInt32 to_precision = 0;
151
1
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
1
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
1
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
1
                    to_precision = to_max_digits;
167
1
                }
168
169
1
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
1
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
1
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
1
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
1
                return narrow_integral || multiply_may_overflow;
178
1
            }
179
0
            return false;
180
1
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEESC_EEEEbSG_
Line
Count
Source
127
1
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
1
            using Types2 = std::decay_t<decltype(types2)>;
129
1
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
1
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
1
                using FromFieldType = typename FromDataType::FieldType;
137
1
                using ToFieldType = typename ToDataType::FieldType;
138
1
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
1
                UInt32 from_scale = 0;
140
141
1
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
1
                    const auto* from_decimal_type =
143
1
                            check_and_get_data_type<FromDataType>(from_type.get());
144
1
                    from_precision =
145
1
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
1
                    from_scale = from_decimal_type->get_scale();
147
1
                }
148
149
1
                UInt32 to_max_digits = 0;
150
1
                UInt32 to_precision = 0;
151
1
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
1
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
1
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
1
                    to_precision = to_max_digits;
167
1
                }
168
169
1
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
1
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
1
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
1
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
1
                return narrow_integral || multiply_may_overflow;
178
1
            }
179
0
            return false;
180
1
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEESC_EEEEbSG_
Line
Count
Source
127
11
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
11
            using Types2 = std::decay_t<decltype(types2)>;
129
11
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
11
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
11
                using FromFieldType = typename FromDataType::FieldType;
137
11
                using ToFieldType = typename ToDataType::FieldType;
138
11
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
11
                UInt32 from_scale = 0;
140
141
11
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
11
                    const auto* from_decimal_type =
143
11
                            check_and_get_data_type<FromDataType>(from_type.get());
144
11
                    from_precision =
145
11
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
11
                    from_scale = from_decimal_type->get_scale();
147
11
                }
148
149
11
                UInt32 to_max_digits = 0;
150
11
                UInt32 to_precision = 0;
151
11
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
11
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
11
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
11
                    to_precision = to_max_digits;
167
11
                }
168
169
11
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
11
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
11
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
11
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
11
                return narrow_integral || multiply_may_overflow;
178
11
            }
179
0
            return false;
180
11
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeDateESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeDateV2ESC_EEEEbSG_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_18DataTypeDateTimeV2ESC_EEEEbSG_
Line
Count
Source
127
8
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
8
            using Types2 = std::decay_t<decltype(types2)>;
129
8
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
8
            return false;
180
8
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_16DataTypeDateTimeESC_EEEEbSG_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_ISC_SC_EEEEbSG_
Line
Count
Source
127
19
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
19
            using Types2 = std::decay_t<decltype(types2)>;
129
19
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
19
            return false;
180
19
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_19DataTypeTimeStampTzESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeIPv4ESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeIPv6ESC_EEEEbSG_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeStringESC_EEEEbSG_
Line
Count
Source
127
299
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
299
            using Types2 = std::decay_t<decltype(types2)>;
129
299
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
299
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
299
                return false;
134
299
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
299
            return false;
180
299
        });
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_
181
233k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE2EEEvEEEEbRKT_
Line
Count
Source
117
2.43k
    auto make_default_wrapper = [&](const auto& types) -> bool {
118
2.43k
        using Types = std::decay_t<decltype(types)>;
119
2.43k
        using ToDataType = typename Types::LeftType;
120
121
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
122
                        IsDatelikeV2Types<ToDataType> ||
123
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
124
            return false;
125
        }
126
2.43k
        return call_on_index_and_data_type<
127
2.43k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
2.43k
            using Types2 = std::decay_t<decltype(types2)>;
129
2.43k
            using FromDataType = typename Types2::LeftType;
130
2.43k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
2.43k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
2.43k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
2.43k
                return false;
134
2.43k
            }
135
2.43k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
2.43k
                using FromFieldType = typename FromDataType::FieldType;
137
2.43k
                using ToFieldType = typename ToDataType::FieldType;
138
2.43k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
2.43k
                UInt32 from_scale = 0;
140
141
2.43k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
2.43k
                    const auto* from_decimal_type =
143
2.43k
                            check_and_get_data_type<FromDataType>(from_type.get());
144
2.43k
                    from_precision =
145
2.43k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
2.43k
                    from_scale = from_decimal_type->get_scale();
147
2.43k
                }
148
149
2.43k
                UInt32 to_max_digits = 0;
150
2.43k
                UInt32 to_precision = 0;
151
2.43k
                UInt32 to_scale = 0;
152
153
2.43k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
2.43k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
2.43k
                    const auto* to_decimal_type =
157
2.43k
                            check_and_get_data_type<ToDataType>(to_type.get());
158
2.43k
                    to_precision = to_decimal_type->get_precision();
159
2.43k
                    ToDataType::check_type_precision(to_precision);
160
161
2.43k
                    to_scale = to_decimal_type->get_scale();
162
2.43k
                    ToDataType::check_type_scale(to_scale);
163
2.43k
                }
164
2.43k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
2.43k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
2.43k
                    to_precision = to_max_digits;
167
2.43k
                }
168
169
2.43k
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
2.43k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
2.43k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
2.43k
                if (to_scale > from_scale) {
174
2.43k
                    multiply_may_overflow &=
175
2.43k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
2.43k
                }
177
2.43k
                return narrow_integral || multiply_may_overflow;
178
2.43k
            }
179
2.43k
            return false;
180
2.43k
        });
181
2.43k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEvEEEEbRKT_
Line
Count
Source
117
4.99k
    auto make_default_wrapper = [&](const auto& types) -> bool {
118
4.99k
        using Types = std::decay_t<decltype(types)>;
119
4.99k
        using ToDataType = typename Types::LeftType;
120
121
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
122
                        IsDatelikeV2Types<ToDataType> ||
123
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
124
            return false;
125
        }
126
4.99k
        return call_on_index_and_data_type<
127
4.99k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
4.99k
            using Types2 = std::decay_t<decltype(types2)>;
129
4.99k
            using FromDataType = typename Types2::LeftType;
130
4.99k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
4.99k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
4.99k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
4.99k
                return false;
134
4.99k
            }
135
4.99k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
4.99k
                using FromFieldType = typename FromDataType::FieldType;
137
4.99k
                using ToFieldType = typename ToDataType::FieldType;
138
4.99k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
4.99k
                UInt32 from_scale = 0;
140
141
4.99k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
4.99k
                    const auto* from_decimal_type =
143
4.99k
                            check_and_get_data_type<FromDataType>(from_type.get());
144
4.99k
                    from_precision =
145
4.99k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
4.99k
                    from_scale = from_decimal_type->get_scale();
147
4.99k
                }
148
149
4.99k
                UInt32 to_max_digits = 0;
150
4.99k
                UInt32 to_precision = 0;
151
4.99k
                UInt32 to_scale = 0;
152
153
4.99k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
4.99k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
4.99k
                    const auto* to_decimal_type =
157
4.99k
                            check_and_get_data_type<ToDataType>(to_type.get());
158
4.99k
                    to_precision = to_decimal_type->get_precision();
159
4.99k
                    ToDataType::check_type_precision(to_precision);
160
161
4.99k
                    to_scale = to_decimal_type->get_scale();
162
4.99k
                    ToDataType::check_type_scale(to_scale);
163
4.99k
                }
164
4.99k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
4.99k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
4.99k
                    to_precision = to_max_digits;
167
4.99k
                }
168
169
4.99k
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
4.99k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
4.99k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
4.99k
                if (to_scale > from_scale) {
174
4.99k
                    multiply_may_overflow &=
175
4.99k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
4.99k
                }
177
4.99k
                return narrow_integral || multiply_may_overflow;
178
4.99k
            }
179
4.99k
            return false;
180
4.99k
        });
181
4.99k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEvEEEEbRKT_
Line
Count
Source
117
5.71k
    auto make_default_wrapper = [&](const auto& types) -> bool {
118
5.71k
        using Types = std::decay_t<decltype(types)>;
119
5.71k
        using ToDataType = typename Types::LeftType;
120
121
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
122
                        IsDatelikeV2Types<ToDataType> ||
123
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
124
            return false;
125
        }
126
5.71k
        return call_on_index_and_data_type<
127
5.71k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
5.71k
            using Types2 = std::decay_t<decltype(types2)>;
129
5.71k
            using FromDataType = typename Types2::LeftType;
130
5.71k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
5.71k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
5.71k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
5.71k
                return false;
134
5.71k
            }
135
5.71k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
5.71k
                using FromFieldType = typename FromDataType::FieldType;
137
5.71k
                using ToFieldType = typename ToDataType::FieldType;
138
5.71k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
5.71k
                UInt32 from_scale = 0;
140
141
5.71k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
5.71k
                    const auto* from_decimal_type =
143
5.71k
                            check_and_get_data_type<FromDataType>(from_type.get());
144
5.71k
                    from_precision =
145
5.71k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
5.71k
                    from_scale = from_decimal_type->get_scale();
147
5.71k
                }
148
149
5.71k
                UInt32 to_max_digits = 0;
150
5.71k
                UInt32 to_precision = 0;
151
5.71k
                UInt32 to_scale = 0;
152
153
5.71k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
5.71k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
5.71k
                    const auto* to_decimal_type =
157
5.71k
                            check_and_get_data_type<ToDataType>(to_type.get());
158
5.71k
                    to_precision = to_decimal_type->get_precision();
159
5.71k
                    ToDataType::check_type_precision(to_precision);
160
161
5.71k
                    to_scale = to_decimal_type->get_scale();
162
5.71k
                    ToDataType::check_type_scale(to_scale);
163
5.71k
                }
164
5.71k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
5.71k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
5.71k
                    to_precision = to_max_digits;
167
5.71k
                }
168
169
5.71k
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
5.71k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
5.71k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
5.71k
                if (to_scale > from_scale) {
174
5.71k
                    multiply_may_overflow &=
175
5.71k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
5.71k
                }
177
5.71k
                return narrow_integral || multiply_may_overflow;
178
5.71k
            }
179
5.71k
            return false;
180
5.71k
        });
181
5.71k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEvEEEEbRKT_
Line
Count
Source
117
36.0k
    auto make_default_wrapper = [&](const auto& types) -> bool {
118
36.0k
        using Types = std::decay_t<decltype(types)>;
119
36.0k
        using ToDataType = typename Types::LeftType;
120
121
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
122
                        IsDatelikeV2Types<ToDataType> ||
123
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
124
            return false;
125
        }
126
36.0k
        return call_on_index_and_data_type<
127
36.0k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
36.0k
            using Types2 = std::decay_t<decltype(types2)>;
129
36.0k
            using FromDataType = typename Types2::LeftType;
130
36.0k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
36.0k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
36.0k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
36.0k
                return false;
134
36.0k
            }
135
36.0k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
36.0k
                using FromFieldType = typename FromDataType::FieldType;
137
36.0k
                using ToFieldType = typename ToDataType::FieldType;
138
36.0k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
36.0k
                UInt32 from_scale = 0;
140
141
36.0k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
36.0k
                    const auto* from_decimal_type =
143
36.0k
                            check_and_get_data_type<FromDataType>(from_type.get());
144
36.0k
                    from_precision =
145
36.0k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
36.0k
                    from_scale = from_decimal_type->get_scale();
147
36.0k
                }
148
149
36.0k
                UInt32 to_max_digits = 0;
150
36.0k
                UInt32 to_precision = 0;
151
36.0k
                UInt32 to_scale = 0;
152
153
36.0k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
36.0k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
36.0k
                    const auto* to_decimal_type =
157
36.0k
                            check_and_get_data_type<ToDataType>(to_type.get());
158
36.0k
                    to_precision = to_decimal_type->get_precision();
159
36.0k
                    ToDataType::check_type_precision(to_precision);
160
161
36.0k
                    to_scale = to_decimal_type->get_scale();
162
36.0k
                    ToDataType::check_type_scale(to_scale);
163
36.0k
                }
164
36.0k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
36.0k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
36.0k
                    to_precision = to_max_digits;
167
36.0k
                }
168
169
36.0k
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
36.0k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
36.0k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
36.0k
                if (to_scale > from_scale) {
174
36.0k
                    multiply_may_overflow &=
175
36.0k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
36.0k
                }
177
36.0k
                return narrow_integral || multiply_may_overflow;
178
36.0k
            }
179
36.0k
            return false;
180
36.0k
        });
181
36.0k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEvEEEEbRKT_
Line
Count
Source
117
39.6k
    auto make_default_wrapper = [&](const auto& types) -> bool {
118
39.6k
        using Types = std::decay_t<decltype(types)>;
119
39.6k
        using ToDataType = typename Types::LeftType;
120
121
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
122
                        IsDatelikeV2Types<ToDataType> ||
123
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
124
            return false;
125
        }
126
39.6k
        return call_on_index_and_data_type<
127
39.6k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
39.6k
            using Types2 = std::decay_t<decltype(types2)>;
129
39.6k
            using FromDataType = typename Types2::LeftType;
130
39.6k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
39.6k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
39.6k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
39.6k
                return false;
134
39.6k
            }
135
39.6k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
39.6k
                using FromFieldType = typename FromDataType::FieldType;
137
39.6k
                using ToFieldType = typename ToDataType::FieldType;
138
39.6k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
39.6k
                UInt32 from_scale = 0;
140
141
39.6k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
39.6k
                    const auto* from_decimal_type =
143
39.6k
                            check_and_get_data_type<FromDataType>(from_type.get());
144
39.6k
                    from_precision =
145
39.6k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
39.6k
                    from_scale = from_decimal_type->get_scale();
147
39.6k
                }
148
149
39.6k
                UInt32 to_max_digits = 0;
150
39.6k
                UInt32 to_precision = 0;
151
39.6k
                UInt32 to_scale = 0;
152
153
39.6k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
39.6k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
39.6k
                    const auto* to_decimal_type =
157
39.6k
                            check_and_get_data_type<ToDataType>(to_type.get());
158
39.6k
                    to_precision = to_decimal_type->get_precision();
159
39.6k
                    ToDataType::check_type_precision(to_precision);
160
161
39.6k
                    to_scale = to_decimal_type->get_scale();
162
39.6k
                    ToDataType::check_type_scale(to_scale);
163
39.6k
                }
164
39.6k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
39.6k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
39.6k
                    to_precision = to_max_digits;
167
39.6k
                }
168
169
39.6k
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
39.6k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
39.6k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
39.6k
                if (to_scale > from_scale) {
174
39.6k
                    multiply_may_overflow &=
175
39.6k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
39.6k
                }
177
39.6k
                return narrow_integral || multiply_may_overflow;
178
39.6k
            }
179
39.6k
            return false;
180
39.6k
        });
181
39.6k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEvEEEEbRKT_
Line
Count
Source
117
5.41k
    auto make_default_wrapper = [&](const auto& types) -> bool {
118
5.41k
        using Types = std::decay_t<decltype(types)>;
119
5.41k
        using ToDataType = typename Types::LeftType;
120
121
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
122
                        IsDatelikeV2Types<ToDataType> ||
123
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
124
            return false;
125
        }
126
5.41k
        return call_on_index_and_data_type<
127
5.41k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
5.41k
            using Types2 = std::decay_t<decltype(types2)>;
129
5.41k
            using FromDataType = typename Types2::LeftType;
130
5.41k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
5.41k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
5.41k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
5.41k
                return false;
134
5.41k
            }
135
5.41k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
5.41k
                using FromFieldType = typename FromDataType::FieldType;
137
5.41k
                using ToFieldType = typename ToDataType::FieldType;
138
5.41k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
5.41k
                UInt32 from_scale = 0;
140
141
5.41k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
5.41k
                    const auto* from_decimal_type =
143
5.41k
                            check_and_get_data_type<FromDataType>(from_type.get());
144
5.41k
                    from_precision =
145
5.41k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
5.41k
                    from_scale = from_decimal_type->get_scale();
147
5.41k
                }
148
149
5.41k
                UInt32 to_max_digits = 0;
150
5.41k
                UInt32 to_precision = 0;
151
5.41k
                UInt32 to_scale = 0;
152
153
5.41k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
5.41k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
5.41k
                    const auto* to_decimal_type =
157
5.41k
                            check_and_get_data_type<ToDataType>(to_type.get());
158
5.41k
                    to_precision = to_decimal_type->get_precision();
159
5.41k
                    ToDataType::check_type_precision(to_precision);
160
161
5.41k
                    to_scale = to_decimal_type->get_scale();
162
5.41k
                    ToDataType::check_type_scale(to_scale);
163
5.41k
                }
164
5.41k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
5.41k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
5.41k
                    to_precision = to_max_digits;
167
5.41k
                }
168
169
5.41k
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
5.41k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
5.41k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
5.41k
                if (to_scale > from_scale) {
174
5.41k
                    multiply_may_overflow &=
175
5.41k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
5.41k
                }
177
5.41k
                return narrow_integral || multiply_may_overflow;
178
5.41k
            }
179
5.41k
            return false;
180
5.41k
        });
181
5.41k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE8EEEvEEEEbRKT_
Line
Count
Source
117
10.8k
    auto make_default_wrapper = [&](const auto& types) -> bool {
118
10.8k
        using Types = std::decay_t<decltype(types)>;
119
10.8k
        using ToDataType = typename Types::LeftType;
120
121
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
122
                        IsDatelikeV2Types<ToDataType> ||
123
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
124
            return false;
125
        }
126
10.8k
        return call_on_index_and_data_type<
127
10.8k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
10.8k
            using Types2 = std::decay_t<decltype(types2)>;
129
10.8k
            using FromDataType = typename Types2::LeftType;
130
10.8k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
10.8k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
10.8k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
10.8k
                return false;
134
10.8k
            }
135
10.8k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
10.8k
                using FromFieldType = typename FromDataType::FieldType;
137
10.8k
                using ToFieldType = typename ToDataType::FieldType;
138
10.8k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
10.8k
                UInt32 from_scale = 0;
140
141
10.8k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
10.8k
                    const auto* from_decimal_type =
143
10.8k
                            check_and_get_data_type<FromDataType>(from_type.get());
144
10.8k
                    from_precision =
145
10.8k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
10.8k
                    from_scale = from_decimal_type->get_scale();
147
10.8k
                }
148
149
10.8k
                UInt32 to_max_digits = 0;
150
10.8k
                UInt32 to_precision = 0;
151
10.8k
                UInt32 to_scale = 0;
152
153
10.8k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
10.8k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
10.8k
                    const auto* to_decimal_type =
157
10.8k
                            check_and_get_data_type<ToDataType>(to_type.get());
158
10.8k
                    to_precision = to_decimal_type->get_precision();
159
10.8k
                    ToDataType::check_type_precision(to_precision);
160
161
10.8k
                    to_scale = to_decimal_type->get_scale();
162
10.8k
                    ToDataType::check_type_scale(to_scale);
163
10.8k
                }
164
10.8k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
10.8k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
10.8k
                    to_precision = to_max_digits;
167
10.8k
                }
168
169
10.8k
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
10.8k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
10.8k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
10.8k
                if (to_scale > from_scale) {
174
10.8k
                    multiply_may_overflow &=
175
10.8k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
10.8k
                }
177
10.8k
                return narrow_integral || multiply_may_overflow;
178
10.8k
            }
179
10.8k
            return false;
180
10.8k
        });
181
10.8k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE9EEEvEEEEbRKT_
Line
Count
Source
117
26.8k
    auto make_default_wrapper = [&](const auto& types) -> bool {
118
26.8k
        using Types = std::decay_t<decltype(types)>;
119
26.8k
        using ToDataType = typename Types::LeftType;
120
121
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
122
                        IsDatelikeV2Types<ToDataType> ||
123
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
124
            return false;
125
        }
126
26.8k
        return call_on_index_and_data_type<
127
26.8k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
26.8k
            using Types2 = std::decay_t<decltype(types2)>;
129
26.8k
            using FromDataType = typename Types2::LeftType;
130
26.8k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
26.8k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
26.8k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
26.8k
                return false;
134
26.8k
            }
135
26.8k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
26.8k
                using FromFieldType = typename FromDataType::FieldType;
137
26.8k
                using ToFieldType = typename ToDataType::FieldType;
138
26.8k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
26.8k
                UInt32 from_scale = 0;
140
141
26.8k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
26.8k
                    const auto* from_decimal_type =
143
26.8k
                            check_and_get_data_type<FromDataType>(from_type.get());
144
26.8k
                    from_precision =
145
26.8k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
26.8k
                    from_scale = from_decimal_type->get_scale();
147
26.8k
                }
148
149
26.8k
                UInt32 to_max_digits = 0;
150
26.8k
                UInt32 to_precision = 0;
151
26.8k
                UInt32 to_scale = 0;
152
153
26.8k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
26.8k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
26.8k
                    const auto* to_decimal_type =
157
26.8k
                            check_and_get_data_type<ToDataType>(to_type.get());
158
26.8k
                    to_precision = to_decimal_type->get_precision();
159
26.8k
                    ToDataType::check_type_precision(to_precision);
160
161
26.8k
                    to_scale = to_decimal_type->get_scale();
162
26.8k
                    ToDataType::check_type_scale(to_scale);
163
26.8k
                }
164
26.8k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
26.8k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
26.8k
                    to_precision = to_max_digits;
167
26.8k
                }
168
169
26.8k
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
26.8k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
26.8k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
26.8k
                if (to_scale > from_scale) {
174
26.8k
                    multiply_may_overflow &=
175
26.8k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
26.8k
                }
177
26.8k
                return narrow_integral || multiply_may_overflow;
178
26.8k
            }
179
26.8k
            return false;
180
26.8k
        });
181
26.8k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_
Line
Count
Source
117
7.97k
    auto make_default_wrapper = [&](const auto& types) -> bool {
118
7.97k
        using Types = std::decay_t<decltype(types)>;
119
7.97k
        using ToDataType = typename Types::LeftType;
120
121
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
122
                        IsDatelikeV2Types<ToDataType> ||
123
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
124
            return false;
125
        }
126
7.97k
        return call_on_index_and_data_type<
127
7.97k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
7.97k
            using Types2 = std::decay_t<decltype(types2)>;
129
7.97k
            using FromDataType = typename Types2::LeftType;
130
7.97k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
7.97k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
7.97k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
7.97k
                return false;
134
7.97k
            }
135
7.97k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
7.97k
                using FromFieldType = typename FromDataType::FieldType;
137
7.97k
                using ToFieldType = typename ToDataType::FieldType;
138
7.97k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
7.97k
                UInt32 from_scale = 0;
140
141
7.97k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
7.97k
                    const auto* from_decimal_type =
143
7.97k
                            check_and_get_data_type<FromDataType>(from_type.get());
144
7.97k
                    from_precision =
145
7.97k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
7.97k
                    from_scale = from_decimal_type->get_scale();
147
7.97k
                }
148
149
7.97k
                UInt32 to_max_digits = 0;
150
7.97k
                UInt32 to_precision = 0;
151
7.97k
                UInt32 to_scale = 0;
152
153
7.97k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
7.97k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
7.97k
                    const auto* to_decimal_type =
157
7.97k
                            check_and_get_data_type<ToDataType>(to_type.get());
158
7.97k
                    to_precision = to_decimal_type->get_precision();
159
7.97k
                    ToDataType::check_type_precision(to_precision);
160
161
7.97k
                    to_scale = to_decimal_type->get_scale();
162
7.97k
                    ToDataType::check_type_scale(to_scale);
163
7.97k
                }
164
7.97k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
7.97k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
7.97k
                    to_precision = to_max_digits;
167
7.97k
                }
168
169
7.97k
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
7.97k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
7.97k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
7.97k
                if (to_scale > from_scale) {
174
7.97k
                    multiply_may_overflow &=
175
7.97k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
7.97k
                }
177
7.97k
                return narrow_integral || multiply_may_overflow;
178
7.97k
            }
179
7.97k
            return false;
180
7.97k
        });
181
7.97k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_
Line
Count
Source
117
15.7k
    auto make_default_wrapper = [&](const auto& types) -> bool {
118
15.7k
        using Types = std::decay_t<decltype(types)>;
119
15.7k
        using ToDataType = typename Types::LeftType;
120
121
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
122
                        IsDatelikeV2Types<ToDataType> ||
123
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
124
            return false;
125
        }
126
15.7k
        return call_on_index_and_data_type<
127
15.7k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
15.7k
            using Types2 = std::decay_t<decltype(types2)>;
129
15.7k
            using FromDataType = typename Types2::LeftType;
130
15.7k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
15.7k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
15.7k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
15.7k
                return false;
134
15.7k
            }
135
15.7k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
15.7k
                using FromFieldType = typename FromDataType::FieldType;
137
15.7k
                using ToFieldType = typename ToDataType::FieldType;
138
15.7k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
15.7k
                UInt32 from_scale = 0;
140
141
15.7k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
15.7k
                    const auto* from_decimal_type =
143
15.7k
                            check_and_get_data_type<FromDataType>(from_type.get());
144
15.7k
                    from_precision =
145
15.7k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
15.7k
                    from_scale = from_decimal_type->get_scale();
147
15.7k
                }
148
149
15.7k
                UInt32 to_max_digits = 0;
150
15.7k
                UInt32 to_precision = 0;
151
15.7k
                UInt32 to_scale = 0;
152
153
15.7k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
15.7k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
15.7k
                    const auto* to_decimal_type =
157
15.7k
                            check_and_get_data_type<ToDataType>(to_type.get());
158
15.7k
                    to_precision = to_decimal_type->get_precision();
159
15.7k
                    ToDataType::check_type_precision(to_precision);
160
161
15.7k
                    to_scale = to_decimal_type->get_scale();
162
15.7k
                    ToDataType::check_type_scale(to_scale);
163
15.7k
                }
164
15.7k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
15.7k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
15.7k
                    to_precision = to_max_digits;
167
15.7k
                }
168
169
15.7k
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
15.7k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
15.7k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
15.7k
                if (to_scale > from_scale) {
174
15.7k
                    multiply_may_overflow &=
175
15.7k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
15.7k
                }
177
15.7k
                return narrow_integral || multiply_may_overflow;
178
15.7k
            }
179
15.7k
            return false;
180
15.7k
        });
181
15.7k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_
Line
Count
Source
117
228
    auto make_default_wrapper = [&](const auto& types) -> bool {
118
228
        using Types = std::decay_t<decltype(types)>;
119
228
        using ToDataType = typename Types::LeftType;
120
121
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
122
                        IsDatelikeV2Types<ToDataType> ||
123
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
124
            return false;
125
        }
126
228
        return call_on_index_and_data_type<
127
228
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
228
            using Types2 = std::decay_t<decltype(types2)>;
129
228
            using FromDataType = typename Types2::LeftType;
130
228
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
228
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
228
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
228
                return false;
134
228
            }
135
228
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
228
                using FromFieldType = typename FromDataType::FieldType;
137
228
                using ToFieldType = typename ToDataType::FieldType;
138
228
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
228
                UInt32 from_scale = 0;
140
141
228
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
228
                    const auto* from_decimal_type =
143
228
                            check_and_get_data_type<FromDataType>(from_type.get());
144
228
                    from_precision =
145
228
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
228
                    from_scale = from_decimal_type->get_scale();
147
228
                }
148
149
228
                UInt32 to_max_digits = 0;
150
228
                UInt32 to_precision = 0;
151
228
                UInt32 to_scale = 0;
152
153
228
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
228
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
228
                    const auto* to_decimal_type =
157
228
                            check_and_get_data_type<ToDataType>(to_type.get());
158
228
                    to_precision = to_decimal_type->get_precision();
159
228
                    ToDataType::check_type_precision(to_precision);
160
161
228
                    to_scale = to_decimal_type->get_scale();
162
228
                    ToDataType::check_type_scale(to_scale);
163
228
                }
164
228
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
228
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
228
                    to_precision = to_max_digits;
167
228
                }
168
169
228
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
228
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
228
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
228
                if (to_scale > from_scale) {
174
228
                    multiply_may_overflow &=
175
228
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
228
                }
177
228
                return narrow_integral || multiply_may_overflow;
178
228
            }
179
228
            return false;
180
228
        });
181
228
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_
Line
Count
Source
117
15.9k
    auto make_default_wrapper = [&](const auto& types) -> bool {
118
15.9k
        using Types = std::decay_t<decltype(types)>;
119
15.9k
        using ToDataType = typename Types::LeftType;
120
121
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
122
                        IsDatelikeV2Types<ToDataType> ||
123
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
124
            return false;
125
        }
126
15.9k
        return call_on_index_and_data_type<
127
15.9k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
15.9k
            using Types2 = std::decay_t<decltype(types2)>;
129
15.9k
            using FromDataType = typename Types2::LeftType;
130
15.9k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
15.9k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
15.9k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
15.9k
                return false;
134
15.9k
            }
135
15.9k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
15.9k
                using FromFieldType = typename FromDataType::FieldType;
137
15.9k
                using ToFieldType = typename ToDataType::FieldType;
138
15.9k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
15.9k
                UInt32 from_scale = 0;
140
141
15.9k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
15.9k
                    const auto* from_decimal_type =
143
15.9k
                            check_and_get_data_type<FromDataType>(from_type.get());
144
15.9k
                    from_precision =
145
15.9k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
15.9k
                    from_scale = from_decimal_type->get_scale();
147
15.9k
                }
148
149
15.9k
                UInt32 to_max_digits = 0;
150
15.9k
                UInt32 to_precision = 0;
151
15.9k
                UInt32 to_scale = 0;
152
153
15.9k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
15.9k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
15.9k
                    const auto* to_decimal_type =
157
15.9k
                            check_and_get_data_type<ToDataType>(to_type.get());
158
15.9k
                    to_precision = to_decimal_type->get_precision();
159
15.9k
                    ToDataType::check_type_precision(to_precision);
160
161
15.9k
                    to_scale = to_decimal_type->get_scale();
162
15.9k
                    ToDataType::check_type_scale(to_scale);
163
15.9k
                }
164
15.9k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
15.9k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
15.9k
                    to_precision = to_max_digits;
167
15.9k
                }
168
169
15.9k
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
15.9k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
15.9k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
15.9k
                if (to_scale > from_scale) {
174
15.9k
                    multiply_may_overflow &=
175
15.9k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
15.9k
                }
177
15.9k
                return narrow_integral || multiply_may_overflow;
178
15.9k
            }
179
15.9k
            return false;
180
15.9k
        });
181
15.9k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_
Line
Count
Source
117
10.9k
    auto make_default_wrapper = [&](const auto& types) -> bool {
118
10.9k
        using Types = std::decay_t<decltype(types)>;
119
10.9k
        using ToDataType = typename Types::LeftType;
120
121
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
122
                        IsDatelikeV2Types<ToDataType> ||
123
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
124
            return false;
125
        }
126
10.9k
        return call_on_index_and_data_type<
127
10.9k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
10.9k
            using Types2 = std::decay_t<decltype(types2)>;
129
10.9k
            using FromDataType = typename Types2::LeftType;
130
10.9k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
10.9k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
10.9k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
10.9k
                return false;
134
10.9k
            }
135
10.9k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
10.9k
                using FromFieldType = typename FromDataType::FieldType;
137
10.9k
                using ToFieldType = typename ToDataType::FieldType;
138
10.9k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
10.9k
                UInt32 from_scale = 0;
140
141
10.9k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
10.9k
                    const auto* from_decimal_type =
143
10.9k
                            check_and_get_data_type<FromDataType>(from_type.get());
144
10.9k
                    from_precision =
145
10.9k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
10.9k
                    from_scale = from_decimal_type->get_scale();
147
10.9k
                }
148
149
10.9k
                UInt32 to_max_digits = 0;
150
10.9k
                UInt32 to_precision = 0;
151
10.9k
                UInt32 to_scale = 0;
152
153
10.9k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
10.9k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
10.9k
                    const auto* to_decimal_type =
157
10.9k
                            check_and_get_data_type<ToDataType>(to_type.get());
158
10.9k
                    to_precision = to_decimal_type->get_precision();
159
10.9k
                    ToDataType::check_type_precision(to_precision);
160
161
10.9k
                    to_scale = to_decimal_type->get_scale();
162
10.9k
                    ToDataType::check_type_scale(to_scale);
163
10.9k
                }
164
10.9k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
10.9k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
10.9k
                    to_precision = to_max_digits;
167
10.9k
                }
168
169
10.9k
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
10.9k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
10.9k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
10.9k
                if (to_scale > from_scale) {
174
10.9k
                    multiply_may_overflow &=
175
10.9k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
10.9k
                }
177
10.9k
                return narrow_integral || multiply_may_overflow;
178
10.9k
            }
179
10.9k
            return false;
180
10.9k
        });
181
10.9k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeDateEvEEEEbRKT_
Line
Count
Source
117
30
    auto make_default_wrapper = [&](const auto& types) -> bool {
118
30
        using Types = std::decay_t<decltype(types)>;
119
30
        using ToDataType = typename Types::LeftType;
120
121
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
122
                        IsDatelikeV2Types<ToDataType> ||
123
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
124
            return false;
125
        }
126
30
        return call_on_index_and_data_type<
127
30
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
30
            using Types2 = std::decay_t<decltype(types2)>;
129
30
            using FromDataType = typename Types2::LeftType;
130
30
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
30
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
30
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
30
                return false;
134
30
            }
135
30
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
30
                using FromFieldType = typename FromDataType::FieldType;
137
30
                using ToFieldType = typename ToDataType::FieldType;
138
30
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
30
                UInt32 from_scale = 0;
140
141
30
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
30
                    const auto* from_decimal_type =
143
30
                            check_and_get_data_type<FromDataType>(from_type.get());
144
30
                    from_precision =
145
30
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
30
                    from_scale = from_decimal_type->get_scale();
147
30
                }
148
149
30
                UInt32 to_max_digits = 0;
150
30
                UInt32 to_precision = 0;
151
30
                UInt32 to_scale = 0;
152
153
30
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
30
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
30
                    const auto* to_decimal_type =
157
30
                            check_and_get_data_type<ToDataType>(to_type.get());
158
30
                    to_precision = to_decimal_type->get_precision();
159
30
                    ToDataType::check_type_precision(to_precision);
160
161
30
                    to_scale = to_decimal_type->get_scale();
162
30
                    ToDataType::check_type_scale(to_scale);
163
30
                }
164
30
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
30
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
30
                    to_precision = to_max_digits;
167
30
                }
168
169
30
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
30
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
30
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
30
                if (to_scale > from_scale) {
174
30
                    multiply_may_overflow &=
175
30
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
30
                }
177
30
                return narrow_integral || multiply_may_overflow;
178
30
            }
179
30
            return false;
180
30
        });
181
30
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeDateV2EvEEEEbRKT_
Line
Count
Source
117
7.22k
    auto make_default_wrapper = [&](const auto& types) -> bool {
118
7.22k
        using Types = std::decay_t<decltype(types)>;
119
7.22k
        using ToDataType = typename Types::LeftType;
120
121
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
122
                        IsDatelikeV2Types<ToDataType> ||
123
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
124
            return false;
125
        }
126
7.22k
        return call_on_index_and_data_type<
127
7.22k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
7.22k
            using Types2 = std::decay_t<decltype(types2)>;
129
7.22k
            using FromDataType = typename Types2::LeftType;
130
7.22k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
7.22k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
7.22k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
7.22k
                return false;
134
7.22k
            }
135
7.22k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
7.22k
                using FromFieldType = typename FromDataType::FieldType;
137
7.22k
                using ToFieldType = typename ToDataType::FieldType;
138
7.22k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
7.22k
                UInt32 from_scale = 0;
140
141
7.22k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
7.22k
                    const auto* from_decimal_type =
143
7.22k
                            check_and_get_data_type<FromDataType>(from_type.get());
144
7.22k
                    from_precision =
145
7.22k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
7.22k
                    from_scale = from_decimal_type->get_scale();
147
7.22k
                }
148
149
7.22k
                UInt32 to_max_digits = 0;
150
7.22k
                UInt32 to_precision = 0;
151
7.22k
                UInt32 to_scale = 0;
152
153
7.22k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
7.22k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
7.22k
                    const auto* to_decimal_type =
157
7.22k
                            check_and_get_data_type<ToDataType>(to_type.get());
158
7.22k
                    to_precision = to_decimal_type->get_precision();
159
7.22k
                    ToDataType::check_type_precision(to_precision);
160
161
7.22k
                    to_scale = to_decimal_type->get_scale();
162
7.22k
                    ToDataType::check_type_scale(to_scale);
163
7.22k
                }
164
7.22k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
7.22k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
7.22k
                    to_precision = to_max_digits;
167
7.22k
                }
168
169
7.22k
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
7.22k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
7.22k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
7.22k
                if (to_scale > from_scale) {
174
7.22k
                    multiply_may_overflow &=
175
7.22k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
7.22k
                }
177
7.22k
                return narrow_integral || multiply_may_overflow;
178
7.22k
            }
179
7.22k
            return false;
180
7.22k
        });
181
7.22k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_
Line
Count
Source
117
4.72k
    auto make_default_wrapper = [&](const auto& types) -> bool {
118
4.72k
        using Types = std::decay_t<decltype(types)>;
119
4.72k
        using ToDataType = typename Types::LeftType;
120
121
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
122
                        IsDatelikeV2Types<ToDataType> ||
123
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
124
            return false;
125
        }
126
4.72k
        return call_on_index_and_data_type<
127
4.72k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
4.72k
            using Types2 = std::decay_t<decltype(types2)>;
129
4.72k
            using FromDataType = typename Types2::LeftType;
130
4.72k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
4.72k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
4.72k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
4.72k
                return false;
134
4.72k
            }
135
4.72k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
4.72k
                using FromFieldType = typename FromDataType::FieldType;
137
4.72k
                using ToFieldType = typename ToDataType::FieldType;
138
4.72k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
4.72k
                UInt32 from_scale = 0;
140
141
4.72k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
4.72k
                    const auto* from_decimal_type =
143
4.72k
                            check_and_get_data_type<FromDataType>(from_type.get());
144
4.72k
                    from_precision =
145
4.72k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
4.72k
                    from_scale = from_decimal_type->get_scale();
147
4.72k
                }
148
149
4.72k
                UInt32 to_max_digits = 0;
150
4.72k
                UInt32 to_precision = 0;
151
4.72k
                UInt32 to_scale = 0;
152
153
4.72k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
4.72k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
4.72k
                    const auto* to_decimal_type =
157
4.72k
                            check_and_get_data_type<ToDataType>(to_type.get());
158
4.72k
                    to_precision = to_decimal_type->get_precision();
159
4.72k
                    ToDataType::check_type_precision(to_precision);
160
161
4.72k
                    to_scale = to_decimal_type->get_scale();
162
4.72k
                    ToDataType::check_type_scale(to_scale);
163
4.72k
                }
164
4.72k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
4.72k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
4.72k
                    to_precision = to_max_digits;
167
4.72k
                }
168
169
4.72k
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
4.72k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
4.72k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
4.72k
                if (to_scale > from_scale) {
174
4.72k
                    multiply_may_overflow &=
175
4.72k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
4.72k
                }
177
4.72k
                return narrow_integral || multiply_may_overflow;
178
4.72k
            }
179
4.72k
            return false;
180
4.72k
        });
181
4.72k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_16DataTypeDateTimeEvEEEEbRKT_
Line
Count
Source
117
25
    auto make_default_wrapper = [&](const auto& types) -> bool {
118
25
        using Types = std::decay_t<decltype(types)>;
119
25
        using ToDataType = typename Types::LeftType;
120
121
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
122
                        IsDatelikeV2Types<ToDataType> ||
123
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
124
            return false;
125
        }
126
25
        return call_on_index_and_data_type<
127
25
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
25
            using Types2 = std::decay_t<decltype(types2)>;
129
25
            using FromDataType = typename Types2::LeftType;
130
25
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
25
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
25
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
25
                return false;
134
25
            }
135
25
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
25
                using FromFieldType = typename FromDataType::FieldType;
137
25
                using ToFieldType = typename ToDataType::FieldType;
138
25
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
25
                UInt32 from_scale = 0;
140
141
25
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
25
                    const auto* from_decimal_type =
143
25
                            check_and_get_data_type<FromDataType>(from_type.get());
144
25
                    from_precision =
145
25
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
25
                    from_scale = from_decimal_type->get_scale();
147
25
                }
148
149
25
                UInt32 to_max_digits = 0;
150
25
                UInt32 to_precision = 0;
151
25
                UInt32 to_scale = 0;
152
153
25
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
25
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
25
                    const auto* to_decimal_type =
157
25
                            check_and_get_data_type<ToDataType>(to_type.get());
158
25
                    to_precision = to_decimal_type->get_precision();
159
25
                    ToDataType::check_type_precision(to_precision);
160
161
25
                    to_scale = to_decimal_type->get_scale();
162
25
                    ToDataType::check_type_scale(to_scale);
163
25
                }
164
25
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
25
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
25
                    to_precision = to_max_digits;
167
25
                }
168
169
25
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
25
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
25
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
25
                if (to_scale > from_scale) {
174
25
                    multiply_may_overflow &=
175
25
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
25
                }
177
25
                return narrow_integral || multiply_may_overflow;
178
25
            }
179
25
            return false;
180
25
        });
181
25
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeTimeV2EvEEEEbRKT_
Line
Count
Source
117
460
    auto make_default_wrapper = [&](const auto& types) -> bool {
118
460
        using Types = std::decay_t<decltype(types)>;
119
460
        using ToDataType = typename Types::LeftType;
120
121
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
122
                        IsDatelikeV2Types<ToDataType> ||
123
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
124
            return false;
125
        }
126
460
        return call_on_index_and_data_type<
127
460
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
460
            using Types2 = std::decay_t<decltype(types2)>;
129
460
            using FromDataType = typename Types2::LeftType;
130
460
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
460
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
460
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
460
                return false;
134
460
            }
135
460
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
460
                using FromFieldType = typename FromDataType::FieldType;
137
460
                using ToFieldType = typename ToDataType::FieldType;
138
460
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
460
                UInt32 from_scale = 0;
140
141
460
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
460
                    const auto* from_decimal_type =
143
460
                            check_and_get_data_type<FromDataType>(from_type.get());
144
460
                    from_precision =
145
460
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
460
                    from_scale = from_decimal_type->get_scale();
147
460
                }
148
149
460
                UInt32 to_max_digits = 0;
150
460
                UInt32 to_precision = 0;
151
460
                UInt32 to_scale = 0;
152
153
460
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
460
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
460
                    const auto* to_decimal_type =
157
460
                            check_and_get_data_type<ToDataType>(to_type.get());
158
460
                    to_precision = to_decimal_type->get_precision();
159
460
                    ToDataType::check_type_precision(to_precision);
160
161
460
                    to_scale = to_decimal_type->get_scale();
162
460
                    ToDataType::check_type_scale(to_scale);
163
460
                }
164
460
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
460
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
460
                    to_precision = to_max_digits;
167
460
                }
168
169
460
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
460
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
460
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
460
                if (to_scale > from_scale) {
174
460
                    multiply_may_overflow &=
175
460
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
460
                }
177
460
                return narrow_integral || multiply_may_overflow;
178
460
            }
179
460
            return false;
180
460
        });
181
460
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_19DataTypeTimeStampTzEvEEEEbRKT_
Line
Count
Source
117
462
    auto make_default_wrapper = [&](const auto& types) -> bool {
118
462
        using Types = std::decay_t<decltype(types)>;
119
462
        using ToDataType = typename Types::LeftType;
120
121
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
122
                        IsDatelikeV2Types<ToDataType> ||
123
462
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
124
462
            return false;
125
462
        }
126
0
        return call_on_index_and_data_type<
127
462
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
462
            using Types2 = std::decay_t<decltype(types2)>;
129
462
            using FromDataType = typename Types2::LeftType;
130
462
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
462
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
462
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
462
                return false;
134
462
            }
135
462
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
462
                using FromFieldType = typename FromDataType::FieldType;
137
462
                using ToFieldType = typename ToDataType::FieldType;
138
462
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
462
                UInt32 from_scale = 0;
140
141
462
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
462
                    const auto* from_decimal_type =
143
462
                            check_and_get_data_type<FromDataType>(from_type.get());
144
462
                    from_precision =
145
462
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
462
                    from_scale = from_decimal_type->get_scale();
147
462
                }
148
149
462
                UInt32 to_max_digits = 0;
150
462
                UInt32 to_precision = 0;
151
462
                UInt32 to_scale = 0;
152
153
462
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
462
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
462
                    const auto* to_decimal_type =
157
462
                            check_and_get_data_type<ToDataType>(to_type.get());
158
462
                    to_precision = to_decimal_type->get_precision();
159
462
                    ToDataType::check_type_precision(to_precision);
160
161
462
                    to_scale = to_decimal_type->get_scale();
162
462
                    ToDataType::check_type_scale(to_scale);
163
462
                }
164
462
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
462
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
462
                    to_precision = to_max_digits;
167
462
                }
168
169
462
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
462
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
462
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
462
                if (to_scale > from_scale) {
174
462
                    multiply_may_overflow &=
175
462
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
462
                }
177
462
                return narrow_integral || multiply_may_overflow;
178
462
            }
179
462
            return false;
180
462
        });
181
462
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv4EvEEEEbRKT_
Line
Count
Source
117
626
    auto make_default_wrapper = [&](const auto& types) -> bool {
118
626
        using Types = std::decay_t<decltype(types)>;
119
626
        using ToDataType = typename Types::LeftType;
120
121
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
122
                        IsDatelikeV2Types<ToDataType> ||
123
626
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
124
626
            return false;
125
626
        }
126
0
        return call_on_index_and_data_type<
127
626
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
626
            using Types2 = std::decay_t<decltype(types2)>;
129
626
            using FromDataType = typename Types2::LeftType;
130
626
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
626
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
626
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
626
                return false;
134
626
            }
135
626
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
626
                using FromFieldType = typename FromDataType::FieldType;
137
626
                using ToFieldType = typename ToDataType::FieldType;
138
626
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
626
                UInt32 from_scale = 0;
140
141
626
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
626
                    const auto* from_decimal_type =
143
626
                            check_and_get_data_type<FromDataType>(from_type.get());
144
626
                    from_precision =
145
626
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
626
                    from_scale = from_decimal_type->get_scale();
147
626
                }
148
149
626
                UInt32 to_max_digits = 0;
150
626
                UInt32 to_precision = 0;
151
626
                UInt32 to_scale = 0;
152
153
626
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
626
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
626
                    const auto* to_decimal_type =
157
626
                            check_and_get_data_type<ToDataType>(to_type.get());
158
626
                    to_precision = to_decimal_type->get_precision();
159
626
                    ToDataType::check_type_precision(to_precision);
160
161
626
                    to_scale = to_decimal_type->get_scale();
162
626
                    ToDataType::check_type_scale(to_scale);
163
626
                }
164
626
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
626
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
626
                    to_precision = to_max_digits;
167
626
                }
168
169
626
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
626
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
626
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
626
                if (to_scale > from_scale) {
174
626
                    multiply_may_overflow &=
175
626
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
626
                }
177
626
                return narrow_integral || multiply_may_overflow;
178
626
            }
179
626
            return false;
180
626
        });
181
626
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv6EvEEEEbRKT_
Line
Count
Source
117
290
    auto make_default_wrapper = [&](const auto& types) -> bool {
118
290
        using Types = std::decay_t<decltype(types)>;
119
290
        using ToDataType = typename Types::LeftType;
120
121
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
122
                        IsDatelikeV2Types<ToDataType> ||
123
290
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
124
290
            return false;
125
290
        }
126
0
        return call_on_index_and_data_type<
127
290
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
290
            using Types2 = std::decay_t<decltype(types2)>;
129
290
            using FromDataType = typename Types2::LeftType;
130
290
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
290
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
290
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
290
                return false;
134
290
            }
135
290
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
290
                using FromFieldType = typename FromDataType::FieldType;
137
290
                using ToFieldType = typename ToDataType::FieldType;
138
290
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
290
                UInt32 from_scale = 0;
140
141
290
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
290
                    const auto* from_decimal_type =
143
290
                            check_and_get_data_type<FromDataType>(from_type.get());
144
290
                    from_precision =
145
290
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
290
                    from_scale = from_decimal_type->get_scale();
147
290
                }
148
149
290
                UInt32 to_max_digits = 0;
150
290
                UInt32 to_precision = 0;
151
290
                UInt32 to_scale = 0;
152
153
290
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
290
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
290
                    const auto* to_decimal_type =
157
290
                            check_and_get_data_type<ToDataType>(to_type.get());
158
290
                    to_precision = to_decimal_type->get_precision();
159
290
                    ToDataType::check_type_precision(to_precision);
160
161
290
                    to_scale = to_decimal_type->get_scale();
162
290
                    ToDataType::check_type_scale(to_scale);
163
290
                }
164
290
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
290
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
290
                    to_precision = to_max_digits;
167
290
                }
168
169
290
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
290
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
290
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
290
                if (to_scale > from_scale) {
174
290
                    multiply_may_overflow &=
175
290
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
290
                }
177
290
                return narrow_integral || multiply_may_overflow;
178
290
            }
179
290
            return false;
180
290
        });
181
290
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeStringEvEEEEbRKT_
Line
Count
Source
117
36.7k
    auto make_default_wrapper = [&](const auto& types) -> bool {
118
36.7k
        using Types = std::decay_t<decltype(types)>;
119
36.7k
        using ToDataType = typename Types::LeftType;
120
121
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
122
                        IsDatelikeV2Types<ToDataType> ||
123
36.7k
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
124
36.7k
            return false;
125
36.7k
        }
126
0
        return call_on_index_and_data_type<
127
36.7k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
36.7k
            using Types2 = std::decay_t<decltype(types2)>;
129
36.7k
            using FromDataType = typename Types2::LeftType;
130
36.7k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
36.7k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
36.7k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
36.7k
                return false;
134
36.7k
            }
135
36.7k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
36.7k
                using FromFieldType = typename FromDataType::FieldType;
137
36.7k
                using ToFieldType = typename ToDataType::FieldType;
138
36.7k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
36.7k
                UInt32 from_scale = 0;
140
141
36.7k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
36.7k
                    const auto* from_decimal_type =
143
36.7k
                            check_and_get_data_type<FromDataType>(from_type.get());
144
36.7k
                    from_precision =
145
36.7k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
36.7k
                    from_scale = from_decimal_type->get_scale();
147
36.7k
                }
148
149
36.7k
                UInt32 to_max_digits = 0;
150
36.7k
                UInt32 to_precision = 0;
151
36.7k
                UInt32 to_scale = 0;
152
153
36.7k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
36.7k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
36.7k
                    const auto* to_decimal_type =
157
36.7k
                            check_and_get_data_type<ToDataType>(to_type.get());
158
36.7k
                    to_precision = to_decimal_type->get_precision();
159
36.7k
                    ToDataType::check_type_precision(to_precision);
160
161
36.7k
                    to_scale = to_decimal_type->get_scale();
162
36.7k
                    ToDataType::check_type_scale(to_scale);
163
36.7k
                }
164
36.7k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
36.7k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
36.7k
                    to_precision = to_max_digits;
167
36.7k
                }
168
169
36.7k
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
36.7k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
36.7k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
36.7k
                if (to_scale > from_scale) {
174
36.7k
                    multiply_may_overflow &=
175
36.7k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
36.7k
                }
177
36.7k
                return narrow_integral || multiply_may_overflow;
178
36.7k
            }
179
36.7k
            return false;
180
36.7k
        });
181
36.7k
    };
182
183
320k
    return call_on_index_and_data_type<void>(to_type->get_primitive_type(), make_default_wrapper);
184
391k
}
185
186
WrapperType prepare_remove_nullable(FunctionContext* context, const DataTypePtr& from_type,
187
419k
                                    const DataTypePtr& to_type) {
188
    /// Determine whether pre-processing and/or post-processing must take place during conversion.
189
419k
    bool result_is_nullable = to_type->is_nullable();
190
191
419k
    if (result_is_nullable) {
192
391k
        return [from_type, to_type](FunctionContext* context, Block& block,
193
391k
                                    const ColumnNumbers& arguments, uint32_t result,
194
391k
                                    size_t input_rows_count,
195
391k
                                    const NullMap::value_type* null_map = nullptr) {
196
391k
            auto from_type_not_nullable = remove_nullable(from_type);
197
391k
            auto to_type_not_nullable = remove_nullable(to_type);
198
199
391k
            bool replace_null_data_to_default = need_replace_null_data_to_default(
200
391k
                    context, from_type_not_nullable, to_type_not_nullable);
201
202
391k
            auto nested_result_index = block.columns();
203
391k
            block.insert(block.get_by_position(result).unnest_nullable());
204
391k
            auto nested_source_index = block.columns();
205
391k
            block.insert(block.get_by_position(arguments[0])
206
391k
                                 .unnest_nullable(replace_null_data_to_default));
207
208
391k
            const auto& arg_col = block.get_by_position(arguments[0]);
209
391k
            const NullMap::value_type* arg_null_map = nullptr;
210
391k
            if (const auto* nullable = check_and_get_column<ColumnNullable>(*arg_col.column)) {
211
337k
                arg_null_map = nullable->get_null_map_data().data();
212
337k
            }
213
391k
            RETURN_IF_ERROR(prepare_impl(context, from_type_not_nullable, to_type_not_nullable)(
214
391k
                    context, block, {nested_source_index}, nested_result_index, input_rows_count,
215
391k
                    arg_null_map));
216
217
365k
            block.get_by_position(result).column =
218
365k
                    wrap_in_nullable(block.get_by_position(nested_result_index).column, block,
219
365k
                                     arguments, input_rows_count);
220
221
365k
            block.erase(nested_source_index);
222
365k
            block.erase(nested_result_index);
223
365k
            return Status::OK();
224
391k
        };
225
391k
    } else {
226
28.9k
        return prepare_impl(context, from_type, to_type);
227
28.9k
    }
228
419k
}
229
230
/// 'from_type' and 'to_type' are nested types in case of Nullable.
231
/// 'requested_result_is_nullable' is true if CAST to Nullable type is requested.
232
WrapperType prepare_impl(FunctionContext* context, const DataTypePtr& origin_from_type,
233
435k
                         const DataTypePtr& origin_to_type) {
234
435k
    auto to_type = get_serialized_type(origin_to_type);
235
435k
    auto from_type = get_serialized_type(origin_from_type);
236
435k
    if (from_type->equals(*to_type)) {
237
75.1k
        return create_identity_wrapper(from_type);
238
75.1k
    }
239
240
    // variant needs to be judged first
241
360k
    if (to_type->get_primitive_type() == PrimitiveType::TYPE_VARIANT) {
242
11.7k
        return create_cast_to_variant_wrapper(from_type,
243
11.7k
                                              static_cast<const DataTypeVariant&>(*to_type));
244
11.7k
    }
245
348k
    if (from_type->get_primitive_type() == PrimitiveType::TYPE_VARIANT) {
246
17.4k
        return create_cast_from_variant_wrapper(static_cast<const DataTypeVariant&>(*from_type),
247
17.4k
                                                to_type);
248
17.4k
    }
249
250
331k
    if (from_type->get_primitive_type() == PrimitiveType::TYPE_JSONB) {
251
9.29k
        return create_cast_from_jsonb_wrapper(static_cast<const DataTypeJsonb&>(*from_type),
252
9.29k
                                              to_type,
253
18.4E
                                              context ? context->jsonb_string_as_string() : false);
254
9.29k
    }
255
256
321k
    switch (to_type->get_primitive_type()) {
257
1.05k
    case PrimitiveType::TYPE_BOOLEAN:
258
1.05k
        return create_boolean_wrapper(context, from_type);
259
5.09k
    case PrimitiveType::TYPE_TINYINT:
260
5.09k
        return create_int_wrapper<DataTypeInt8>(context, from_type);
261
5.67k
    case PrimitiveType::TYPE_SMALLINT:
262
5.67k
        return create_int_wrapper<DataTypeInt16>(context, from_type);
263
33.9k
    case PrimitiveType::TYPE_INT:
264
33.9k
        return create_int_wrapper<DataTypeInt32>(context, from_type);
265
45.4k
    case PrimitiveType::TYPE_BIGINT:
266
45.4k
        return create_int_wrapper<DataTypeInt64>(context, from_type);
267
4.85k
    case PrimitiveType::TYPE_LARGEINT:
268
4.85k
        return create_int_wrapper<DataTypeInt128>(context, from_type);
269
10.9k
    case PrimitiveType::TYPE_FLOAT:
270
10.9k
        return create_float_wrapper<DataTypeFloat32>(context, from_type);
271
30.8k
    case PrimitiveType::TYPE_DOUBLE:
272
30.8k
        return create_float_wrapper<DataTypeFloat64>(context, from_type);
273
30
    case PrimitiveType::TYPE_DATE:
274
30
        return create_datelike_wrapper<DataTypeDate>(context, from_type);
275
25
    case PrimitiveType::TYPE_DATETIME:
276
25
        return create_datelike_wrapper<DataTypeDateTime>(context, from_type);
277
7.18k
    case PrimitiveType::TYPE_DATEV2:
278
7.18k
        return create_datelike_wrapper<DataTypeDateV2>(context, from_type);
279
5.10k
    case PrimitiveType::TYPE_DATETIMEV2:
280
5.10k
        return create_datelike_wrapper<DataTypeDateTimeV2>(context, from_type);
281
462
    case PrimitiveType::TYPE_TIMESTAMPTZ:
282
462
        return create_timestamptz_wrapper(context, from_type);
283
460
    case PrimitiveType::TYPE_TIMEV2:
284
460
        return create_datelike_wrapper<DataTypeTimeV2>(context, from_type);
285
481
    case PrimitiveType::TYPE_IPV4:
286
481
        return create_ip_wrapper<DataTypeIPv4>(context, from_type);
287
290
    case PrimitiveType::TYPE_IPV6:
288
290
        return create_ip_wrapper<DataTypeIPv6>(context, from_type);
289
290
    case PrimitiveType::TYPE_DECIMALV2:
290
290
        return create_decimal_wrapper<DataTypeDecimalV2>(context, from_type);
291
8.06k
    case PrimitiveType::TYPE_DECIMAL32:
292
8.06k
        return create_decimal_wrapper<DataTypeDecimal32>(context, from_type);
293
18.5k
    case PrimitiveType::TYPE_DECIMAL64:
294
18.5k
        return create_decimal_wrapper<DataTypeDecimal64>(context, from_type);
295
18.6k
    case PrimitiveType::TYPE_DECIMAL128I:
296
18.6k
        return create_decimal_wrapper<DataTypeDecimal128>(context, from_type);
297
10.9k
    case PrimitiveType::TYPE_DECIMAL256:
298
10.9k
        return create_decimal_wrapper<DataTypeDecimal256>(context, from_type);
299
34
    case PrimitiveType::TYPE_CHAR:
300
6.76k
    case PrimitiveType::TYPE_VARCHAR:
301
33.9k
    case PrimitiveType::TYPE_STRING:
302
33.9k
        return create_string_wrapper(from_type);
303
14.7k
    case PrimitiveType::TYPE_ARRAY:
304
14.7k
        return create_array_wrapper(context, from_type,
305
14.7k
                                    static_cast<const DataTypeArray&>(*to_type));
306
3.11k
    case PrimitiveType::TYPE_STRUCT:
307
3.11k
        return create_struct_wrapper(context, from_type,
308
3.11k
                                     static_cast<const DataTypeStruct&>(*to_type));
309
2.55k
    case PrimitiveType::TYPE_MAP:
310
2.55k
        return create_map_wrapper(context, from_type, static_cast<const DataTypeMap&>(*to_type));
311
6
    case PrimitiveType::TYPE_HLL:
312
6
        return create_hll_wrapper(context, from_type, static_cast<const DataTypeHLL&>(*to_type));
313
5
    case PrimitiveType::TYPE_BITMAP:
314
5
        return create_bitmap_wrapper(context, from_type,
315
5
                                     static_cast<const DataTypeBitMap&>(*to_type));
316
2
    case PrimitiveType::TYPE_QUANTILE_STATE:
317
2
        return create_quantile_state_wrapper(context, from_type,
318
2
                                             static_cast<const DataTypeQuantileState&>(*to_type));
319
59.1k
    case PrimitiveType::TYPE_JSONB:
320
59.1k
        return create_cast_to_jsonb_wrapper(from_type, static_cast<const DataTypeJsonb&>(*to_type),
321
59.1k
                                            context ? context->string_as_jsonb_string() : false);
322
2
    case PrimitiveType::TYPE_VARBINARY:
323
2
        return create_varbinary_wrapper(from_type);
324
0
    default:
325
0
        break;
326
321k
    }
327
328
0
    return create_unsupport_wrapper(from_type->get_name(), to_type->get_name());
329
321k
}
330
331
} // namespace CastWrapper
332
333
class PreparedFunctionCast : public PreparedFunctionImpl {
334
public:
335
    explicit PreparedFunctionCast(CastWrapper::WrapperType&& wrapper_function_, const char* name_)
336
405k
            : 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
404k
                        uint32_t result, size_t input_rows_count) const override {
343
404k
        return wrapper_function(context, block, arguments, result, input_rows_count, nullptr);
344
404k
    }
345
346
405k
    bool use_default_implementation_for_nulls() const override { return false; }
347
404k
    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
308k
            : name(name_),
358
308k
              argument_types(std::move(argument_types_)),
359
308k
              return_type(std::move(return_type_)) {}
360
361
405k
    const DataTypes& get_argument_types() const override { return argument_types; }
362
405k
    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
405k
                                uint32_t /*result*/) const override {
367
405k
        return std::make_shared<PreparedFunctionCast>(
368
405k
                CastWrapper::prepare_unpack_dictionaries(context, get_argument_types()[0],
369
405k
                                                         get_return_type()),
370
405k
                name);
371
405k
    }
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
308k
    static FunctionBuilderPtr create() { return std::make_shared<FunctionBuilderCast>(); }
388
389
308k
    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
308k
                               const DataTypePtr& return_type) const override {
400
308k
        DataTypes data_types(arguments.size());
401
402
925k
        for (size_t i = 0; i < arguments.size(); ++i) {
403
616k
            data_types[i] = arguments[i].type;
404
616k
        }
405
406
308k
        return std::make_shared<FunctionCast>(name, data_types, return_type);
407
308k
    }
408
409
308k
    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
8
void register_function_cast(SimpleFunctionFactory& factory) {
418
8
    factory.register_function<FunctionBuilderCast>();
419
8
}
420
} // namespace doris