Coverage Report

Created: 2026-03-19 12:20

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
0
                               const DataTypeHLL& to_type) {
46
    /// Conversion from String through parsing.
47
0
    if (check_and_get_data_type<DataTypeString>(from_type_untyped.get())) {
48
0
        return cast_from_string_to_generic;
49
0
    }
50
51
0
    return CastWrapper::create_unsupport_wrapper("Cast to HLL only support from String type");
52
0
}
53
54
WrapperType create_bitmap_wrapper(FunctionContext* context, const DataTypePtr& from_type_untyped,
55
1
                                  const DataTypeBitMap& to_type) {
56
    /// Conversion from String through parsing.
57
1
    if (check_and_get_data_type<DataTypeString>(from_type_untyped.get())) {
58
1
        return cast_from_string_to_generic;
59
1
    }
60
61
0
    return CastWrapper::create_unsupport_wrapper("Cast to BitMap only support from String type");
62
1
}
63
64
WrapperType create_quantile_state_wrapper(FunctionContext* context,
65
                                          const DataTypePtr& from_type_untyped,
66
0
                                          const DataTypeQuantileState& to_type) {
67
    /// Conversion from String through parsing.
68
0
    if (check_and_get_data_type<DataTypeString>(from_type_untyped.get())) {
69
0
        return cast_from_string_to_generic;
70
0
    }
71
72
0
    return CastWrapper::create_unsupport_wrapper(
73
0
            "Cast to QuantileState only support from String type");
74
0
}
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
381k
                                        const DataTypePtr& to_type) {
87
381k
    const auto& from_nested = from_type;
88
381k
    const auto& to_nested = to_type;
89
90
381k
    if (from_type->is_null_literal()) {
91
1.23k
        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
1.23k
        return [](FunctionContext* context, Block& block, const ColumnNumbers&, uint32_t result,
97
1.23k
                  size_t input_rows_count, const NullMap::value_type* null_map = nullptr) {
98
            /// TODO: remove this in the future.
99
1.23k
            auto& res = block.get_by_position(result);
100
1.23k
            res.column = res.type->create_column_const_with_default_value(input_rows_count)
101
1.23k
                                 ->convert_to_full_column_if_const();
102
1.23k
            return Status::OK();
103
1.23k
        };
104
1.23k
    }
105
106
380k
    auto wrapper = prepare_remove_nullable(context, from_nested, to_nested);
107
108
380k
    return wrapper;
109
381k
}
110
111
bool need_replace_null_data_to_default(FunctionContext* context, const DataTypePtr& from_type,
112
356k
                                       const DataTypePtr& to_type) {
113
356k
    if (from_type->equals(*to_type)) {
114
63.8k
        return false;
115
63.8k
    }
116
117
293k
    auto make_default_wrapper = [&](const auto& types) -> bool {
118
207k
        using Types = std::decay_t<decltype(types)>;
119
207k
        using ToDataType = typename Types::LeftType;
120
121
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
122
                        IsDatelikeV2Types<ToDataType> ||
123
33.1k
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
124
33.1k
            return false;
125
33.1k
        }
126
0
        return call_on_index_and_data_type<
127
207k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
156k
            using Types2 = std::decay_t<decltype(types2)>;
129
156k
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
83.3k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
83.3k
                return false;
134
83.3k
            }
135
49.3k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
49.3k
                using FromFieldType = typename FromDataType::FieldType;
137
49.3k
                using ToFieldType = typename ToDataType::FieldType;
138
49.3k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
49.3k
                UInt32 from_scale = 0;
140
141
49.3k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
19.0k
                    const auto* from_decimal_type =
143
19.0k
                            check_and_get_data_type<FromDataType>(from_type.get());
144
19.0k
                    from_precision =
145
19.0k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
19.0k
                    from_scale = from_decimal_type->get_scale();
147
19.0k
                }
148
149
49.3k
                UInt32 to_max_digits = 0;
150
49.3k
                UInt32 to_precision = 0;
151
49.3k
                UInt32 to_scale = 0;
152
153
49.3k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
43.1k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
43.1k
                    const auto* to_decimal_type =
157
43.1k
                            check_and_get_data_type<ToDataType>(to_type.get());
158
43.1k
                    to_precision = to_decimal_type->get_precision();
159
43.1k
                    ToDataType::check_type_precision(to_precision);
160
161
43.1k
                    to_scale = to_decimal_type->get_scale();
162
43.1k
                    ToDataType::check_type_scale(to_scale);
163
43.1k
                }
164
49.3k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
6.08k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
6.08k
                    to_precision = to_max_digits;
167
6.08k
                }
168
169
49.3k
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
49.3k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
49.3k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
49.3k
                if (to_scale > from_scale) {
174
12.0k
                    multiply_may_overflow &=
175
12.0k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
12.0k
                }
177
49.3k
                return narrow_integral || multiply_may_overflow;
178
49.3k
            }
179
0
            return false;
180
156k
        });
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
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
        });
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
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
            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
32
            return false;
180
32
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE2EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_6EEESE_EEEEbSI_
Line
Count
Source
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
748
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
748
            using Types2 = std::decay_t<decltype(types2)>;
129
748
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
748
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
748
                return false;
134
748
            }
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
748
            return false;
180
748
        });
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
302
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
302
            using Types2 = std::decay_t<decltype(types2)>;
129
302
            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
302
            return false;
180
302
        });
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
127
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
127
            using Types2 = std::decay_t<decltype(types2)>;
129
127
            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
127
            return false;
180
127
        });
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
233
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
233
            using Types2 = std::decay_t<decltype(types2)>;
129
233
            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
233
            return false;
180
233
        });
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
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_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
2.58k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
2.58k
            using Types2 = std::decay_t<decltype(types2)>;
129
2.58k
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
2.58k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
2.58k
                return false;
134
2.58k
            }
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.58k
            return false;
180
2.58k
        });
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
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
            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
54
            return false;
180
54
        });
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.24k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
2.24k
            using Types2 = std::decay_t<decltype(types2)>;
129
2.24k
            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.24k
            return false;
180
2.24k
        });
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
129
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
129
            using Types2 = std::decay_t<decltype(types2)>;
129
129
            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
129
            return false;
180
129
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_6EEESE_EEEEbSI_
Line
Count
Source
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
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_13PrimitiveTypeE4EEEvEEEEbRKT_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_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.41k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
2.41k
            using Types2 = std::decay_t<decltype(types2)>;
129
2.41k
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
2.41k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
2.41k
                return false;
134
2.41k
            }
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.41k
            return false;
180
2.41k
        });
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
1.53k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
1.53k
            using Types2 = std::decay_t<decltype(types2)>;
129
1.53k
            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.53k
            return false;
180
1.53k
        });
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
374
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
374
            using Types2 = std::decay_t<decltype(types2)>;
129
374
            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
374
            return false;
180
374
        });
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.49k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
1.49k
            using Types2 = std::decay_t<decltype(types2)>;
129
1.49k
            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.49k
            return false;
180
1.49k
        });
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
95
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
95
            using Types2 = std::decay_t<decltype(types2)>;
129
95
            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
95
            return false;
180
95
        });
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
37
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
37
            using Types2 = std::decay_t<decltype(types2)>;
129
37
            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
37
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
37
                using FromFieldType = typename FromDataType::FieldType;
137
37
                using ToFieldType = typename ToDataType::FieldType;
138
37
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
37
                UInt32 from_scale = 0;
140
141
37
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
37
                    const auto* from_decimal_type =
143
37
                            check_and_get_data_type<FromDataType>(from_type.get());
144
37
                    from_precision =
145
37
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
37
                    from_scale = from_decimal_type->get_scale();
147
37
                }
148
149
37
                UInt32 to_max_digits = 0;
150
37
                UInt32 to_precision = 0;
151
37
                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
37
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
37
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
37
                    to_precision = to_max_digits;
167
37
                }
168
169
37
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
37
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
37
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
37
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
37
                return narrow_integral || multiply_may_overflow;
178
37
            }
179
0
            return false;
180
37
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_20EEESE_EEEEbSI_
Line
Count
Source
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
249
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
249
            using Types2 = std::decay_t<decltype(types2)>;
129
249
            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
249
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
249
                using FromFieldType = typename FromDataType::FieldType;
137
249
                using ToFieldType = typename ToDataType::FieldType;
138
249
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
249
                UInt32 from_scale = 0;
140
141
249
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
249
                    const auto* from_decimal_type =
143
249
                            check_and_get_data_type<FromDataType>(from_type.get());
144
249
                    from_precision =
145
249
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
249
                    from_scale = from_decimal_type->get_scale();
147
249
                }
148
149
249
                UInt32 to_max_digits = 0;
150
249
                UInt32 to_precision = 0;
151
249
                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
249
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
249
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
249
                    to_precision = to_max_digits;
167
249
                }
168
169
249
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
249
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
249
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
249
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
249
                return narrow_integral || multiply_may_overflow;
178
249
            }
179
0
            return false;
180
249
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_35EEESE_EEEEbSI_
Line
Count
Source
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
17.7k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
17.7k
            using Types2 = std::decay_t<decltype(types2)>;
129
17.7k
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
17.7k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
17.7k
                return false;
134
17.7k
            }
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
17.7k
            return false;
180
17.7k
        });
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
326
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
326
            using Types2 = std::decay_t<decltype(types2)>;
129
326
            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
326
            return false;
180
326
        });
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.00k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
1.00k
            using Types2 = std::decay_t<decltype(types2)>;
129
1.00k
            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.00k
            return false;
180
1.00k
        });
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
666
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
666
            using Types2 = std::decay_t<decltype(types2)>;
129
666
            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
666
            return false;
180
666
        });
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
5.35k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
5.35k
            using Types2 = std::decay_t<decltype(types2)>;
129
5.35k
            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
5.35k
            return false;
180
5.35k
        });
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
312
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
312
            using Types2 = std::decay_t<decltype(types2)>;
129
312
            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
312
            return false;
180
312
        });
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
639
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
639
            using Types2 = std::decay_t<decltype(types2)>;
129
639
            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
639
            return false;
180
639
        });
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
311
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
311
            using Types2 = std::decay_t<decltype(types2)>;
129
311
            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
311
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
311
                using FromFieldType = typename FromDataType::FieldType;
137
311
                using ToFieldType = typename ToDataType::FieldType;
138
311
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
311
                UInt32 from_scale = 0;
140
141
311
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
311
                    const auto* from_decimal_type =
143
311
                            check_and_get_data_type<FromDataType>(from_type.get());
144
311
                    from_precision =
145
311
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
311
                    from_scale = from_decimal_type->get_scale();
147
311
                }
148
149
311
                UInt32 to_max_digits = 0;
150
311
                UInt32 to_precision = 0;
151
311
                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
311
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
311
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
311
                    to_precision = to_max_digits;
167
311
                }
168
169
311
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
311
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
311
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
311
                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
311
            }
179
0
            return false;
180
311
        });
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
317
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
317
            using Types2 = std::decay_t<decltype(types2)>;
129
317
            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
317
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
317
                using FromFieldType = typename FromDataType::FieldType;
137
317
                using ToFieldType = typename ToDataType::FieldType;
138
317
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
317
                UInt32 from_scale = 0;
140
141
317
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
317
                    const auto* from_decimal_type =
143
317
                            check_and_get_data_type<FromDataType>(from_type.get());
144
317
                    from_precision =
145
317
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
317
                    from_scale = from_decimal_type->get_scale();
147
317
                }
148
149
317
                UInt32 to_max_digits = 0;
150
317
                UInt32 to_precision = 0;
151
317
                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
317
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
317
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
317
                    to_precision = to_max_digits;
167
317
                }
168
169
317
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
317
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
317
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
317
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
318
                return narrow_integral || multiply_may_overflow;
178
317
            }
179
0
            return false;
180
317
        });
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
302
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
302
            using Types2 = std::decay_t<decltype(types2)>;
129
302
            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
302
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
302
                using FromFieldType = typename FromDataType::FieldType;
137
302
                using ToFieldType = typename ToDataType::FieldType;
138
302
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
302
                UInt32 from_scale = 0;
140
141
302
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
302
                    const auto* from_decimal_type =
143
302
                            check_and_get_data_type<FromDataType>(from_type.get());
144
302
                    from_precision =
145
302
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
302
                    from_scale = from_decimal_type->get_scale();
147
302
                }
148
149
302
                UInt32 to_max_digits = 0;
150
302
                UInt32 to_precision = 0;
151
302
                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
302
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
302
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
302
                    to_precision = to_max_digits;
167
302
                }
168
169
302
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
302
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
302
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
302
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
302
                return narrow_integral || multiply_may_overflow;
178
302
            }
179
0
            return false;
180
302
        });
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
747
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
747
            using Types2 = std::decay_t<decltype(types2)>;
129
747
            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
747
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
747
                using FromFieldType = typename FromDataType::FieldType;
137
747
                using ToFieldType = typename ToDataType::FieldType;
138
747
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
747
                UInt32 from_scale = 0;
140
141
747
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
747
                    const auto* from_decimal_type =
143
747
                            check_and_get_data_type<FromDataType>(from_type.get());
144
747
                    from_precision =
145
747
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
747
                    from_scale = from_decimal_type->get_scale();
147
747
                }
148
149
747
                UInt32 to_max_digits = 0;
150
747
                UInt32 to_precision = 0;
151
747
                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
747
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
747
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
747
                    to_precision = to_max_digits;
167
747
                }
168
169
747
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
747
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
747
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
747
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
747
                return narrow_integral || multiply_may_overflow;
178
747
            }
179
0
            return false;
180
747
        });
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
18.8k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
18.8k
            using Types2 = std::decay_t<decltype(types2)>;
129
18.8k
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
18.8k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
18.8k
                return false;
134
18.8k
            }
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.8k
            return false;
180
18.8k
        });
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
138
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
138
            using Types2 = std::decay_t<decltype(types2)>;
129
138
            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
138
            return false;
180
138
        });
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
135
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
135
            using Types2 = std::decay_t<decltype(types2)>;
129
135
            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
135
            return false;
180
135
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_6EEESE_EEEEbSI_
Line
Count
Source
127
556
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
556
            using Types2 = std::decay_t<decltype(types2)>;
129
556
            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
556
            return false;
180
556
        });
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.30k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
2.30k
            using Types2 = std::decay_t<decltype(types2)>;
129
2.30k
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
2.30k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
2.30k
                return false;
134
2.30k
            }
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.30k
            return false;
180
2.30k
        });
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
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_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
111
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
111
            using Types2 = std::decay_t<decltype(types2)>;
129
111
            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
111
            return false;
180
111
        });
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
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
97
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
97
                using FromFieldType = typename FromDataType::FieldType;
137
97
                using ToFieldType = typename ToDataType::FieldType;
138
97
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
97
                UInt32 from_scale = 0;
140
141
97
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
97
                    const auto* from_decimal_type =
143
97
                            check_and_get_data_type<FromDataType>(from_type.get());
144
97
                    from_precision =
145
97
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
97
                    from_scale = from_decimal_type->get_scale();
147
97
                }
148
149
97
                UInt32 to_max_digits = 0;
150
97
                UInt32 to_precision = 0;
151
97
                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
97
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
97
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
97
                    to_precision = to_max_digits;
167
97
                }
168
169
97
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
97
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
97
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
97
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
97
                return narrow_integral || multiply_may_overflow;
178
97
            }
179
0
            return false;
180
97
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE8EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_35EEESE_EEEEbSI_
Line
Count
Source
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.60k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
1.60k
            using Types2 = std::decay_t<decltype(types2)>;
129
1.60k
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
1.60k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
1.60k
                return false;
134
1.60k
            }
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.60k
            return false;
180
1.60k
        });
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
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_13PrimitiveTypeE9EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_3EEESE_EEEEbSI_
Line
Count
Source
127
465
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
465
            using Types2 = std::decay_t<decltype(types2)>;
129
465
            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
465
            return false;
180
465
        });
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.01k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
1.01k
            using Types2 = std::decay_t<decltype(types2)>;
129
1.01k
            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.01k
            return false;
180
1.01k
        });
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.07k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
1.07k
            using Types2 = std::decay_t<decltype(types2)>;
129
1.07k
            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.07k
            return false;
180
1.07k
        });
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.31k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
1.31k
            using Types2 = std::decay_t<decltype(types2)>;
129
1.31k
            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.31k
            return false;
180
1.31k
        });
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.04k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
1.04k
            using Types2 = std::decay_t<decltype(types2)>;
129
1.04k
            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.04k
            return false;
180
1.04k
        });
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
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
456
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
456
                    const auto* from_decimal_type =
143
456
                            check_and_get_data_type<FromDataType>(from_type.get());
144
456
                    from_precision =
145
456
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
456
                    from_scale = from_decimal_type->get_scale();
147
456
                }
148
149
456
                UInt32 to_max_digits = 0;
150
456
                UInt32 to_precision = 0;
151
456
                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
456
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
456
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
456
                    to_precision = to_max_digits;
167
456
                }
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
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
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_14DataTypeNumberILNS_13PrimitiveTypeE9EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_29EEESE_EEEEbSI_
Line
Count
Source
127
316
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
316
            using Types2 = std::decay_t<decltype(types2)>;
129
316
            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
316
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
316
                using FromFieldType = typename FromDataType::FieldType;
137
316
                using ToFieldType = typename ToDataType::FieldType;
138
316
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
316
                UInt32 from_scale = 0;
140
141
316
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
316
                    const auto* from_decimal_type =
143
316
                            check_and_get_data_type<FromDataType>(from_type.get());
144
316
                    from_precision =
145
316
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
316
                    from_scale = from_decimal_type->get_scale();
147
316
                }
148
149
316
                UInt32 to_max_digits = 0;
150
316
                UInt32 to_precision = 0;
151
316
                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
316
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
316
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
316
                    to_precision = to_max_digits;
167
316
                }
168
169
316
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
316
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
316
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
316
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
316
                return narrow_integral || multiply_may_overflow;
178
316
            }
179
0
            return false;
180
316
        });
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
688
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
688
            using Types2 = std::decay_t<decltype(types2)>;
129
688
            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
688
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
688
                using FromFieldType = typename FromDataType::FieldType;
137
688
                using ToFieldType = typename ToDataType::FieldType;
138
688
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
688
                UInt32 from_scale = 0;
140
141
688
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
688
                    const auto* from_decimal_type =
143
688
                            check_and_get_data_type<FromDataType>(from_type.get());
144
688
                    from_precision =
145
688
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
688
                    from_scale = from_decimal_type->get_scale();
147
688
                }
148
149
688
                UInt32 to_max_digits = 0;
150
688
                UInt32 to_precision = 0;
151
688
                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
688
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
688
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
688
                    to_precision = to_max_digits;
167
688
                }
168
169
688
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
688
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
688
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
688
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
688
                return narrow_integral || multiply_may_overflow;
178
688
            }
179
0
            return false;
180
688
        });
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
58
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
58
            using Types2 = std::decay_t<decltype(types2)>;
129
58
            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
58
            return false;
180
58
        });
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.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_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
6.22k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
6.22k
            using Types2 = std::decay_t<decltype(types2)>;
129
6.22k
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
6.22k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
6.22k
                return false;
134
6.22k
            }
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.22k
            return false;
180
6.22k
        });
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
517
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
517
            using Types2 = std::decay_t<decltype(types2)>;
129
517
            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
517
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
517
                using FromFieldType = typename FromDataType::FieldType;
137
517
                using ToFieldType = typename ToDataType::FieldType;
138
517
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
517
                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
517
                UInt32 to_max_digits = 0;
150
517
                UInt32 to_precision = 0;
151
517
                UInt32 to_scale = 0;
152
153
517
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
517
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
517
                    const auto* to_decimal_type =
157
517
                            check_and_get_data_type<ToDataType>(to_type.get());
158
517
                    to_precision = to_decimal_type->get_precision();
159
517
                    ToDataType::check_type_precision(to_precision);
160
161
517
                    to_scale = to_decimal_type->get_scale();
162
517
                    ToDataType::check_type_scale(to_scale);
163
517
                }
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
517
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
517
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
517
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
517
                if (to_scale > from_scale) {
174
261
                    multiply_may_overflow &=
175
261
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
261
                }
177
517
                return narrow_integral || multiply_may_overflow;
178
517
            }
179
0
            return false;
180
517
        });
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
408
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
408
            using Types2 = std::decay_t<decltype(types2)>;
129
408
            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
408
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
408
                using FromFieldType = typename FromDataType::FieldType;
137
408
                using ToFieldType = typename ToDataType::FieldType;
138
408
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
408
                UInt32 from_scale = 0;
140
141
408
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
408
                    const auto* from_decimal_type =
143
408
                            check_and_get_data_type<FromDataType>(from_type.get());
144
408
                    from_precision =
145
408
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
408
                    from_scale = from_decimal_type->get_scale();
147
408
                }
148
149
408
                UInt32 to_max_digits = 0;
150
408
                UInt32 to_precision = 0;
151
408
                UInt32 to_scale = 0;
152
153
408
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
408
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
408
                    const auto* to_decimal_type =
157
408
                            check_and_get_data_type<ToDataType>(to_type.get());
158
408
                    to_precision = to_decimal_type->get_precision();
159
408
                    ToDataType::check_type_precision(to_precision);
160
161
408
                    to_scale = to_decimal_type->get_scale();
162
408
                    ToDataType::check_type_scale(to_scale);
163
408
                }
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
408
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
408
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
408
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
408
                if (to_scale > from_scale) {
174
81
                    multiply_may_overflow &=
175
81
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
81
                }
177
408
                return narrow_integral || multiply_may_overflow;
178
408
            }
179
0
            return false;
180
408
        });
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
508
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
508
            using Types2 = std::decay_t<decltype(types2)>;
129
508
            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
508
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
508
                using FromFieldType = typename FromDataType::FieldType;
137
508
                using ToFieldType = typename ToDataType::FieldType;
138
508
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
508
                UInt32 from_scale = 0;
140
141
508
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
508
                    const auto* from_decimal_type =
143
508
                            check_and_get_data_type<FromDataType>(from_type.get());
144
508
                    from_precision =
145
508
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
508
                    from_scale = from_decimal_type->get_scale();
147
508
                }
148
149
508
                UInt32 to_max_digits = 0;
150
508
                UInt32 to_precision = 0;
151
508
                UInt32 to_scale = 0;
152
153
508
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
508
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
508
                    const auto* to_decimal_type =
157
508
                            check_and_get_data_type<ToDataType>(to_type.get());
158
508
                    to_precision = to_decimal_type->get_precision();
159
508
                    ToDataType::check_type_precision(to_precision);
160
161
508
                    to_scale = to_decimal_type->get_scale();
162
508
                    ToDataType::check_type_scale(to_scale);
163
508
                }
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
508
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
508
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
508
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
508
                if (to_scale > from_scale) {
174
86
                    multiply_may_overflow &=
175
86
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
86
                }
177
508
                return narrow_integral || multiply_may_overflow;
178
508
            }
179
0
            return false;
180
508
        });
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
322
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
322
            using Types2 = std::decay_t<decltype(types2)>;
129
322
            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
322
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
322
                using FromFieldType = typename FromDataType::FieldType;
137
322
                using ToFieldType = typename ToDataType::FieldType;
138
322
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
322
                UInt32 from_scale = 0;
140
141
322
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
322
                    const auto* from_decimal_type =
143
322
                            check_and_get_data_type<FromDataType>(from_type.get());
144
322
                    from_precision =
145
322
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
322
                    from_scale = from_decimal_type->get_scale();
147
322
                }
148
149
322
                UInt32 to_max_digits = 0;
150
322
                UInt32 to_precision = 0;
151
322
                UInt32 to_scale = 0;
152
153
322
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
322
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
322
                    const auto* to_decimal_type =
157
322
                            check_and_get_data_type<ToDataType>(to_type.get());
158
322
                    to_precision = to_decimal_type->get_precision();
159
322
                    ToDataType::check_type_precision(to_precision);
160
161
322
                    to_scale = to_decimal_type->get_scale();
162
322
                    ToDataType::check_type_scale(to_scale);
163
322
                }
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
322
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
322
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
322
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
322
                if (to_scale > from_scale) {
174
85
                    multiply_may_overflow &=
175
85
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
85
                }
177
322
                return narrow_integral || multiply_may_overflow;
178
322
            }
179
0
            return false;
180
322
        });
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.78k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
2.78k
            using Types2 = std::decay_t<decltype(types2)>;
129
2.78k
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
2.78k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
2.78k
                return false;
134
2.78k
            }
135
2.78k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
2.78k
                using FromFieldType = typename FromDataType::FieldType;
137
2.78k
                using ToFieldType = typename ToDataType::FieldType;
138
2.78k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
2.78k
                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.78k
                UInt32 to_max_digits = 0;
150
2.78k
                UInt32 to_precision = 0;
151
2.78k
                UInt32 to_scale = 0;
152
153
2.78k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
2.78k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
2.78k
                    const auto* to_decimal_type =
157
2.78k
                            check_and_get_data_type<ToDataType>(to_type.get());
158
2.78k
                    to_precision = to_decimal_type->get_precision();
159
2.78k
                    ToDataType::check_type_precision(to_precision);
160
161
2.78k
                    to_scale = to_decimal_type->get_scale();
162
2.78k
                    ToDataType::check_type_scale(to_scale);
163
2.78k
                }
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.78k
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
2.78k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
2.78k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
2.78k
                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.78k
                return narrow_integral || multiply_may_overflow;
178
2.78k
            }
179
0
            return false;
180
2.78k
        });
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
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
15
                    multiply_may_overflow &=
175
15
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
15
                }
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_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
457
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
457
            using Types2 = std::decay_t<decltype(types2)>;
129
457
            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
457
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
457
                using FromFieldType = typename FromDataType::FieldType;
137
457
                using ToFieldType = typename ToDataType::FieldType;
138
457
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
457
                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
457
                UInt32 to_max_digits = 0;
150
457
                UInt32 to_precision = 0;
151
457
                UInt32 to_scale = 0;
152
153
457
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
457
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
457
                    const auto* to_decimal_type =
157
457
                            check_and_get_data_type<ToDataType>(to_type.get());
158
457
                    to_precision = to_decimal_type->get_precision();
159
457
                    ToDataType::check_type_precision(to_precision);
160
161
457
                    to_scale = to_decimal_type->get_scale();
162
457
                    ToDataType::check_type_scale(to_scale);
163
457
                }
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
457
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
457
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
457
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
457
                if (to_scale > from_scale) {
174
304
                    multiply_may_overflow &=
175
304
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
304
                }
177
457
                return narrow_integral || multiply_may_overflow;
178
457
            }
179
0
            return false;
180
457
        });
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
769
                    multiply_may_overflow &=
175
769
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
769
                }
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
877
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
877
            using Types2 = std::decay_t<decltype(types2)>;
129
877
            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
877
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
877
                using FromFieldType = typename FromDataType::FieldType;
137
877
                using ToFieldType = typename ToDataType::FieldType;
138
877
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
877
                UInt32 from_scale = 0;
140
141
877
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
877
                    const auto* from_decimal_type =
143
877
                            check_and_get_data_type<FromDataType>(from_type.get());
144
877
                    from_precision =
145
877
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
877
                    from_scale = from_decimal_type->get_scale();
147
877
                }
148
149
877
                UInt32 to_max_digits = 0;
150
877
                UInt32 to_precision = 0;
151
877
                UInt32 to_scale = 0;
152
153
877
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
877
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
877
                    const auto* to_decimal_type =
157
877
                            check_and_get_data_type<ToDataType>(to_type.get());
158
877
                    to_precision = to_decimal_type->get_precision();
159
877
                    ToDataType::check_type_precision(to_precision);
160
161
877
                    to_scale = to_decimal_type->get_scale();
162
877
                    ToDataType::check_type_scale(to_scale);
163
877
                }
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
877
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
877
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
877
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
877
                if (to_scale > from_scale) {
174
159
                    multiply_may_overflow &=
175
159
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
159
                }
177
877
                return narrow_integral || multiply_may_overflow;
178
877
            }
179
0
            return false;
180
877
        });
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
426
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
426
            using Types2 = std::decay_t<decltype(types2)>;
129
426
            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
426
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
426
                using FromFieldType = typename FromDataType::FieldType;
137
426
                using ToFieldType = typename ToDataType::FieldType;
138
426
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
426
                UInt32 from_scale = 0;
140
141
426
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
426
                    const auto* from_decimal_type =
143
426
                            check_and_get_data_type<FromDataType>(from_type.get());
144
426
                    from_precision =
145
426
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
426
                    from_scale = from_decimal_type->get_scale();
147
426
                }
148
149
426
                UInt32 to_max_digits = 0;
150
426
                UInt32 to_precision = 0;
151
426
                UInt32 to_scale = 0;
152
153
426
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
426
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
426
                    const auto* to_decimal_type =
157
426
                            check_and_get_data_type<ToDataType>(to_type.get());
158
426
                    to_precision = to_decimal_type->get_precision();
159
426
                    ToDataType::check_type_precision(to_precision);
160
161
426
                    to_scale = to_decimal_type->get_scale();
162
426
                    ToDataType::check_type_scale(to_scale);
163
426
                }
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
426
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
426
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
426
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
426
                if (to_scale > from_scale) {
174
146
                    multiply_may_overflow &=
175
146
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
146
                }
177
426
                return narrow_integral || multiply_may_overflow;
178
426
            }
179
0
            return false;
180
426
        });
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.85k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
7.85k
            using Types2 = std::decay_t<decltype(types2)>;
129
7.85k
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
7.85k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
7.85k
                return false;
134
7.85k
            }
135
7.85k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
7.85k
                using FromFieldType = typename FromDataType::FieldType;
137
7.85k
                using ToFieldType = typename ToDataType::FieldType;
138
7.85k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
7.85k
                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.85k
                UInt32 to_max_digits = 0;
150
7.85k
                UInt32 to_precision = 0;
151
7.85k
                UInt32 to_scale = 0;
152
153
7.85k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
7.85k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
7.85k
                    const auto* to_decimal_type =
157
7.85k
                            check_and_get_data_type<ToDataType>(to_type.get());
158
7.85k
                    to_precision = to_decimal_type->get_precision();
159
7.85k
                    ToDataType::check_type_precision(to_precision);
160
161
7.85k
                    to_scale = to_decimal_type->get_scale();
162
7.85k
                    ToDataType::check_type_scale(to_scale);
163
7.85k
                }
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.85k
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
7.85k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
7.85k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
7.85k
                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.85k
                return narrow_integral || multiply_may_overflow;
178
7.85k
            }
179
0
            return false;
180
7.85k
        });
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
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
        });
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
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
                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
22
                UInt32 to_max_digits = 0;
150
22
                UInt32 to_precision = 0;
151
22
                UInt32 to_scale = 0;
152
153
22
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
22
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
22
                    const auto* to_decimal_type =
157
22
                            check_and_get_data_type<ToDataType>(to_type.get());
158
22
                    to_precision = to_decimal_type->get_precision();
159
22
                    ToDataType::check_type_precision(to_precision);
160
161
22
                    to_scale = to_decimal_type->get_scale();
162
22
                    ToDataType::check_type_scale(to_scale);
163
22
                }
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
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
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
22
            }
179
0
            return false;
180
22
        });
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
441
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
441
            using Types2 = std::decay_t<decltype(types2)>;
129
441
            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
441
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
441
                using FromFieldType = typename FromDataType::FieldType;
137
441
                using ToFieldType = typename ToDataType::FieldType;
138
441
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
441
                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
441
                UInt32 to_max_digits = 0;
150
441
                UInt32 to_precision = 0;
151
441
                UInt32 to_scale = 0;
152
153
441
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
441
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
441
                    const auto* to_decimal_type =
157
441
                            check_and_get_data_type<ToDataType>(to_type.get());
158
441
                    to_precision = to_decimal_type->get_precision();
159
441
                    ToDataType::check_type_precision(to_precision);
160
161
441
                    to_scale = to_decimal_type->get_scale();
162
441
                    ToDataType::check_type_scale(to_scale);
163
441
                }
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
441
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
441
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
441
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
441
                if (to_scale > from_scale) {
174
385
                    multiply_may_overflow &=
175
385
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
385
                }
177
441
                return narrow_integral || multiply_may_overflow;
178
441
            }
179
0
            return false;
180
441
        });
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
1.22k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
1.22k
            using Types2 = std::decay_t<decltype(types2)>;
129
1.22k
            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.22k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
1.22k
                using FromFieldType = typename FromDataType::FieldType;
137
1.22k
                using ToFieldType = typename ToDataType::FieldType;
138
1.22k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
1.22k
                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.22k
                UInt32 to_max_digits = 0;
150
1.22k
                UInt32 to_precision = 0;
151
1.22k
                UInt32 to_scale = 0;
152
153
1.22k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
1.22k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
1.22k
                    const auto* to_decimal_type =
157
1.22k
                            check_and_get_data_type<ToDataType>(to_type.get());
158
1.22k
                    to_precision = to_decimal_type->get_precision();
159
1.22k
                    ToDataType::check_type_precision(to_precision);
160
161
1.22k
                    to_scale = to_decimal_type->get_scale();
162
1.22k
                    ToDataType::check_type_scale(to_scale);
163
1.22k
                }
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.22k
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
1.22k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
1.22k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
1.22k
                if (to_scale > from_scale) {
174
434
                    multiply_may_overflow &=
175
434
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
434
                }
177
1.22k
                return narrow_integral || multiply_may_overflow;
178
1.22k
            }
179
0
            return false;
180
1.22k
        });
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
367
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
367
            using Types2 = std::decay_t<decltype(types2)>;
129
367
            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
367
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
367
                using FromFieldType = typename FromDataType::FieldType;
137
367
                using ToFieldType = typename ToDataType::FieldType;
138
367
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
367
                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
367
                UInt32 to_max_digits = 0;
150
367
                UInt32 to_precision = 0;
151
367
                UInt32 to_scale = 0;
152
153
367
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
367
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
367
                    const auto* to_decimal_type =
157
367
                            check_and_get_data_type<ToDataType>(to_type.get());
158
367
                    to_precision = to_decimal_type->get_precision();
159
367
                    ToDataType::check_type_precision(to_precision);
160
161
367
                    to_scale = to_decimal_type->get_scale();
162
367
                    ToDataType::check_type_scale(to_scale);
163
367
                }
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
367
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
367
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
367
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
367
                if (to_scale > from_scale) {
174
196
                    multiply_may_overflow &=
175
196
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
196
                }
177
367
                return narrow_integral || multiply_may_overflow;
178
367
            }
179
0
            return false;
180
367
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_8EEESE_EEEEbSI_
Line
Count
Source
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
490
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
490
            using Types2 = std::decay_t<decltype(types2)>;
129
490
            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
490
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
490
                using FromFieldType = typename FromDataType::FieldType;
137
490
                using ToFieldType = typename ToDataType::FieldType;
138
490
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
490
                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
490
                UInt32 to_max_digits = 0;
150
490
                UInt32 to_precision = 0;
151
490
                UInt32 to_scale = 0;
152
153
490
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
490
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
490
                    const auto* to_decimal_type =
157
490
                            check_and_get_data_type<ToDataType>(to_type.get());
158
490
                    to_precision = to_decimal_type->get_precision();
159
490
                    ToDataType::check_type_precision(to_precision);
160
161
490
                    to_scale = to_decimal_type->get_scale();
162
490
                    ToDataType::check_type_scale(to_scale);
163
490
                }
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
490
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
490
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
490
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
490
                if (to_scale > from_scale) {
174
380
                    multiply_may_overflow &=
175
380
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
380
                }
177
490
                return narrow_integral || multiply_may_overflow;
178
490
            }
179
0
            return false;
180
490
        });
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
760
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
760
            using Types2 = std::decay_t<decltype(types2)>;
129
760
            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
760
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
760
                using FromFieldType = typename FromDataType::FieldType;
137
760
                using ToFieldType = typename ToDataType::FieldType;
138
760
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
760
                UInt32 from_scale = 0;
140
141
760
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
760
                    const auto* from_decimal_type =
143
760
                            check_and_get_data_type<FromDataType>(from_type.get());
144
760
                    from_precision =
145
760
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
760
                    from_scale = from_decimal_type->get_scale();
147
760
                }
148
149
760
                UInt32 to_max_digits = 0;
150
760
                UInt32 to_precision = 0;
151
760
                UInt32 to_scale = 0;
152
153
760
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
760
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
760
                    const auto* to_decimal_type =
157
760
                            check_and_get_data_type<ToDataType>(to_type.get());
158
760
                    to_precision = to_decimal_type->get_precision();
159
760
                    ToDataType::check_type_precision(to_precision);
160
161
760
                    to_scale = to_decimal_type->get_scale();
162
760
                    ToDataType::check_type_scale(to_scale);
163
760
                }
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
760
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
760
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
760
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
760
                if (to_scale > from_scale) {
174
607
                    multiply_may_overflow &=
175
607
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
607
                }
177
760
                return narrow_integral || multiply_may_overflow;
178
760
            }
179
0
            return false;
180
760
        });
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.06k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
1.06k
            using Types2 = std::decay_t<decltype(types2)>;
129
1.06k
            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.06k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
1.06k
                using FromFieldType = typename FromDataType::FieldType;
137
1.06k
                using ToFieldType = typename ToDataType::FieldType;
138
1.06k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
1.06k
                UInt32 from_scale = 0;
140
141
1.06k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
1.06k
                    const auto* from_decimal_type =
143
1.06k
                            check_and_get_data_type<FromDataType>(from_type.get());
144
1.06k
                    from_precision =
145
1.06k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
1.06k
                    from_scale = from_decimal_type->get_scale();
147
1.06k
                }
148
149
1.06k
                UInt32 to_max_digits = 0;
150
1.06k
                UInt32 to_precision = 0;
151
1.06k
                UInt32 to_scale = 0;
152
153
1.06k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
1.06k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
1.06k
                    const auto* to_decimal_type =
157
1.06k
                            check_and_get_data_type<ToDataType>(to_type.get());
158
1.06k
                    to_precision = to_decimal_type->get_precision();
159
1.06k
                    ToDataType::check_type_precision(to_precision);
160
161
1.06k
                    to_scale = to_decimal_type->get_scale();
162
1.06k
                    ToDataType::check_type_scale(to_scale);
163
1.06k
                }
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.06k
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
1.06k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
1.06k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
1.06k
                if (to_scale > from_scale) {
174
718
                    multiply_may_overflow &=
175
718
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
718
                }
177
1.06k
                return narrow_integral || multiply_may_overflow;
178
1.06k
            }
179
0
            return false;
180
1.06k
        });
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
256
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
256
            using Types2 = std::decay_t<decltype(types2)>;
129
256
            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
256
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
256
                using FromFieldType = typename FromDataType::FieldType;
137
256
                using ToFieldType = typename ToDataType::FieldType;
138
256
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
256
                UInt32 from_scale = 0;
140
141
256
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
256
                    const auto* from_decimal_type =
143
256
                            check_and_get_data_type<FromDataType>(from_type.get());
144
256
                    from_precision =
145
256
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
256
                    from_scale = from_decimal_type->get_scale();
147
256
                }
148
149
256
                UInt32 to_max_digits = 0;
150
256
                UInt32 to_precision = 0;
151
256
                UInt32 to_scale = 0;
152
153
256
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
256
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
256
                    const auto* to_decimal_type =
157
256
                            check_and_get_data_type<ToDataType>(to_type.get());
158
256
                    to_precision = to_decimal_type->get_precision();
159
256
                    ToDataType::check_type_precision(to_precision);
160
161
256
                    to_scale = to_decimal_type->get_scale();
162
256
                    ToDataType::check_type_scale(to_scale);
163
256
                }
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
256
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
256
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
256
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
256
                if (to_scale > from_scale) {
174
71
                    multiply_may_overflow &=
175
71
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
71
                }
177
256
                return narrow_integral || multiply_may_overflow;
178
256
            }
179
0
            return false;
180
256
        });
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
1.38k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
1.38k
            using Types2 = std::decay_t<decltype(types2)>;
129
1.38k
            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.38k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
1.38k
                using FromFieldType = typename FromDataType::FieldType;
137
1.38k
                using ToFieldType = typename ToDataType::FieldType;
138
1.38k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
1.38k
                UInt32 from_scale = 0;
140
141
1.38k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
1.38k
                    const auto* from_decimal_type =
143
1.38k
                            check_and_get_data_type<FromDataType>(from_type.get());
144
1.38k
                    from_precision =
145
1.38k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
1.38k
                    from_scale = from_decimal_type->get_scale();
147
1.38k
                }
148
149
1.38k
                UInt32 to_max_digits = 0;
150
1.38k
                UInt32 to_precision = 0;
151
1.38k
                UInt32 to_scale = 0;
152
153
1.38k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
1.38k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
1.38k
                    const auto* to_decimal_type =
157
1.38k
                            check_and_get_data_type<ToDataType>(to_type.get());
158
1.38k
                    to_precision = to_decimal_type->get_precision();
159
1.38k
                    ToDataType::check_type_precision(to_precision);
160
161
1.38k
                    to_scale = to_decimal_type->get_scale();
162
1.38k
                    ToDataType::check_type_scale(to_scale);
163
1.38k
                }
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.38k
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
1.38k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
1.38k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
1.38k
                if (to_scale > from_scale) {
174
711
                    multiply_may_overflow &=
175
711
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
711
                }
177
1.38k
                return narrow_integral || multiply_may_overflow;
178
1.38k
            }
179
0
            return false;
180
1.38k
        });
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
4.90k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
4.90k
            using Types2 = std::decay_t<decltype(types2)>;
129
4.90k
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
4.90k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
4.90k
                return false;
134
4.90k
            }
135
4.90k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
4.90k
                using FromFieldType = typename FromDataType::FieldType;
137
4.90k
                using ToFieldType = typename ToDataType::FieldType;
138
4.90k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
4.90k
                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
4.90k
                UInt32 to_max_digits = 0;
150
4.90k
                UInt32 to_precision = 0;
151
4.90k
                UInt32 to_scale = 0;
152
153
4.90k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
4.90k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
4.90k
                    const auto* to_decimal_type =
157
4.90k
                            check_and_get_data_type<ToDataType>(to_type.get());
158
4.90k
                    to_precision = to_decimal_type->get_precision();
159
4.90k
                    ToDataType::check_type_precision(to_precision);
160
161
4.90k
                    to_scale = to_decimal_type->get_scale();
162
4.90k
                    ToDataType::check_type_scale(to_scale);
163
4.90k
                }
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.90k
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
4.90k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
4.90k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
4.90k
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
4.90k
                return narrow_integral || multiply_may_overflow;
178
4.90k
            }
179
0
            return false;
180
4.90k
        });
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
317
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
317
            using Types2 = std::decay_t<decltype(types2)>;
129
317
            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
317
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
317
                using FromFieldType = typename FromDataType::FieldType;
137
317
                using ToFieldType = typename ToDataType::FieldType;
138
317
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
317
                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
317
                UInt32 to_max_digits = 0;
150
317
                UInt32 to_precision = 0;
151
317
                UInt32 to_scale = 0;
152
153
317
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
317
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
317
                    const auto* to_decimal_type =
157
317
                            check_and_get_data_type<ToDataType>(to_type.get());
158
317
                    to_precision = to_decimal_type->get_precision();
159
317
                    ToDataType::check_type_precision(to_precision);
160
161
317
                    to_scale = to_decimal_type->get_scale();
162
317
                    ToDataType::check_type_scale(to_scale);
163
317
                }
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
317
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
317
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
317
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
317
                if (to_scale > from_scale) {
174
208
                    multiply_may_overflow &=
175
208
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
208
                }
177
317
                return narrow_integral || multiply_may_overflow;
178
317
            }
179
0
            return false;
180
317
        });
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.21k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
1.21k
            using Types2 = std::decay_t<decltype(types2)>;
129
1.21k
            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.21k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
1.21k
                using FromFieldType = typename FromDataType::FieldType;
137
1.21k
                using ToFieldType = typename ToDataType::FieldType;
138
1.21k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
1.21k
                UInt32 from_scale = 0;
140
141
1.21k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
1.21k
                    const auto* from_decimal_type =
143
1.21k
                            check_and_get_data_type<FromDataType>(from_type.get());
144
1.21k
                    from_precision =
145
1.21k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
1.21k
                    from_scale = from_decimal_type->get_scale();
147
1.21k
                }
148
149
1.21k
                UInt32 to_max_digits = 0;
150
1.21k
                UInt32 to_precision = 0;
151
1.21k
                UInt32 to_scale = 0;
152
153
1.21k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
1.21k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
1.21k
                    const auto* to_decimal_type =
157
1.21k
                            check_and_get_data_type<ToDataType>(to_type.get());
158
1.21k
                    to_precision = to_decimal_type->get_precision();
159
1.21k
                    ToDataType::check_type_precision(to_precision);
160
161
1.21k
                    to_scale = to_decimal_type->get_scale();
162
1.21k
                    ToDataType::check_type_scale(to_scale);
163
1.21k
                }
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.21k
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
1.21k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
1.21k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
1.21k
                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.21k
                return narrow_integral || multiply_may_overflow;
178
1.21k
            }
179
0
            return false;
180
1.21k
        });
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
37
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
37
            using Types2 = std::decay_t<decltype(types2)>;
129
37
            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
37
            return false;
180
37
        });
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
220
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
220
            using Types2 = std::decay_t<decltype(types2)>;
129
220
            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
220
            return false;
180
220
        });
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.55k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
5.55k
            using Types2 = std::decay_t<decltype(types2)>;
129
5.55k
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
5.55k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
5.55k
                return false;
134
5.55k
            }
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.55k
            return false;
180
5.55k
        });
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
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
17
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
17
                    const auto* from_decimal_type =
143
17
                            check_and_get_data_type<FromDataType>(from_type.get());
144
17
                    from_precision =
145
17
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
17
                    from_scale = from_decimal_type->get_scale();
147
17
                }
148
149
17
                UInt32 to_max_digits = 0;
150
17
                UInt32 to_precision = 0;
151
17
                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
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
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
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_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
392
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
392
            using Types2 = std::decay_t<decltype(types2)>;
129
392
            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
392
            return false;
180
392
        });
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
106
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
106
            using Types2 = std::decay_t<decltype(types2)>;
129
106
            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
106
            return false;
180
106
        });
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
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_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.72k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
3.72k
            using Types2 = std::decay_t<decltype(types2)>;
129
3.72k
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
3.72k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
3.72k
                return false;
134
3.72k
            }
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.72k
            return false;
180
3.72k
        });
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
207k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE2EEEvEEEEbRKT_
Line
Count
Source
117
2.40k
    auto make_default_wrapper = [&](const auto& types) -> bool {
118
2.40k
        using Types = std::decay_t<decltype(types)>;
119
2.40k
        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.40k
        return call_on_index_and_data_type<
127
2.40k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
2.40k
            using Types2 = std::decay_t<decltype(types2)>;
129
2.40k
            using FromDataType = typename Types2::LeftType;
130
2.40k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
2.40k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
2.40k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
2.40k
                return false;
134
2.40k
            }
135
2.40k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
2.40k
                using FromFieldType = typename FromDataType::FieldType;
137
2.40k
                using ToFieldType = typename ToDataType::FieldType;
138
2.40k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
2.40k
                UInt32 from_scale = 0;
140
141
2.40k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
2.40k
                    const auto* from_decimal_type =
143
2.40k
                            check_and_get_data_type<FromDataType>(from_type.get());
144
2.40k
                    from_precision =
145
2.40k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
2.40k
                    from_scale = from_decimal_type->get_scale();
147
2.40k
                }
148
149
2.40k
                UInt32 to_max_digits = 0;
150
2.40k
                UInt32 to_precision = 0;
151
2.40k
                UInt32 to_scale = 0;
152
153
2.40k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
2.40k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
2.40k
                    const auto* to_decimal_type =
157
2.40k
                            check_and_get_data_type<ToDataType>(to_type.get());
158
2.40k
                    to_precision = to_decimal_type->get_precision();
159
2.40k
                    ToDataType::check_type_precision(to_precision);
160
161
2.40k
                    to_scale = to_decimal_type->get_scale();
162
2.40k
                    ToDataType::check_type_scale(to_scale);
163
2.40k
                }
164
2.40k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
2.40k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
2.40k
                    to_precision = to_max_digits;
167
2.40k
                }
168
169
2.40k
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
2.40k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
2.40k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
2.40k
                if (to_scale > from_scale) {
174
2.40k
                    multiply_may_overflow &=
175
2.40k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
2.40k
                }
177
2.40k
                return narrow_integral || multiply_may_overflow;
178
2.40k
            }
179
2.40k
            return false;
180
2.40k
        });
181
2.40k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEvEEEEbRKT_
Line
Count
Source
117
3.91k
    auto make_default_wrapper = [&](const auto& types) -> bool {
118
3.91k
        using Types = std::decay_t<decltype(types)>;
119
3.91k
        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
3.91k
        return call_on_index_and_data_type<
127
3.91k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
3.91k
            using Types2 = std::decay_t<decltype(types2)>;
129
3.91k
            using FromDataType = typename Types2::LeftType;
130
3.91k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
3.91k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
3.91k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
3.91k
                return false;
134
3.91k
            }
135
3.91k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
3.91k
                using FromFieldType = typename FromDataType::FieldType;
137
3.91k
                using ToFieldType = typename ToDataType::FieldType;
138
3.91k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
3.91k
                UInt32 from_scale = 0;
140
141
3.91k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
3.91k
                    const auto* from_decimal_type =
143
3.91k
                            check_and_get_data_type<FromDataType>(from_type.get());
144
3.91k
                    from_precision =
145
3.91k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
3.91k
                    from_scale = from_decimal_type->get_scale();
147
3.91k
                }
148
149
3.91k
                UInt32 to_max_digits = 0;
150
3.91k
                UInt32 to_precision = 0;
151
3.91k
                UInt32 to_scale = 0;
152
153
3.91k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
3.91k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
3.91k
                    const auto* to_decimal_type =
157
3.91k
                            check_and_get_data_type<ToDataType>(to_type.get());
158
3.91k
                    to_precision = to_decimal_type->get_precision();
159
3.91k
                    ToDataType::check_type_precision(to_precision);
160
161
3.91k
                    to_scale = to_decimal_type->get_scale();
162
3.91k
                    ToDataType::check_type_scale(to_scale);
163
3.91k
                }
164
3.91k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
3.91k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
3.91k
                    to_precision = to_max_digits;
167
3.91k
                }
168
169
3.91k
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
3.91k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
3.91k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
3.91k
                if (to_scale > from_scale) {
174
3.91k
                    multiply_may_overflow &=
175
3.91k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
3.91k
                }
177
3.91k
                return narrow_integral || multiply_may_overflow;
178
3.91k
            }
179
3.91k
            return false;
180
3.91k
        });
181
3.91k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEvEEEEbRKT_
Line
Count
Source
117
5.66k
    auto make_default_wrapper = [&](const auto& types) -> bool {
118
5.66k
        using Types = std::decay_t<decltype(types)>;
119
5.66k
        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.66k
        return call_on_index_and_data_type<
127
5.66k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
5.66k
            using Types2 = std::decay_t<decltype(types2)>;
129
5.66k
            using FromDataType = typename Types2::LeftType;
130
5.66k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
5.66k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
5.66k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
5.66k
                return false;
134
5.66k
            }
135
5.66k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
5.66k
                using FromFieldType = typename FromDataType::FieldType;
137
5.66k
                using ToFieldType = typename ToDataType::FieldType;
138
5.66k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
5.66k
                UInt32 from_scale = 0;
140
141
5.66k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
5.66k
                    const auto* from_decimal_type =
143
5.66k
                            check_and_get_data_type<FromDataType>(from_type.get());
144
5.66k
                    from_precision =
145
5.66k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
5.66k
                    from_scale = from_decimal_type->get_scale();
147
5.66k
                }
148
149
5.66k
                UInt32 to_max_digits = 0;
150
5.66k
                UInt32 to_precision = 0;
151
5.66k
                UInt32 to_scale = 0;
152
153
5.66k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
5.66k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
5.66k
                    const auto* to_decimal_type =
157
5.66k
                            check_and_get_data_type<ToDataType>(to_type.get());
158
5.66k
                    to_precision = to_decimal_type->get_precision();
159
5.66k
                    ToDataType::check_type_precision(to_precision);
160
161
5.66k
                    to_scale = to_decimal_type->get_scale();
162
5.66k
                    ToDataType::check_type_scale(to_scale);
163
5.66k
                }
164
5.66k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
5.66k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
5.66k
                    to_precision = to_max_digits;
167
5.66k
                }
168
169
5.66k
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
5.66k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
5.66k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
5.66k
                if (to_scale > from_scale) {
174
5.66k
                    multiply_may_overflow &=
175
5.66k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
5.66k
                }
177
5.66k
                return narrow_integral || multiply_may_overflow;
178
5.66k
            }
179
5.66k
            return false;
180
5.66k
        });
181
5.66k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEvEEEEbRKT_
Line
Count
Source
117
30.1k
    auto make_default_wrapper = [&](const auto& types) -> bool {
118
30.1k
        using Types = std::decay_t<decltype(types)>;
119
30.1k
        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.1k
        return call_on_index_and_data_type<
127
30.1k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
30.1k
            using Types2 = std::decay_t<decltype(types2)>;
129
30.1k
            using FromDataType = typename Types2::LeftType;
130
30.1k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
30.1k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
30.1k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
30.1k
                return false;
134
30.1k
            }
135
30.1k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
30.1k
                using FromFieldType = typename FromDataType::FieldType;
137
30.1k
                using ToFieldType = typename ToDataType::FieldType;
138
30.1k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
30.1k
                UInt32 from_scale = 0;
140
141
30.1k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
30.1k
                    const auto* from_decimal_type =
143
30.1k
                            check_and_get_data_type<FromDataType>(from_type.get());
144
30.1k
                    from_precision =
145
30.1k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
30.1k
                    from_scale = from_decimal_type->get_scale();
147
30.1k
                }
148
149
30.1k
                UInt32 to_max_digits = 0;
150
30.1k
                UInt32 to_precision = 0;
151
30.1k
                UInt32 to_scale = 0;
152
153
30.1k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
30.1k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
30.1k
                    const auto* to_decimal_type =
157
30.1k
                            check_and_get_data_type<ToDataType>(to_type.get());
158
30.1k
                    to_precision = to_decimal_type->get_precision();
159
30.1k
                    ToDataType::check_type_precision(to_precision);
160
161
30.1k
                    to_scale = to_decimal_type->get_scale();
162
30.1k
                    ToDataType::check_type_scale(to_scale);
163
30.1k
                }
164
30.1k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
30.1k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
30.1k
                    to_precision = to_max_digits;
167
30.1k
                }
168
169
30.1k
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
30.1k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
30.1k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
30.1k
                if (to_scale > from_scale) {
174
30.1k
                    multiply_may_overflow &=
175
30.1k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
30.1k
                }
177
30.1k
                return narrow_integral || multiply_may_overflow;
178
30.1k
            }
179
30.1k
            return false;
180
30.1k
        });
181
30.1k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEvEEEEbRKT_
Line
Count
Source
117
35.4k
    auto make_default_wrapper = [&](const auto& types) -> bool {
118
35.4k
        using Types = std::decay_t<decltype(types)>;
119
35.4k
        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
35.4k
        return call_on_index_and_data_type<
127
35.4k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
35.4k
            using Types2 = std::decay_t<decltype(types2)>;
129
35.4k
            using FromDataType = typename Types2::LeftType;
130
35.4k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
35.4k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
35.4k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
35.4k
                return false;
134
35.4k
            }
135
35.4k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
35.4k
                using FromFieldType = typename FromDataType::FieldType;
137
35.4k
                using ToFieldType = typename ToDataType::FieldType;
138
35.4k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
35.4k
                UInt32 from_scale = 0;
140
141
35.4k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
35.4k
                    const auto* from_decimal_type =
143
35.4k
                            check_and_get_data_type<FromDataType>(from_type.get());
144
35.4k
                    from_precision =
145
35.4k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
35.4k
                    from_scale = from_decimal_type->get_scale();
147
35.4k
                }
148
149
35.4k
                UInt32 to_max_digits = 0;
150
35.4k
                UInt32 to_precision = 0;
151
35.4k
                UInt32 to_scale = 0;
152
153
35.4k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
35.4k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
35.4k
                    const auto* to_decimal_type =
157
35.4k
                            check_and_get_data_type<ToDataType>(to_type.get());
158
35.4k
                    to_precision = to_decimal_type->get_precision();
159
35.4k
                    ToDataType::check_type_precision(to_precision);
160
161
35.4k
                    to_scale = to_decimal_type->get_scale();
162
35.4k
                    ToDataType::check_type_scale(to_scale);
163
35.4k
                }
164
35.4k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
35.4k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
35.4k
                    to_precision = to_max_digits;
167
35.4k
                }
168
169
35.4k
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
35.4k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
35.4k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
35.4k
                if (to_scale > from_scale) {
174
35.4k
                    multiply_may_overflow &=
175
35.4k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
35.4k
                }
177
35.4k
                return narrow_integral || multiply_may_overflow;
178
35.4k
            }
179
35.4k
            return false;
180
35.4k
        });
181
35.4k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEvEEEEbRKT_
Line
Count
Source
117
5.30k
    auto make_default_wrapper = [&](const auto& types) -> bool {
118
5.30k
        using Types = std::decay_t<decltype(types)>;
119
5.30k
        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.30k
        return call_on_index_and_data_type<
127
5.30k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
5.30k
            using Types2 = std::decay_t<decltype(types2)>;
129
5.30k
            using FromDataType = typename Types2::LeftType;
130
5.30k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
5.30k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
5.30k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
5.30k
                return false;
134
5.30k
            }
135
5.30k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
5.30k
                using FromFieldType = typename FromDataType::FieldType;
137
5.30k
                using ToFieldType = typename ToDataType::FieldType;
138
5.30k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
5.30k
                UInt32 from_scale = 0;
140
141
5.30k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
5.30k
                    const auto* from_decimal_type =
143
5.30k
                            check_and_get_data_type<FromDataType>(from_type.get());
144
5.30k
                    from_precision =
145
5.30k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
5.30k
                    from_scale = from_decimal_type->get_scale();
147
5.30k
                }
148
149
5.30k
                UInt32 to_max_digits = 0;
150
5.30k
                UInt32 to_precision = 0;
151
5.30k
                UInt32 to_scale = 0;
152
153
5.30k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
5.30k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
5.30k
                    const auto* to_decimal_type =
157
5.30k
                            check_and_get_data_type<ToDataType>(to_type.get());
158
5.30k
                    to_precision = to_decimal_type->get_precision();
159
5.30k
                    ToDataType::check_type_precision(to_precision);
160
161
5.30k
                    to_scale = to_decimal_type->get_scale();
162
5.30k
                    ToDataType::check_type_scale(to_scale);
163
5.30k
                }
164
5.30k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
5.30k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
5.30k
                    to_precision = to_max_digits;
167
5.30k
                }
168
169
5.30k
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
5.30k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
5.30k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
5.30k
                if (to_scale > from_scale) {
174
5.30k
                    multiply_may_overflow &=
175
5.30k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
5.30k
                }
177
5.30k
                return narrow_integral || multiply_may_overflow;
178
5.30k
            }
179
5.30k
            return false;
180
5.30k
        });
181
5.30k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE8EEEvEEEEbRKT_
Line
Count
Source
117
10.7k
    auto make_default_wrapper = [&](const auto& types) -> bool {
118
10.7k
        using Types = std::decay_t<decltype(types)>;
119
10.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
10.7k
        return call_on_index_and_data_type<
127
10.7k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
10.7k
            using Types2 = std::decay_t<decltype(types2)>;
129
10.7k
            using FromDataType = typename Types2::LeftType;
130
10.7k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
10.7k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
10.7k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
10.7k
                return false;
134
10.7k
            }
135
10.7k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
10.7k
                using FromFieldType = typename FromDataType::FieldType;
137
10.7k
                using ToFieldType = typename ToDataType::FieldType;
138
10.7k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
10.7k
                UInt32 from_scale = 0;
140
141
10.7k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
10.7k
                    const auto* from_decimal_type =
143
10.7k
                            check_and_get_data_type<FromDataType>(from_type.get());
144
10.7k
                    from_precision =
145
10.7k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
10.7k
                    from_scale = from_decimal_type->get_scale();
147
10.7k
                }
148
149
10.7k
                UInt32 to_max_digits = 0;
150
10.7k
                UInt32 to_precision = 0;
151
10.7k
                UInt32 to_scale = 0;
152
153
10.7k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
10.7k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
10.7k
                    const auto* to_decimal_type =
157
10.7k
                            check_and_get_data_type<ToDataType>(to_type.get());
158
10.7k
                    to_precision = to_decimal_type->get_precision();
159
10.7k
                    ToDataType::check_type_precision(to_precision);
160
161
10.7k
                    to_scale = to_decimal_type->get_scale();
162
10.7k
                    ToDataType::check_type_scale(to_scale);
163
10.7k
                }
164
10.7k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
10.7k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
10.7k
                    to_precision = to_max_digits;
167
10.7k
                }
168
169
10.7k
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
10.7k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
10.7k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
10.7k
                if (to_scale > from_scale) {
174
10.7k
                    multiply_may_overflow &=
175
10.7k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
10.7k
                }
177
10.7k
                return narrow_integral || multiply_may_overflow;
178
10.7k
            }
179
10.7k
            return false;
180
10.7k
        });
181
10.7k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE9EEEvEEEEbRKT_
Line
Count
Source
117
24.9k
    auto make_default_wrapper = [&](const auto& types) -> bool {
118
24.9k
        using Types = std::decay_t<decltype(types)>;
119
24.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
24.9k
        return call_on_index_and_data_type<
127
24.9k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
24.9k
            using Types2 = std::decay_t<decltype(types2)>;
129
24.9k
            using FromDataType = typename Types2::LeftType;
130
24.9k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
24.9k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
24.9k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
24.9k
                return false;
134
24.9k
            }
135
24.9k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
24.9k
                using FromFieldType = typename FromDataType::FieldType;
137
24.9k
                using ToFieldType = typename ToDataType::FieldType;
138
24.9k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
24.9k
                UInt32 from_scale = 0;
140
141
24.9k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
24.9k
                    const auto* from_decimal_type =
143
24.9k
                            check_and_get_data_type<FromDataType>(from_type.get());
144
24.9k
                    from_precision =
145
24.9k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
24.9k
                    from_scale = from_decimal_type->get_scale();
147
24.9k
                }
148
149
24.9k
                UInt32 to_max_digits = 0;
150
24.9k
                UInt32 to_precision = 0;
151
24.9k
                UInt32 to_scale = 0;
152
153
24.9k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
24.9k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
24.9k
                    const auto* to_decimal_type =
157
24.9k
                            check_and_get_data_type<ToDataType>(to_type.get());
158
24.9k
                    to_precision = to_decimal_type->get_precision();
159
24.9k
                    ToDataType::check_type_precision(to_precision);
160
161
24.9k
                    to_scale = to_decimal_type->get_scale();
162
24.9k
                    ToDataType::check_type_scale(to_scale);
163
24.9k
                }
164
24.9k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
24.9k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
24.9k
                    to_precision = to_max_digits;
167
24.9k
                }
168
169
24.9k
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
24.9k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
24.9k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
24.9k
                if (to_scale > from_scale) {
174
24.9k
                    multiply_may_overflow &=
175
24.9k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
24.9k
                }
177
24.9k
                return narrow_integral || multiply_may_overflow;
178
24.9k
            }
179
24.9k
            return false;
180
24.9k
        });
181
24.9k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_
Line
Count
Source
117
7.71k
    auto make_default_wrapper = [&](const auto& types) -> bool {
118
7.71k
        using Types = std::decay_t<decltype(types)>;
119
7.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
7.71k
        return call_on_index_and_data_type<
127
7.71k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
7.71k
            using Types2 = std::decay_t<decltype(types2)>;
129
7.71k
            using FromDataType = typename Types2::LeftType;
130
7.71k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
7.71k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
7.71k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
7.71k
                return false;
134
7.71k
            }
135
7.71k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
7.71k
                using FromFieldType = typename FromDataType::FieldType;
137
7.71k
                using ToFieldType = typename ToDataType::FieldType;
138
7.71k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
7.71k
                UInt32 from_scale = 0;
140
141
7.71k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
7.71k
                    const auto* from_decimal_type =
143
7.71k
                            check_and_get_data_type<FromDataType>(from_type.get());
144
7.71k
                    from_precision =
145
7.71k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
7.71k
                    from_scale = from_decimal_type->get_scale();
147
7.71k
                }
148
149
7.71k
                UInt32 to_max_digits = 0;
150
7.71k
                UInt32 to_precision = 0;
151
7.71k
                UInt32 to_scale = 0;
152
153
7.71k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
7.71k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
7.71k
                    const auto* to_decimal_type =
157
7.71k
                            check_and_get_data_type<ToDataType>(to_type.get());
158
7.71k
                    to_precision = to_decimal_type->get_precision();
159
7.71k
                    ToDataType::check_type_precision(to_precision);
160
161
7.71k
                    to_scale = to_decimal_type->get_scale();
162
7.71k
                    ToDataType::check_type_scale(to_scale);
163
7.71k
                }
164
7.71k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
7.71k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
7.71k
                    to_precision = to_max_digits;
167
7.71k
                }
168
169
7.71k
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
7.71k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
7.71k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
7.71k
                if (to_scale > from_scale) {
174
7.71k
                    multiply_may_overflow &=
175
7.71k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
7.71k
                }
177
7.71k
                return narrow_integral || multiply_may_overflow;
178
7.71k
            }
179
7.71k
            return false;
180
7.71k
        });
181
7.71k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_
Line
Count
Source
117
11.9k
    auto make_default_wrapper = [&](const auto& types) -> bool {
118
11.9k
        using Types = std::decay_t<decltype(types)>;
119
11.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
11.9k
        return call_on_index_and_data_type<
127
11.9k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
11.9k
            using Types2 = std::decay_t<decltype(types2)>;
129
11.9k
            using FromDataType = typename Types2::LeftType;
130
11.9k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
11.9k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
11.9k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
11.9k
                return false;
134
11.9k
            }
135
11.9k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
11.9k
                using FromFieldType = typename FromDataType::FieldType;
137
11.9k
                using ToFieldType = typename ToDataType::FieldType;
138
11.9k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
11.9k
                UInt32 from_scale = 0;
140
141
11.9k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
11.9k
                    const auto* from_decimal_type =
143
11.9k
                            check_and_get_data_type<FromDataType>(from_type.get());
144
11.9k
                    from_precision =
145
11.9k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
11.9k
                    from_scale = from_decimal_type->get_scale();
147
11.9k
                }
148
149
11.9k
                UInt32 to_max_digits = 0;
150
11.9k
                UInt32 to_precision = 0;
151
11.9k
                UInt32 to_scale = 0;
152
153
11.9k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
11.9k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
11.9k
                    const auto* to_decimal_type =
157
11.9k
                            check_and_get_data_type<ToDataType>(to_type.get());
158
11.9k
                    to_precision = to_decimal_type->get_precision();
159
11.9k
                    ToDataType::check_type_precision(to_precision);
160
161
11.9k
                    to_scale = to_decimal_type->get_scale();
162
11.9k
                    ToDataType::check_type_scale(to_scale);
163
11.9k
                }
164
11.9k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
11.9k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
11.9k
                    to_precision = to_max_digits;
167
11.9k
                }
168
169
11.9k
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
11.9k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
11.9k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
11.9k
                if (to_scale > from_scale) {
174
11.9k
                    multiply_may_overflow &=
175
11.9k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
11.9k
                }
177
11.9k
                return narrow_integral || multiply_may_overflow;
178
11.9k
            }
179
11.9k
            return false;
180
11.9k
        });
181
11.9k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_
Line
Count
Source
117
229
    auto make_default_wrapper = [&](const auto& types) -> bool {
118
229
        using Types = std::decay_t<decltype(types)>;
119
229
        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
229
        return call_on_index_and_data_type<
127
229
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
229
            using Types2 = std::decay_t<decltype(types2)>;
129
229
            using FromDataType = typename Types2::LeftType;
130
229
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
229
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
229
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
229
                return false;
134
229
            }
135
229
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
229
                using FromFieldType = typename FromDataType::FieldType;
137
229
                using ToFieldType = typename ToDataType::FieldType;
138
229
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
229
                UInt32 from_scale = 0;
140
141
229
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
229
                    const auto* from_decimal_type =
143
229
                            check_and_get_data_type<FromDataType>(from_type.get());
144
229
                    from_precision =
145
229
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
229
                    from_scale = from_decimal_type->get_scale();
147
229
                }
148
149
229
                UInt32 to_max_digits = 0;
150
229
                UInt32 to_precision = 0;
151
229
                UInt32 to_scale = 0;
152
153
229
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
229
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
229
                    const auto* to_decimal_type =
157
229
                            check_and_get_data_type<ToDataType>(to_type.get());
158
229
                    to_precision = to_decimal_type->get_precision();
159
229
                    ToDataType::check_type_precision(to_precision);
160
161
229
                    to_scale = to_decimal_type->get_scale();
162
229
                    ToDataType::check_type_scale(to_scale);
163
229
                }
164
229
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
229
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
229
                    to_precision = to_max_digits;
167
229
                }
168
169
229
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
229
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
229
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
229
                if (to_scale > from_scale) {
174
229
                    multiply_may_overflow &=
175
229
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
229
                }
177
229
                return narrow_integral || multiply_may_overflow;
178
229
            }
179
229
            return false;
180
229
        });
181
229
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_
Line
Count
Source
117
12.7k
    auto make_default_wrapper = [&](const auto& types) -> bool {
118
12.7k
        using Types = std::decay_t<decltype(types)>;
119
12.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
12.7k
        return call_on_index_and_data_type<
127
12.7k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
12.7k
            using Types2 = std::decay_t<decltype(types2)>;
129
12.7k
            using FromDataType = typename Types2::LeftType;
130
12.7k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
12.7k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
12.7k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
12.7k
                return false;
134
12.7k
            }
135
12.7k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
12.7k
                using FromFieldType = typename FromDataType::FieldType;
137
12.7k
                using ToFieldType = typename ToDataType::FieldType;
138
12.7k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
12.7k
                UInt32 from_scale = 0;
140
141
12.7k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
12.7k
                    const auto* from_decimal_type =
143
12.7k
                            check_and_get_data_type<FromDataType>(from_type.get());
144
12.7k
                    from_precision =
145
12.7k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
12.7k
                    from_scale = from_decimal_type->get_scale();
147
12.7k
                }
148
149
12.7k
                UInt32 to_max_digits = 0;
150
12.7k
                UInt32 to_precision = 0;
151
12.7k
                UInt32 to_scale = 0;
152
153
12.7k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
12.7k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
12.7k
                    const auto* to_decimal_type =
157
12.7k
                            check_and_get_data_type<ToDataType>(to_type.get());
158
12.7k
                    to_precision = to_decimal_type->get_precision();
159
12.7k
                    ToDataType::check_type_precision(to_precision);
160
161
12.7k
                    to_scale = to_decimal_type->get_scale();
162
12.7k
                    ToDataType::check_type_scale(to_scale);
163
12.7k
                }
164
12.7k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
12.7k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
12.7k
                    to_precision = to_max_digits;
167
12.7k
                }
168
169
12.7k
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
12.7k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
12.7k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
12.7k
                if (to_scale > from_scale) {
174
12.7k
                    multiply_may_overflow &=
175
12.7k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
12.7k
                }
177
12.7k
                return narrow_integral || multiply_may_overflow;
178
12.7k
            }
179
12.7k
            return false;
180
12.7k
        });
181
12.7k
    };
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.02k
    auto make_default_wrapper = [&](const auto& types) -> bool {
118
7.02k
        using Types = std::decay_t<decltype(types)>;
119
7.02k
        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.02k
        return call_on_index_and_data_type<
127
7.02k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
7.02k
            using Types2 = std::decay_t<decltype(types2)>;
129
7.02k
            using FromDataType = typename Types2::LeftType;
130
7.02k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
7.02k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
7.02k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
7.02k
                return false;
134
7.02k
            }
135
7.02k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
7.02k
                using FromFieldType = typename FromDataType::FieldType;
137
7.02k
                using ToFieldType = typename ToDataType::FieldType;
138
7.02k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
7.02k
                UInt32 from_scale = 0;
140
141
7.02k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
7.02k
                    const auto* from_decimal_type =
143
7.02k
                            check_and_get_data_type<FromDataType>(from_type.get());
144
7.02k
                    from_precision =
145
7.02k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
7.02k
                    from_scale = from_decimal_type->get_scale();
147
7.02k
                }
148
149
7.02k
                UInt32 to_max_digits = 0;
150
7.02k
                UInt32 to_precision = 0;
151
7.02k
                UInt32 to_scale = 0;
152
153
7.02k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
7.02k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
7.02k
                    const auto* to_decimal_type =
157
7.02k
                            check_and_get_data_type<ToDataType>(to_type.get());
158
7.02k
                    to_precision = to_decimal_type->get_precision();
159
7.02k
                    ToDataType::check_type_precision(to_precision);
160
161
7.02k
                    to_scale = to_decimal_type->get_scale();
162
7.02k
                    ToDataType::check_type_scale(to_scale);
163
7.02k
                }
164
7.02k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
7.02k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
7.02k
                    to_precision = to_max_digits;
167
7.02k
                }
168
169
7.02k
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
7.02k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
7.02k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
7.02k
                if (to_scale > from_scale) {
174
7.02k
                    multiply_may_overflow &=
175
7.02k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
7.02k
                }
177
7.02k
                return narrow_integral || multiply_may_overflow;
178
7.02k
            }
179
7.02k
            return false;
180
7.02k
        });
181
7.02k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_
Line
Count
Source
117
4.52k
    auto make_default_wrapper = [&](const auto& types) -> bool {
118
4.52k
        using Types = std::decay_t<decltype(types)>;
119
4.52k
        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.52k
        return call_on_index_and_data_type<
127
4.52k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
4.52k
            using Types2 = std::decay_t<decltype(types2)>;
129
4.52k
            using FromDataType = typename Types2::LeftType;
130
4.52k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
4.52k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
4.52k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
4.52k
                return false;
134
4.52k
            }
135
4.52k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
4.52k
                using FromFieldType = typename FromDataType::FieldType;
137
4.52k
                using ToFieldType = typename ToDataType::FieldType;
138
4.52k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
4.52k
                UInt32 from_scale = 0;
140
141
4.52k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
4.52k
                    const auto* from_decimal_type =
143
4.52k
                            check_and_get_data_type<FromDataType>(from_type.get());
144
4.52k
                    from_precision =
145
4.52k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
4.52k
                    from_scale = from_decimal_type->get_scale();
147
4.52k
                }
148
149
4.52k
                UInt32 to_max_digits = 0;
150
4.52k
                UInt32 to_precision = 0;
151
4.52k
                UInt32 to_scale = 0;
152
153
4.52k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
4.52k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
4.52k
                    const auto* to_decimal_type =
157
4.52k
                            check_and_get_data_type<ToDataType>(to_type.get());
158
4.52k
                    to_precision = to_decimal_type->get_precision();
159
4.52k
                    ToDataType::check_type_precision(to_precision);
160
161
4.52k
                    to_scale = to_decimal_type->get_scale();
162
4.52k
                    ToDataType::check_type_scale(to_scale);
163
4.52k
                }
164
4.52k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
4.52k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
4.52k
                    to_precision = to_max_digits;
167
4.52k
                }
168
169
4.52k
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
4.52k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
4.52k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
4.52k
                if (to_scale > from_scale) {
174
4.52k
                    multiply_may_overflow &=
175
4.52k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
4.52k
                }
177
4.52k
                return narrow_integral || multiply_may_overflow;
178
4.52k
            }
179
4.52k
            return false;
180
4.52k
        });
181
4.52k
    };
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
461
    auto make_default_wrapper = [&](const auto& types) -> bool {
118
461
        using Types = std::decay_t<decltype(types)>;
119
461
        using ToDataType = typename Types::LeftType;
120
121
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
122
                        IsDatelikeV2Types<ToDataType> ||
123
461
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
124
461
            return false;
125
461
        }
126
0
        return call_on_index_and_data_type<
127
461
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
461
            using Types2 = std::decay_t<decltype(types2)>;
129
461
            using FromDataType = typename Types2::LeftType;
130
461
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
461
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
461
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
461
                return false;
134
461
            }
135
461
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
461
                using FromFieldType = typename FromDataType::FieldType;
137
461
                using ToFieldType = typename ToDataType::FieldType;
138
461
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
461
                UInt32 from_scale = 0;
140
141
461
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
461
                    const auto* from_decimal_type =
143
461
                            check_and_get_data_type<FromDataType>(from_type.get());
144
461
                    from_precision =
145
461
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
461
                    from_scale = from_decimal_type->get_scale();
147
461
                }
148
149
461
                UInt32 to_max_digits = 0;
150
461
                UInt32 to_precision = 0;
151
461
                UInt32 to_scale = 0;
152
153
461
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
461
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
461
                    const auto* to_decimal_type =
157
461
                            check_and_get_data_type<ToDataType>(to_type.get());
158
461
                    to_precision = to_decimal_type->get_precision();
159
461
                    ToDataType::check_type_precision(to_precision);
160
161
461
                    to_scale = to_decimal_type->get_scale();
162
461
                    ToDataType::check_type_scale(to_scale);
163
461
                }
164
461
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
461
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
461
                    to_precision = to_max_digits;
167
461
                }
168
169
461
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
461
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
461
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
461
                if (to_scale > from_scale) {
174
461
                    multiply_may_overflow &=
175
461
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
461
                }
177
461
                return narrow_integral || multiply_may_overflow;
178
461
            }
179
461
            return false;
180
461
        });
181
461
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv4EvEEEEbRKT_
Line
Count
Source
117
633
    auto make_default_wrapper = [&](const auto& types) -> bool {
118
633
        using Types = std::decay_t<decltype(types)>;
119
633
        using ToDataType = typename Types::LeftType;
120
121
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
122
                        IsDatelikeV2Types<ToDataType> ||
123
633
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
124
633
            return false;
125
633
        }
126
0
        return call_on_index_and_data_type<
127
633
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
633
            using Types2 = std::decay_t<decltype(types2)>;
129
633
            using FromDataType = typename Types2::LeftType;
130
633
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
633
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
633
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
633
                return false;
134
633
            }
135
633
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
633
                using FromFieldType = typename FromDataType::FieldType;
137
633
                using ToFieldType = typename ToDataType::FieldType;
138
633
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
633
                UInt32 from_scale = 0;
140
141
633
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
633
                    const auto* from_decimal_type =
143
633
                            check_and_get_data_type<FromDataType>(from_type.get());
144
633
                    from_precision =
145
633
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
633
                    from_scale = from_decimal_type->get_scale();
147
633
                }
148
149
633
                UInt32 to_max_digits = 0;
150
633
                UInt32 to_precision = 0;
151
633
                UInt32 to_scale = 0;
152
153
633
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
633
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
633
                    const auto* to_decimal_type =
157
633
                            check_and_get_data_type<ToDataType>(to_type.get());
158
633
                    to_precision = to_decimal_type->get_precision();
159
633
                    ToDataType::check_type_precision(to_precision);
160
161
633
                    to_scale = to_decimal_type->get_scale();
162
633
                    ToDataType::check_type_scale(to_scale);
163
633
                }
164
633
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
633
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
633
                    to_precision = to_max_digits;
167
633
                }
168
169
633
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
633
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
633
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
633
                if (to_scale > from_scale) {
174
633
                    multiply_may_overflow &=
175
633
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
633
                }
177
633
                return narrow_integral || multiply_may_overflow;
178
633
            }
179
633
            return false;
180
633
        });
181
633
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv6EvEEEEbRKT_
Line
Count
Source
117
289
    auto make_default_wrapper = [&](const auto& types) -> bool {
118
289
        using Types = std::decay_t<decltype(types)>;
119
289
        using ToDataType = typename Types::LeftType;
120
121
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
122
                        IsDatelikeV2Types<ToDataType> ||
123
289
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
124
289
            return false;
125
289
        }
126
0
        return call_on_index_and_data_type<
127
289
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
289
            using Types2 = std::decay_t<decltype(types2)>;
129
289
            using FromDataType = typename Types2::LeftType;
130
289
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
289
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
289
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
289
                return false;
134
289
            }
135
289
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
289
                using FromFieldType = typename FromDataType::FieldType;
137
289
                using ToFieldType = typename ToDataType::FieldType;
138
289
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
289
                UInt32 from_scale = 0;
140
141
289
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
289
                    const auto* from_decimal_type =
143
289
                            check_and_get_data_type<FromDataType>(from_type.get());
144
289
                    from_precision =
145
289
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
289
                    from_scale = from_decimal_type->get_scale();
147
289
                }
148
149
289
                UInt32 to_max_digits = 0;
150
289
                UInt32 to_precision = 0;
151
289
                UInt32 to_scale = 0;
152
153
289
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
289
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
289
                    const auto* to_decimal_type =
157
289
                            check_and_get_data_type<ToDataType>(to_type.get());
158
289
                    to_precision = to_decimal_type->get_precision();
159
289
                    ToDataType::check_type_precision(to_precision);
160
161
289
                    to_scale = to_decimal_type->get_scale();
162
289
                    ToDataType::check_type_scale(to_scale);
163
289
                }
164
289
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
289
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
289
                    to_precision = to_max_digits;
167
289
                }
168
169
289
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
289
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
289
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
289
                if (to_scale > from_scale) {
174
289
                    multiply_may_overflow &=
175
289
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
289
                }
177
289
                return narrow_integral || multiply_may_overflow;
178
289
            }
179
289
            return false;
180
289
        });
181
289
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeStringEvEEEEbRKT_
Line
Count
Source
117
31.7k
    auto make_default_wrapper = [&](const auto& types) -> bool {
118
31.7k
        using Types = std::decay_t<decltype(types)>;
119
31.7k
        using ToDataType = typename Types::LeftType;
120
121
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
122
                        IsDatelikeV2Types<ToDataType> ||
123
31.7k
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
124
31.7k
            return false;
125
31.7k
        }
126
0
        return call_on_index_and_data_type<
127
31.7k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
31.7k
            using Types2 = std::decay_t<decltype(types2)>;
129
31.7k
            using FromDataType = typename Types2::LeftType;
130
31.7k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
31.7k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
31.7k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
31.7k
                return false;
134
31.7k
            }
135
31.7k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
31.7k
                using FromFieldType = typename FromDataType::FieldType;
137
31.7k
                using ToFieldType = typename ToDataType::FieldType;
138
31.7k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
31.7k
                UInt32 from_scale = 0;
140
141
31.7k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
31.7k
                    const auto* from_decimal_type =
143
31.7k
                            check_and_get_data_type<FromDataType>(from_type.get());
144
31.7k
                    from_precision =
145
31.7k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
31.7k
                    from_scale = from_decimal_type->get_scale();
147
31.7k
                }
148
149
31.7k
                UInt32 to_max_digits = 0;
150
31.7k
                UInt32 to_precision = 0;
151
31.7k
                UInt32 to_scale = 0;
152
153
31.7k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
31.7k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
31.7k
                    const auto* to_decimal_type =
157
31.7k
                            check_and_get_data_type<ToDataType>(to_type.get());
158
31.7k
                    to_precision = to_decimal_type->get_precision();
159
31.7k
                    ToDataType::check_type_precision(to_precision);
160
161
31.7k
                    to_scale = to_decimal_type->get_scale();
162
31.7k
                    ToDataType::check_type_scale(to_scale);
163
31.7k
                }
164
31.7k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
31.7k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
31.7k
                    to_precision = to_max_digits;
167
31.7k
                }
168
169
31.7k
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
31.7k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
31.7k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
31.7k
                if (to_scale > from_scale) {
174
31.7k
                    multiply_may_overflow &=
175
31.7k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
31.7k
                }
177
31.7k
                return narrow_integral || multiply_may_overflow;
178
31.7k
            }
179
31.7k
            return false;
180
31.7k
        });
181
31.7k
    };
182
183
293k
    return call_on_index_and_data_type<void>(to_type->get_primitive_type(), make_default_wrapper);
184
356k
}
185
186
WrapperType prepare_remove_nullable(FunctionContext* context, const DataTypePtr& from_type,
187
380k
                                    const DataTypePtr& to_type) {
188
    /// Determine whether pre-processing and/or post-processing must take place during conversion.
189
380k
    bool result_is_nullable = to_type->is_nullable();
190
191
380k
    if (result_is_nullable) {
192
356k
        return [from_type, to_type](FunctionContext* context, Block& block,
193
356k
                                    const ColumnNumbers& arguments, uint32_t result,
194
356k
                                    size_t input_rows_count,
195
357k
                                    const NullMap::value_type* null_map = nullptr) {
196
357k
            auto from_type_not_nullable = remove_nullable(from_type);
197
357k
            auto to_type_not_nullable = remove_nullable(to_type);
198
199
357k
            bool replace_null_data_to_default = need_replace_null_data_to_default(
200
357k
                    context, from_type_not_nullable, to_type_not_nullable);
201
202
357k
            auto nested_result_index = block.columns();
203
357k
            block.insert(block.get_by_position(result).unnest_nullable());
204
357k
            auto nested_source_index = block.columns();
205
357k
            block.insert(block.get_by_position(arguments[0])
206
357k
                                 .unnest_nullable(replace_null_data_to_default));
207
208
357k
            const auto& arg_col = block.get_by_position(arguments[0]);
209
357k
            const NullMap::value_type* arg_null_map = nullptr;
210
357k
            if (const auto* nullable = check_and_get_column<ColumnNullable>(*arg_col.column)) {
211
303k
                arg_null_map = nullable->get_null_map_data().data();
212
303k
            }
213
357k
            RETURN_IF_ERROR(prepare_impl(context, from_type_not_nullable, to_type_not_nullable)(
214
357k
                    context, block, {nested_source_index}, nested_result_index, input_rows_count,
215
357k
                    arg_null_map));
216
217
331k
            block.get_by_position(result).column =
218
331k
                    wrap_in_nullable(block.get_by_position(nested_result_index).column, block,
219
331k
                                     arguments, input_rows_count);
220
221
331k
            block.erase(nested_source_index);
222
331k
            block.erase(nested_result_index);
223
331k
            return Status::OK();
224
357k
        };
225
356k
    } else {
226
23.4k
        return prepare_impl(context, from_type, to_type);
227
23.4k
    }
228
380k
}
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
392k
                         const DataTypePtr& origin_to_type) {
234
392k
    auto to_type = get_serialized_type(origin_to_type);
235
392k
    auto from_type = get_serialized_type(origin_from_type);
236
392k
    if (from_type->equals(*to_type)) {
237
68.8k
        return create_identity_wrapper(from_type);
238
68.8k
    }
239
240
    // variant needs to be judged first
241
323k
    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
312k
    if (from_type->get_primitive_type() == PrimitiveType::TYPE_VARIANT) {
246
14.6k
        return create_cast_from_variant_wrapper(static_cast<const DataTypeVariant&>(*from_type),
247
14.6k
                                                to_type);
248
14.6k
    }
249
250
297k
    if (from_type->get_primitive_type() == PrimitiveType::TYPE_JSONB) {
251
9.32k
        return create_cast_from_jsonb_wrapper(static_cast<const DataTypeJsonb&>(*from_type),
252
9.32k
                                              to_type,
253
9.32k
                                              context ? context->jsonb_string_as_string() : false);
254
9.32k
    }
255
256
288k
    switch (to_type->get_primitive_type()) {
257
1.02k
    case PrimitiveType::TYPE_BOOLEAN:
258
1.02k
        return create_boolean_wrapper(context, from_type);
259
4.01k
    case PrimitiveType::TYPE_TINYINT:
260
4.01k
        return create_int_wrapper<DataTypeInt8>(context, from_type);
261
5.63k
    case PrimitiveType::TYPE_SMALLINT:
262
5.63k
        return create_int_wrapper<DataTypeInt16>(context, from_type);
263
28.0k
    case PrimitiveType::TYPE_INT:
264
28.0k
        return create_int_wrapper<DataTypeInt32>(context, from_type);
265
41.2k
    case PrimitiveType::TYPE_BIGINT:
266
41.2k
        return create_int_wrapper<DataTypeInt64>(context, from_type);
267
4.80k
    case PrimitiveType::TYPE_LARGEINT:
268
4.80k
        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
26.6k
    case PrimitiveType::TYPE_DOUBLE:
272
26.6k
        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
6.99k
    case PrimitiveType::TYPE_DATEV2:
278
6.99k
        return create_datelike_wrapper<DataTypeDateV2>(context, from_type);
279
4.90k
    case PrimitiveType::TYPE_DATETIMEV2:
280
4.90k
        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
7.79k
    case PrimitiveType::TYPE_DECIMAL32:
292
7.79k
        return create_decimal_wrapper<DataTypeDecimal32>(context, from_type);
293
14.9k
    case PrimitiveType::TYPE_DECIMAL64:
294
14.9k
        return create_decimal_wrapper<DataTypeDecimal64>(context, from_type);
295
14.5k
    case PrimitiveType::TYPE_DECIMAL128I:
296
14.5k
        return create_decimal_wrapper<DataTypeDecimal128>(context, from_type);
297
11.0k
    case PrimitiveType::TYPE_DECIMAL256:
298
11.0k
        return create_decimal_wrapper<DataTypeDecimal256>(context, from_type);
299
33
    case PrimitiveType::TYPE_CHAR:
300
4.74k
    case PrimitiveType::TYPE_VARCHAR:
301
28.4k
    case PrimitiveType::TYPE_STRING:
302
28.4k
        return create_string_wrapper(from_type);
303
14.1k
    case PrimitiveType::TYPE_ARRAY:
304
14.1k
        return create_array_wrapper(context, from_type,
305
14.1k
                                    static_cast<const DataTypeArray&>(*to_type));
306
1.34k
    case PrimitiveType::TYPE_STRUCT:
307
1.34k
        return create_struct_wrapper(context, from_type,
308
1.34k
                                     static_cast<const DataTypeStruct&>(*to_type));
309
948
    case PrimitiveType::TYPE_MAP:
310
948
        return create_map_wrapper(context, from_type, static_cast<const DataTypeMap&>(*to_type));
311
0
    case PrimitiveType::TYPE_HLL:
312
0
        return create_hll_wrapper(context, from_type, static_cast<const DataTypeHLL&>(*to_type));
313
1
    case PrimitiveType::TYPE_BITMAP:
314
1
        return create_bitmap_wrapper(context, from_type,
315
1
                                     static_cast<const DataTypeBitMap&>(*to_type));
316
0
    case PrimitiveType::TYPE_QUANTILE_STATE:
317
0
        return create_quantile_state_wrapper(context, from_type,
318
0
                                             static_cast<const DataTypeQuantileState&>(*to_type));
319
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
288k
    }
327
328
0
    return create_unsupport_wrapper(from_type->get_name(), to_type->get_name());
329
288k
}
330
331
} // namespace CastWrapper
332
333
class PreparedFunctionCast : public PreparedFunctionImpl {
334
public:
335
    explicit PreparedFunctionCast(CastWrapper::WrapperType&& wrapper_function_, const char* name_)
336
370k
            : 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
370k
                        uint32_t result, size_t input_rows_count) const override {
343
370k
        return wrapper_function(context, block, arguments, result, input_rows_count, nullptr);
344
370k
    }
345
346
370k
    bool use_default_implementation_for_nulls() const override { return false; }
347
370k
    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
286k
            : name(name_),
358
286k
              argument_types(std::move(argument_types_)),
359
286k
              return_type(std::move(return_type_)) {}
360
361
370k
    const DataTypes& get_argument_types() const override { return argument_types; }
362
370k
    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
370k
                                uint32_t /*result*/) const override {
367
370k
        return std::make_shared<PreparedFunctionCast>(
368
370k
                CastWrapper::prepare_unpack_dictionaries(context, get_argument_types()[0],
369
370k
                                                         get_return_type()),
370
370k
                name);
371
370k
    }
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
286k
    static FunctionBuilderPtr create() { return std::make_shared<FunctionBuilderCast>(); }
388
389
286k
    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
286k
                               const DataTypePtr& return_type) const override {
400
286k
        DataTypes data_types(arguments.size());
401
402
858k
        for (size_t i = 0; i < arguments.size(); ++i) {
403
572k
            data_types[i] = arguments[i].type;
404
572k
        }
405
406
286k
        return std::make_shared<FunctionCast>(name, data_types, return_type);
407
286k
    }
408
409
286k
    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