Coverage Report

Created: 2026-03-17 14:27

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
369k
                                        const DataTypePtr& to_type) {
87
369k
    const auto& from_nested = from_type;
88
369k
    const auto& to_nested = to_type;
89
90
369k
    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
368k
    auto wrapper = prepare_remove_nullable(context, from_nested, to_nested);
107
108
368k
    return wrapper;
109
369k
}
110
111
bool need_replace_null_data_to_default(FunctionContext* context, const DataTypePtr& from_type,
112
344k
                                       const DataTypePtr& to_type) {
113
344k
    if (from_type->equals(*to_type)) {
114
63.6k
        return false;
115
63.6k
    }
116
117
281k
    auto make_default_wrapper = [&](const auto& types) -> bool {
118
195k
        using Types = std::decay_t<decltype(types)>;
119
195k
        using ToDataType = typename Types::LeftType;
120
121
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
122
                        IsDatelikeV2Types<ToDataType> ||
123
32.3k
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
124
32.3k
            return false;
125
32.3k
        }
126
0
        return call_on_index_and_data_type<
127
195k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
142k
            using Types2 = std::decay_t<decltype(types2)>;
129
142k
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
74.3k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
74.3k
                return false;
134
74.3k
            }
135
39.6k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
39.6k
                using FromFieldType = typename FromDataType::FieldType;
137
39.6k
                using ToFieldType = typename ToDataType::FieldType;
138
39.6k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
39.6k
                UInt32 from_scale = 0;
140
141
39.6k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
15.9k
                    const auto* from_decimal_type =
143
15.9k
                            check_and_get_data_type<FromDataType>(from_type.get());
144
15.9k
                    from_precision =
145
15.9k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
15.9k
                    from_scale = from_decimal_type->get_scale();
147
15.9k
                }
148
149
39.6k
                UInt32 to_max_digits = 0;
150
39.6k
                UInt32 to_precision = 0;
151
39.6k
                UInt32 to_scale = 0;
152
153
39.6k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
34.9k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
34.9k
                    const auto* to_decimal_type =
157
34.9k
                            check_and_get_data_type<ToDataType>(to_type.get());
158
34.9k
                    to_precision = to_decimal_type->get_precision();
159
34.9k
                    ToDataType::check_type_precision(to_precision);
160
161
34.9k
                    to_scale = to_decimal_type->get_scale();
162
34.9k
                    ToDataType::check_type_scale(to_scale);
163
34.9k
                }
164
39.6k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
4.69k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
4.69k
                    to_precision = to_max_digits;
167
4.69k
                }
168
169
39.6k
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
39.6k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
39.6k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
39.6k
                if (to_scale > from_scale) {
174
9.85k
                    multiply_may_overflow &=
175
9.85k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
9.85k
                }
177
39.6k
                return narrow_integral || multiply_may_overflow;
178
39.6k
            }
179
0
            return false;
180
142k
        });
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
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_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
685
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
685
            using Types2 = std::decay_t<decltype(types2)>;
129
685
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
685
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
685
                return false;
134
685
            }
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
685
            return false;
180
685
        });
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
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
            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
303
            return false;
180
303
        });
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
236
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
236
            using Types2 = std::decay_t<decltype(types2)>;
129
236
            using FromDataType = typename 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
236
            return false;
180
236
        });
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
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_13PrimitiveTypeE3EEEvEEEEbRKT_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_13PrimitiveTypeE3EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_29EEESE_EEEEbSI_
Line
Count
Source
127
24
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
24
            using Types2 = std::decay_t<decltype(types2)>;
129
24
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
24
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
24
                using FromFieldType = typename FromDataType::FieldType;
137
24
                using ToFieldType = typename ToDataType::FieldType;
138
24
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
24
                UInt32 from_scale = 0;
140
141
24
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
24
                    const auto* from_decimal_type =
143
24
                            check_and_get_data_type<FromDataType>(from_type.get());
144
24
                    from_precision =
145
24
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
24
                    from_scale = from_decimal_type->get_scale();
147
24
                }
148
149
24
                UInt32 to_max_digits = 0;
150
24
                UInt32 to_precision = 0;
151
24
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
24
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
24
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
24
                    to_precision = to_max_digits;
167
24
                }
168
169
24
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
24
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
24
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
24
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
24
                return narrow_integral || multiply_may_overflow;
178
24
            }
179
0
            return false;
180
24
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_20EEESE_EEEEbSI_
Line
Count
Source
127
8
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
8
            using Types2 = std::decay_t<decltype(types2)>;
129
8
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
8
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
8
                using FromFieldType = typename FromDataType::FieldType;
137
8
                using ToFieldType = typename ToDataType::FieldType;
138
8
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
8
                UInt32 from_scale = 0;
140
141
8
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
8
                    const auto* from_decimal_type =
143
8
                            check_and_get_data_type<FromDataType>(from_type.get());
144
8
                    from_precision =
145
8
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
8
                    from_scale = from_decimal_type->get_scale();
147
8
                }
148
149
8
                UInt32 to_max_digits = 0;
150
8
                UInt32 to_precision = 0;
151
8
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
8
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
8
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
8
                    to_precision = to_max_digits;
167
8
                }
168
169
8
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
8
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
8
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
8
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
8
                return narrow_integral || multiply_may_overflow;
178
8
            }
179
0
            return false;
180
8
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_30EEESE_EEEEbSI_
Line
Count
Source
127
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_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.31k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
2.31k
            using Types2 = std::decay_t<decltype(types2)>;
129
2.31k
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
2.31k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
2.31k
                return false;
134
2.31k
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
2.31k
            return false;
180
2.31k
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_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.01k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
2.01k
            using Types2 = std::decay_t<decltype(types2)>;
129
2.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
2.01k
            return false;
180
2.01k
        });
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
253
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
253
            using Types2 = std::decay_t<decltype(types2)>;
129
253
            using FromDataType = typename 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
253
            return false;
180
253
        });
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
15
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
15
            using Types2 = std::decay_t<decltype(types2)>;
129
15
            using FromDataType = typename 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
15
            return false;
180
15
        });
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
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
        });
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.14k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
2.14k
            using Types2 = std::decay_t<decltype(types2)>;
129
2.14k
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
2.14k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
2.14k
                return false;
134
2.14k
            }
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.14k
            return false;
180
2.14k
        });
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.54k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
1.54k
            using Types2 = std::decay_t<decltype(types2)>;
129
1.54k
            using FromDataType = typename 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.54k
            return false;
180
1.54k
        });
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
368
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
368
            using Types2 = std::decay_t<decltype(types2)>;
129
368
            using FromDataType = typename 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
368
            return false;
180
368
        });
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.47k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
1.47k
            using Types2 = std::decay_t<decltype(types2)>;
129
1.47k
            using FromDataType = typename 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.47k
            return false;
180
1.47k
        });
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
94
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
94
            using Types2 = std::decay_t<decltype(types2)>;
129
94
            using FromDataType = typename 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
94
            return false;
180
94
        });
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
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
138
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
138
                using FromFieldType = typename FromDataType::FieldType;
137
138
                using ToFieldType = typename ToDataType::FieldType;
138
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
138
                UInt32 from_scale = 0;
140
141
138
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
138
                    const auto* from_decimal_type =
143
138
                            check_and_get_data_type<FromDataType>(from_type.get());
144
138
                    from_precision =
145
138
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
138
                    from_scale = from_decimal_type->get_scale();
147
138
                }
148
149
138
                UInt32 to_max_digits = 0;
150
138
                UInt32 to_precision = 0;
151
138
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
138
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
138
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
138
                    to_precision = to_max_digits;
167
138
                }
168
169
138
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
138
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
138
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
138
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
138
                return narrow_integral || multiply_may_overflow;
178
138
            }
179
0
            return false;
180
138
        });
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.4k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
17.4k
            using Types2 = std::decay_t<decltype(types2)>;
129
17.4k
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
17.4k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
17.4k
                return false;
134
17.4k
            }
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.4k
            return false;
180
17.4k
        });
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
347
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
347
            using Types2 = std::decay_t<decltype(types2)>;
129
347
            using FromDataType = typename 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
347
            return false;
180
347
        });
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
578
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
578
            using Types2 = std::decay_t<decltype(types2)>;
129
578
            using FromDataType = typename 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
578
            return false;
180
578
        });
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.21k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
5.21k
            using Types2 = std::decay_t<decltype(types2)>;
129
5.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
            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.21k
            return false;
180
5.21k
        });
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
288
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
288
            using Types2 = std::decay_t<decltype(types2)>;
129
288
            using FromDataType = typename 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
288
            return false;
180
288
        });
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
629
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
629
            using Types2 = std::decay_t<decltype(types2)>;
129
629
            using FromDataType = typename 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
629
            return false;
180
629
        });
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.31k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
2.31k
            using Types2 = std::decay_t<decltype(types2)>;
129
2.31k
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            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.31k
            return false;
180
2.31k
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_28EEESE_EEEEbSI_
Line
Count
Source
127
310
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
310
            using Types2 = std::decay_t<decltype(types2)>;
129
310
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
310
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
310
                using FromFieldType = typename FromDataType::FieldType;
137
310
                using ToFieldType = typename ToDataType::FieldType;
138
310
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
310
                UInt32 from_scale = 0;
140
141
310
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
310
                    const auto* from_decimal_type =
143
310
                            check_and_get_data_type<FromDataType>(from_type.get());
144
310
                    from_precision =
145
310
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
310
                    from_scale = from_decimal_type->get_scale();
147
310
                }
148
149
310
                UInt32 to_max_digits = 0;
150
310
                UInt32 to_precision = 0;
151
310
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
310
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
310
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
310
                    to_precision = to_max_digits;
167
310
                }
168
169
310
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
310
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
310
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
310
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
310
                return narrow_integral || multiply_may_overflow;
178
310
            }
179
0
            return false;
180
310
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_29EEESE_EEEEbSI_
Line
Count
Source
127
314
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
314
            using Types2 = std::decay_t<decltype(types2)>;
129
314
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
314
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
314
                using FromFieldType = typename FromDataType::FieldType;
137
314
                using ToFieldType = typename ToDataType::FieldType;
138
314
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
314
                UInt32 from_scale = 0;
140
141
314
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
314
                    const auto* from_decimal_type =
143
314
                            check_and_get_data_type<FromDataType>(from_type.get());
144
314
                    from_precision =
145
314
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
314
                    from_scale = from_decimal_type->get_scale();
147
314
                }
148
149
314
                UInt32 to_max_digits = 0;
150
314
                UInt32 to_precision = 0;
151
314
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
314
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
314
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
314
                    to_precision = to_max_digits;
167
314
                }
168
169
314
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
314
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
314
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
314
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
315
                return narrow_integral || multiply_may_overflow;
178
314
            }
179
0
            return false;
180
314
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_20EEESE_EEEEbSI_
Line
Count
Source
127
301
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
301
            using Types2 = std::decay_t<decltype(types2)>;
129
301
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
301
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
301
                using FromFieldType = typename FromDataType::FieldType;
137
301
                using ToFieldType = typename ToDataType::FieldType;
138
301
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
301
                UInt32 from_scale = 0;
140
141
301
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
301
                    const auto* from_decimal_type =
143
301
                            check_and_get_data_type<FromDataType>(from_type.get());
144
301
                    from_precision =
145
301
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
301
                    from_scale = from_decimal_type->get_scale();
147
301
                }
148
149
301
                UInt32 to_max_digits = 0;
150
301
                UInt32 to_precision = 0;
151
301
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
301
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
301
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
301
                    to_precision = to_max_digits;
167
301
                }
168
169
301
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
301
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
301
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
301
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
301
                return narrow_integral || multiply_may_overflow;
178
301
            }
179
0
            return false;
180
301
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_30EEESE_EEEEbSI_
Line
Count
Source
127
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
612
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
612
                    const auto* from_decimal_type =
143
612
                            check_and_get_data_type<FromDataType>(from_type.get());
144
612
                    from_precision =
145
612
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
612
                    from_scale = from_decimal_type->get_scale();
147
612
                }
148
149
612
                UInt32 to_max_digits = 0;
150
612
                UInt32 to_precision = 0;
151
612
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
612
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
612
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
612
                    to_precision = to_max_digits;
167
612
                }
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
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
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_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.23k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
1.23k
            using Types2 = std::decay_t<decltype(types2)>;
129
1.23k
            using FromDataType = typename 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.23k
            return false;
180
1.23k
        });
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.24k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
1.24k
            using Types2 = std::decay_t<decltype(types2)>;
129
1.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
1.24k
            return false;
180
1.24k
        });
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.1k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
18.1k
            using Types2 = std::decay_t<decltype(types2)>;
129
18.1k
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
18.1k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
18.1k
                return false;
134
18.1k
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
18.1k
            return false;
180
18.1k
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_2EEESE_EEEEbSI_
Line
Count
Source
127
130
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
130
            using Types2 = std::decay_t<decltype(types2)>;
129
130
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
130
            return false;
180
130
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_3EEESE_EEEEbSI_
Line
Count
Source
127
108
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
108
            using Types2 = std::decay_t<decltype(types2)>;
129
108
            using FromDataType = typename 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
108
            return false;
180
108
        });
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
76
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
76
            using Types2 = std::decay_t<decltype(types2)>;
129
76
            using FromDataType = typename 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
76
            return false;
180
76
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_5EEESE_EEEEbSI_
Line
Count
Source
127
133
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
133
            using Types2 = std::decay_t<decltype(types2)>;
129
133
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
133
            return false;
180
133
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_6EEESE_EEEEbSI_
Line
Count
Source
127
574
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
574
            using Types2 = std::decay_t<decltype(types2)>;
129
574
            using FromDataType = typename 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
574
            return false;
180
574
        });
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
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
441
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
441
                    const auto* from_decimal_type =
143
441
                            check_and_get_data_type<FromDataType>(from_type.get());
144
441
                    from_precision =
145
441
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
441
                    from_scale = from_decimal_type->get_scale();
147
441
                }
148
149
441
                UInt32 to_max_digits = 0;
150
441
                UInt32 to_precision = 0;
151
441
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
441
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
441
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
441
                    to_precision = to_max_digits;
167
441
                }
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
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
441
                return narrow_integral || multiply_may_overflow;
178
441
            }
179
0
            return false;
180
441
        });
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
1.89k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
1.89k
            using Types2 = std::decay_t<decltype(types2)>;
129
1.89k
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
1.89k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
1.89k
                return false;
134
1.89k
            }
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.89k
            return false;
180
1.89k
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE8EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_2EEESE_EEEEbSI_
Line
Count
Source
127
2
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
2
            using Types2 = std::decay_t<decltype(types2)>;
129
2
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
2
            return false;
180
2
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE8EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_3EEESE_EEEEbSI_
Line
Count
Source
127
29
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
29
            using Types2 = std::decay_t<decltype(types2)>;
129
29
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
29
            return false;
180
29
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE8EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_4EEESE_EEEEbSI_
Line
Count
Source
127
6
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
6
            using Types2 = std::decay_t<decltype(types2)>;
129
6
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
6
            return false;
180
6
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE8EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_5EEESE_EEEEbSI_
Line
Count
Source
127
18
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
18
            using Types2 = std::decay_t<decltype(types2)>;
129
18
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
18
            return false;
180
18
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE8EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_6EEESE_EEEEbSI_
Line
Count
Source
127
6
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
6
            using Types2 = std::decay_t<decltype(types2)>;
129
6
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
6
            return false;
180
6
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE8EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_7EEESE_EEEEbSI_
Line
Count
Source
127
68
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
68
            using Types2 = std::decay_t<decltype(types2)>;
129
68
            using FromDataType = typename 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
68
            return false;
180
68
        });
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
63
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
63
            using Types2 = std::decay_t<decltype(types2)>;
129
63
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
63
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
63
                using FromFieldType = typename FromDataType::FieldType;
137
63
                using ToFieldType = typename ToDataType::FieldType;
138
63
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
63
                UInt32 from_scale = 0;
140
141
63
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
63
                    const auto* from_decimal_type =
143
63
                            check_and_get_data_type<FromDataType>(from_type.get());
144
63
                    from_precision =
145
63
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
63
                    from_scale = from_decimal_type->get_scale();
147
63
                }
148
149
63
                UInt32 to_max_digits = 0;
150
63
                UInt32 to_precision = 0;
151
63
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
63
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
63
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
63
                    to_precision = to_max_digits;
167
63
                }
168
169
63
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
63
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
63
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
63
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
63
                return narrow_integral || multiply_may_overflow;
178
63
            }
179
0
            return false;
180
63
        });
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
295
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
295
            using Types2 = std::decay_t<decltype(types2)>;
129
295
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
295
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
295
                using FromFieldType = typename FromDataType::FieldType;
137
295
                using ToFieldType = typename ToDataType::FieldType;
138
295
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
295
                UInt32 from_scale = 0;
140
141
295
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
295
                    const auto* from_decimal_type =
143
295
                            check_and_get_data_type<FromDataType>(from_type.get());
144
295
                    from_precision =
145
295
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
295
                    from_scale = from_decimal_type->get_scale();
147
295
                }
148
149
295
                UInt32 to_max_digits = 0;
150
295
                UInt32 to_precision = 0;
151
295
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
295
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
295
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
295
                    to_precision = to_max_digits;
167
295
                }
168
169
295
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
295
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
295
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
295
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
295
                return narrow_integral || multiply_may_overflow;
178
295
            }
179
0
            return false;
180
295
        });
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.24k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
1.24k
            using Types2 = std::decay_t<decltype(types2)>;
129
1.24k
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
1.24k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
1.24k
                return false;
134
1.24k
            }
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.24k
            return false;
180
1.24k
        });
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
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
            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
248
            return false;
180
248
        });
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
467
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
467
            using Types2 = std::decay_t<decltype(types2)>;
129
467
            using FromDataType = typename 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
467
            return false;
180
467
        });
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.34k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
1.34k
            using Types2 = std::decay_t<decltype(types2)>;
129
1.34k
            using FromDataType = typename 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.34k
            return false;
180
1.34k
        });
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.23k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
1.23k
            using Types2 = std::decay_t<decltype(types2)>;
129
1.23k
            using FromDataType = typename 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.23k
            return false;
180
1.23k
        });
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
195
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
195
            using Types2 = std::decay_t<decltype(types2)>;
129
195
            using FromDataType = typename 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
195
            return false;
180
195
        });
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
455
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
455
            using Types2 = std::decay_t<decltype(types2)>;
129
455
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
455
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
455
                using FromFieldType = typename FromDataType::FieldType;
137
455
                using ToFieldType = typename ToDataType::FieldType;
138
455
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
455
                UInt32 from_scale = 0;
140
141
455
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
455
                    const auto* from_decimal_type =
143
455
                            check_and_get_data_type<FromDataType>(from_type.get());
144
455
                    from_precision =
145
455
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
455
                    from_scale = from_decimal_type->get_scale();
147
455
                }
148
149
455
                UInt32 to_max_digits = 0;
150
455
                UInt32 to_precision = 0;
151
455
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
455
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
455
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
455
                    to_precision = to_max_digits;
167
455
                }
168
169
455
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
455
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
455
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
455
                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
455
            }
179
0
            return false;
180
455
        });
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
327
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
327
            using Types2 = std::decay_t<decltype(types2)>;
129
327
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
327
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
327
                using FromFieldType = typename FromDataType::FieldType;
137
327
                using ToFieldType = typename ToDataType::FieldType;
138
327
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
327
                UInt32 from_scale = 0;
140
141
327
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
327
                    const auto* from_decimal_type =
143
327
                            check_and_get_data_type<FromDataType>(from_type.get());
144
327
                    from_precision =
145
327
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
327
                    from_scale = from_decimal_type->get_scale();
147
327
                }
148
149
327
                UInt32 to_max_digits = 0;
150
327
                UInt32 to_precision = 0;
151
327
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
327
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
327
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
327
                    to_precision = to_max_digits;
167
327
                }
168
169
327
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
327
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
327
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
327
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
327
                return narrow_integral || multiply_may_overflow;
178
327
            }
179
0
            return false;
180
327
        });
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
429
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
429
            using Types2 = std::decay_t<decltype(types2)>;
129
429
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
429
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
429
                using FromFieldType = typename FromDataType::FieldType;
137
429
                using ToFieldType = typename ToDataType::FieldType;
138
429
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
429
                UInt32 from_scale = 0;
140
141
429
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
429
                    const auto* from_decimal_type =
143
429
                            check_and_get_data_type<FromDataType>(from_type.get());
144
429
                    from_precision =
145
429
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
429
                    from_scale = from_decimal_type->get_scale();
147
429
                }
148
149
429
                UInt32 to_max_digits = 0;
150
429
                UInt32 to_precision = 0;
151
429
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
429
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
429
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
429
                    to_precision = to_max_digits;
167
429
                }
168
169
429
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
429
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
429
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
429
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
430
                return narrow_integral || multiply_may_overflow;
178
429
            }
179
0
            return false;
180
429
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE9EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_15DataTypeDecimalILSD_35EEESE_EEEEbSI_
Line
Count
Source
127
282
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
282
            using Types2 = std::decay_t<decltype(types2)>;
129
282
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
282
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
282
                using FromFieldType = typename FromDataType::FieldType;
137
282
                using ToFieldType = typename ToDataType::FieldType;
138
282
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
282
                UInt32 from_scale = 0;
140
141
282
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
282
                    const auto* from_decimal_type =
143
282
                            check_and_get_data_type<FromDataType>(from_type.get());
144
282
                    from_precision =
145
282
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
282
                    from_scale = from_decimal_type->get_scale();
147
282
                }
148
149
282
                UInt32 to_max_digits = 0;
150
282
                UInt32 to_precision = 0;
151
282
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
282
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
282
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
282
                    to_precision = to_max_digits;
167
282
                }
168
169
282
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
282
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
282
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
282
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
282
                return narrow_integral || multiply_may_overflow;
178
282
            }
179
0
            return false;
180
282
        });
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
5.63k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
5.63k
            using Types2 = std::decay_t<decltype(types2)>;
129
5.63k
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
5.63k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
5.63k
                return false;
134
5.63k
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
5.63k
            return false;
180
5.63k
        });
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
357
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
357
            using Types2 = std::decay_t<decltype(types2)>;
129
357
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
357
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
357
                using FromFieldType = typename FromDataType::FieldType;
137
357
                using ToFieldType = typename ToDataType::FieldType;
138
357
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
357
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
357
                UInt32 to_max_digits = 0;
150
357
                UInt32 to_precision = 0;
151
357
                UInt32 to_scale = 0;
152
153
357
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
357
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
357
                    const auto* to_decimal_type =
157
357
                            check_and_get_data_type<ToDataType>(to_type.get());
158
357
                    to_precision = to_decimal_type->get_precision();
159
357
                    ToDataType::check_type_precision(to_precision);
160
161
357
                    to_scale = to_decimal_type->get_scale();
162
357
                    ToDataType::check_type_scale(to_scale);
163
357
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
357
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
357
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
357
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
357
                if (to_scale > from_scale) {
174
224
                    multiply_may_overflow &=
175
224
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
224
                }
177
357
                return narrow_integral || multiply_may_overflow;
178
357
            }
179
0
            return false;
180
357
        });
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
353
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
353
            using Types2 = std::decay_t<decltype(types2)>;
129
353
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
353
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
353
                using FromFieldType = typename FromDataType::FieldType;
137
353
                using ToFieldType = typename ToDataType::FieldType;
138
353
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
353
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
353
                UInt32 to_max_digits = 0;
150
353
                UInt32 to_precision = 0;
151
353
                UInt32 to_scale = 0;
152
153
353
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
353
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
353
                    const auto* to_decimal_type =
157
353
                            check_and_get_data_type<ToDataType>(to_type.get());
158
353
                    to_precision = to_decimal_type->get_precision();
159
353
                    ToDataType::check_type_precision(to_precision);
160
161
353
                    to_scale = to_decimal_type->get_scale();
162
353
                    ToDataType::check_type_scale(to_scale);
163
353
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
353
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
353
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
353
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
353
                if (to_scale > from_scale) {
174
182
                    multiply_may_overflow &=
175
182
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
182
                }
177
353
                return narrow_integral || multiply_may_overflow;
178
353
            }
179
0
            return false;
180
353
        });
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
365
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
365
            using Types2 = std::decay_t<decltype(types2)>;
129
365
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
365
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
365
                using FromFieldType = typename FromDataType::FieldType;
137
365
                using ToFieldType = typename ToDataType::FieldType;
138
365
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
365
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
365
                UInt32 to_max_digits = 0;
150
365
                UInt32 to_precision = 0;
151
365
                UInt32 to_scale = 0;
152
153
365
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
365
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
365
                    const auto* to_decimal_type =
157
365
                            check_and_get_data_type<ToDataType>(to_type.get());
158
365
                    to_precision = to_decimal_type->get_precision();
159
365
                    ToDataType::check_type_precision(to_precision);
160
161
365
                    to_scale = to_decimal_type->get_scale();
162
365
                    ToDataType::check_type_scale(to_scale);
163
365
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
365
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
365
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
365
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
365
                if (to_scale > from_scale) {
174
188
                    multiply_may_overflow &=
175
188
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
188
                }
177
365
                return narrow_integral || multiply_may_overflow;
178
365
            }
179
0
            return false;
180
365
        });
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
424
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
424
            using Types2 = std::decay_t<decltype(types2)>;
129
424
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
424
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
424
                using FromFieldType = typename FromDataType::FieldType;
137
424
                using ToFieldType = typename ToDataType::FieldType;
138
424
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
424
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
424
                UInt32 to_max_digits = 0;
150
424
                UInt32 to_precision = 0;
151
424
                UInt32 to_scale = 0;
152
153
424
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
424
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
424
                    const auto* to_decimal_type =
157
424
                            check_and_get_data_type<ToDataType>(to_type.get());
158
424
                    to_precision = to_decimal_type->get_precision();
159
424
                    ToDataType::check_type_precision(to_precision);
160
161
424
                    to_scale = to_decimal_type->get_scale();
162
424
                    ToDataType::check_type_scale(to_scale);
163
424
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
424
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
424
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
424
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
424
                if (to_scale > from_scale) {
174
174
                    multiply_may_overflow &=
175
174
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
174
                }
177
424
                return narrow_integral || multiply_may_overflow;
178
424
            }
179
0
            return false;
180
424
        });
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
361
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
361
            using Types2 = std::decay_t<decltype(types2)>;
129
361
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
361
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
361
                using FromFieldType = typename FromDataType::FieldType;
137
361
                using ToFieldType = typename ToDataType::FieldType;
138
361
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
361
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
361
                UInt32 to_max_digits = 0;
150
361
                UInt32 to_precision = 0;
151
361
                UInt32 to_scale = 0;
152
153
361
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
361
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
361
                    const auto* to_decimal_type =
157
361
                            check_and_get_data_type<ToDataType>(to_type.get());
158
361
                    to_precision = to_decimal_type->get_precision();
159
361
                    ToDataType::check_type_precision(to_precision);
160
161
361
                    to_scale = to_decimal_type->get_scale();
162
361
                    ToDataType::check_type_scale(to_scale);
163
361
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
361
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
361
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
361
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
361
                if (to_scale > from_scale) {
174
186
                    multiply_may_overflow &=
175
186
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
186
                }
177
361
                return narrow_integral || multiply_may_overflow;
178
361
            }
179
0
            return false;
180
361
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_8EEESE_EEEEbSI_
Line
Count
Source
127
104
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
104
            using Types2 = std::decay_t<decltype(types2)>;
129
104
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
104
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
104
                using FromFieldType = typename FromDataType::FieldType;
137
104
                using ToFieldType = typename ToDataType::FieldType;
138
104
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
104
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
104
                UInt32 to_max_digits = 0;
150
104
                UInt32 to_precision = 0;
151
104
                UInt32 to_scale = 0;
152
153
104
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
104
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
104
                    const auto* to_decimal_type =
157
104
                            check_and_get_data_type<ToDataType>(to_type.get());
158
104
                    to_precision = to_decimal_type->get_precision();
159
104
                    ToDataType::check_type_precision(to_precision);
160
161
104
                    to_scale = to_decimal_type->get_scale();
162
104
                    ToDataType::check_type_scale(to_scale);
163
104
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
104
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
104
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
104
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
104
                if (to_scale > from_scale) {
174
68
                    multiply_may_overflow &=
175
68
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
68
                }
177
104
                return narrow_integral || multiply_may_overflow;
178
104
            }
179
0
            return false;
180
104
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_9EEESE_EEEEbSI_
Line
Count
Source
127
308
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
308
            using Types2 = std::decay_t<decltype(types2)>;
129
308
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
308
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
308
                using FromFieldType = typename FromDataType::FieldType;
137
308
                using ToFieldType = typename ToDataType::FieldType;
138
308
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
308
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
308
                UInt32 to_max_digits = 0;
150
308
                UInt32 to_precision = 0;
151
308
                UInt32 to_scale = 0;
152
153
308
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
308
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
308
                    const auto* to_decimal_type =
157
308
                            check_and_get_data_type<ToDataType>(to_type.get());
158
308
                    to_precision = to_decimal_type->get_precision();
159
308
                    ToDataType::check_type_precision(to_precision);
160
161
308
                    to_scale = to_decimal_type->get_scale();
162
308
                    ToDataType::check_type_scale(to_scale);
163
308
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
308
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
308
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
308
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
308
                if (to_scale > from_scale) {
174
258
                    multiply_may_overflow &=
175
258
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
258
                }
177
308
                return narrow_integral || multiply_may_overflow;
178
308
            }
179
0
            return false;
180
308
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_ISE_SE_EEEEbSI_
Line
Count
Source
127
417
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
417
            using Types2 = std::decay_t<decltype(types2)>;
129
417
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
417
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
417
                using FromFieldType = typename FromDataType::FieldType;
137
417
                using ToFieldType = typename ToDataType::FieldType;
138
417
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
417
                UInt32 from_scale = 0;
140
141
417
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
417
                    const auto* from_decimal_type =
143
417
                            check_and_get_data_type<FromDataType>(from_type.get());
144
417
                    from_precision =
145
417
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
417
                    from_scale = from_decimal_type->get_scale();
147
417
                }
148
149
417
                UInt32 to_max_digits = 0;
150
417
                UInt32 to_precision = 0;
151
417
                UInt32 to_scale = 0;
152
153
417
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
417
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
417
                    const auto* to_decimal_type =
157
417
                            check_and_get_data_type<ToDataType>(to_type.get());
158
417
                    to_precision = to_decimal_type->get_precision();
159
417
                    ToDataType::check_type_precision(to_precision);
160
161
417
                    to_scale = to_decimal_type->get_scale();
162
417
                    ToDataType::check_type_scale(to_scale);
163
417
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
417
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
417
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
417
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
417
                if (to_scale > from_scale) {
174
90
                    multiply_may_overflow &=
175
90
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
90
                }
177
417
                return narrow_integral || multiply_may_overflow;
178
417
            }
179
0
            return false;
180
417
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_29EEESE_EEEEbSI_
Line
Count
Source
127
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
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
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
83
                    multiply_may_overflow &=
175
83
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
83
                }
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_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.50k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
2.50k
            using Types2 = std::decay_t<decltype(types2)>;
129
2.50k
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
2.50k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
2.50k
                return false;
134
2.50k
            }
135
2.50k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
2.50k
                using FromFieldType = typename FromDataType::FieldType;
137
2.50k
                using ToFieldType = typename ToDataType::FieldType;
138
2.50k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
2.50k
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_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.50k
                UInt32 to_max_digits = 0;
150
2.50k
                UInt32 to_precision = 0;
151
2.50k
                UInt32 to_scale = 0;
152
153
2.50k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
2.50k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
2.50k
                    const auto* to_decimal_type =
157
2.50k
                            check_and_get_data_type<ToDataType>(to_type.get());
158
2.50k
                    to_precision = to_decimal_type->get_precision();
159
2.50k
                    ToDataType::check_type_precision(to_precision);
160
161
2.50k
                    to_scale = to_decimal_type->get_scale();
162
2.50k
                    ToDataType::check_type_scale(to_scale);
163
2.50k
                }
164
                if constexpr (IsIntegralV<ToFieldType> || 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.50k
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
2.50k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
2.50k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
2.50k
                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.50k
                return narrow_integral || multiply_may_overflow;
178
2.50k
            }
179
0
            return false;
180
2.50k
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_2EEESE_EEEEbSI_
Line
Count
Source
127
17
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
17
            using Types2 = std::decay_t<decltype(types2)>;
129
17
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
17
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
17
                using FromFieldType = typename FromDataType::FieldType;
137
17
                using ToFieldType = typename ToDataType::FieldType;
138
17
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
17
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
17
                UInt32 to_max_digits = 0;
150
17
                UInt32 to_precision = 0;
151
17
                UInt32 to_scale = 0;
152
153
17
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
17
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
17
                    const auto* to_decimal_type =
157
17
                            check_and_get_data_type<ToDataType>(to_type.get());
158
17
                    to_precision = to_decimal_type->get_precision();
159
17
                    ToDataType::check_type_precision(to_precision);
160
161
17
                    to_scale = to_decimal_type->get_scale();
162
17
                    ToDataType::check_type_scale(to_scale);
163
17
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
17
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
17
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
17
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
17
                if (to_scale > from_scale) {
174
16
                    multiply_may_overflow &=
175
16
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
16
                }
177
17
                return narrow_integral || multiply_may_overflow;
178
17
            }
179
0
            return false;
180
17
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_3EEESE_EEEEbSI_
Line
Count
Source
127
71
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
71
            using Types2 = std::decay_t<decltype(types2)>;
129
71
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
71
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
71
                using FromFieldType = typename FromDataType::FieldType;
137
71
                using ToFieldType = typename ToDataType::FieldType;
138
71
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
71
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
71
                UInt32 to_max_digits = 0;
150
71
                UInt32 to_precision = 0;
151
71
                UInt32 to_scale = 0;
152
153
71
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
71
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
71
                    const auto* to_decimal_type =
157
71
                            check_and_get_data_type<ToDataType>(to_type.get());
158
71
                    to_precision = to_decimal_type->get_precision();
159
71
                    ToDataType::check_type_precision(to_precision);
160
161
71
                    to_scale = to_decimal_type->get_scale();
162
71
                    ToDataType::check_type_scale(to_scale);
163
71
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
71
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
71
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
71
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
71
                if (to_scale > from_scale) {
174
58
                    multiply_may_overflow &=
175
58
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
58
                }
177
71
                return narrow_integral || multiply_may_overflow;
178
71
            }
179
0
            return false;
180
71
        });
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
48
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
48
            using Types2 = std::decay_t<decltype(types2)>;
129
48
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
48
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
48
                using FromFieldType = typename FromDataType::FieldType;
137
48
                using ToFieldType = typename ToDataType::FieldType;
138
48
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
48
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
48
                UInt32 to_max_digits = 0;
150
48
                UInt32 to_precision = 0;
151
48
                UInt32 to_scale = 0;
152
153
48
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
48
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
48
                    const auto* to_decimal_type =
157
48
                            check_and_get_data_type<ToDataType>(to_type.get());
158
48
                    to_precision = to_decimal_type->get_precision();
159
48
                    ToDataType::check_type_precision(to_precision);
160
161
48
                    to_scale = to_decimal_type->get_scale();
162
48
                    ToDataType::check_type_scale(to_scale);
163
48
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
48
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
48
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
48
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
48
                if (to_scale > from_scale) {
174
38
                    multiply_may_overflow &=
175
38
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
38
                }
177
48
                return narrow_integral || multiply_may_overflow;
178
48
            }
179
0
            return false;
180
48
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_5EEESE_EEEEbSI_
Line
Count
Source
127
473
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
473
            using Types2 = std::decay_t<decltype(types2)>;
129
473
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
473
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
473
                using FromFieldType = typename FromDataType::FieldType;
137
473
                using ToFieldType = typename ToDataType::FieldType;
138
473
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
473
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
473
                UInt32 to_max_digits = 0;
150
473
                UInt32 to_precision = 0;
151
473
                UInt32 to_scale = 0;
152
153
473
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
473
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
473
                    const auto* to_decimal_type =
157
473
                            check_and_get_data_type<ToDataType>(to_type.get());
158
473
                    to_precision = to_decimal_type->get_precision();
159
473
                    ToDataType::check_type_precision(to_precision);
160
161
473
                    to_scale = to_decimal_type->get_scale();
162
473
                    ToDataType::check_type_scale(to_scale);
163
473
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
473
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
473
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
473
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
473
                if (to_scale > from_scale) {
174
318
                    multiply_may_overflow &=
175
318
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
318
                }
177
473
                return narrow_integral || multiply_may_overflow;
178
473
            }
179
0
            return false;
180
473
        });
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
52
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
52
            using Types2 = std::decay_t<decltype(types2)>;
129
52
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
52
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
52
                using FromFieldType = typename FromDataType::FieldType;
137
52
                using ToFieldType = typename ToDataType::FieldType;
138
52
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
52
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
52
                UInt32 to_max_digits = 0;
150
52
                UInt32 to_precision = 0;
151
52
                UInt32 to_scale = 0;
152
153
52
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
52
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
52
                    const auto* to_decimal_type =
157
52
                            check_and_get_data_type<ToDataType>(to_type.get());
158
52
                    to_precision = to_decimal_type->get_precision();
159
52
                    ToDataType::check_type_precision(to_precision);
160
161
52
                    to_scale = to_decimal_type->get_scale();
162
52
                    ToDataType::check_type_scale(to_scale);
163
52
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
52
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
52
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
52
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
52
                if (to_scale > from_scale) {
174
31
                    multiply_may_overflow &=
175
31
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
31
                }
177
52
                return narrow_integral || multiply_may_overflow;
178
52
            }
179
0
            return false;
180
52
        });
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
770
                    multiply_may_overflow &=
175
770
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
770
                }
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
873
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
873
            using Types2 = std::decay_t<decltype(types2)>;
129
873
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
873
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
873
                using FromFieldType = typename FromDataType::FieldType;
137
873
                using ToFieldType = typename ToDataType::FieldType;
138
873
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
873
                UInt32 from_scale = 0;
140
141
873
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
873
                    const auto* from_decimal_type =
143
873
                            check_and_get_data_type<FromDataType>(from_type.get());
144
873
                    from_precision =
145
873
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
873
                    from_scale = from_decimal_type->get_scale();
147
873
                }
148
149
873
                UInt32 to_max_digits = 0;
150
873
                UInt32 to_precision = 0;
151
873
                UInt32 to_scale = 0;
152
153
873
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
873
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
873
                    const auto* to_decimal_type =
157
873
                            check_and_get_data_type<ToDataType>(to_type.get());
158
873
                    to_precision = to_decimal_type->get_precision();
159
873
                    ToDataType::check_type_precision(to_precision);
160
161
873
                    to_scale = to_decimal_type->get_scale();
162
873
                    ToDataType::check_type_scale(to_scale);
163
873
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
873
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
873
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
873
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
873
                if (to_scale > from_scale) {
174
157
                    multiply_may_overflow &=
175
157
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
157
                }
177
873
                return narrow_integral || multiply_may_overflow;
178
873
            }
179
0
            return false;
180
873
        });
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
421
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
421
            using Types2 = std::decay_t<decltype(types2)>;
129
421
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
421
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
421
                using FromFieldType = typename FromDataType::FieldType;
137
421
                using ToFieldType = typename ToDataType::FieldType;
138
421
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
421
                UInt32 from_scale = 0;
140
141
421
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
421
                    const auto* from_decimal_type =
143
421
                            check_and_get_data_type<FromDataType>(from_type.get());
144
421
                    from_precision =
145
421
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
421
                    from_scale = from_decimal_type->get_scale();
147
421
                }
148
149
421
                UInt32 to_max_digits = 0;
150
421
                UInt32 to_precision = 0;
151
421
                UInt32 to_scale = 0;
152
153
421
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
421
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
421
                    const auto* to_decimal_type =
157
421
                            check_and_get_data_type<ToDataType>(to_type.get());
158
421
                    to_precision = to_decimal_type->get_precision();
159
421
                    ToDataType::check_type_precision(to_precision);
160
161
421
                    to_scale = to_decimal_type->get_scale();
162
421
                    ToDataType::check_type_scale(to_scale);
163
421
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
421
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
421
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
421
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
421
                if (to_scale > from_scale) {
174
144
                    multiply_may_overflow &=
175
144
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
144
                }
177
421
                return narrow_integral || multiply_may_overflow;
178
421
            }
179
0
            return false;
180
421
        });
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
6.60k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
6.60k
            using Types2 = std::decay_t<decltype(types2)>;
129
6.60k
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
6.60k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
6.60k
                return false;
134
6.60k
            }
135
6.60k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
6.60k
                using FromFieldType = typename FromDataType::FieldType;
137
6.60k
                using ToFieldType = typename ToDataType::FieldType;
138
6.60k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
6.60k
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
6.60k
                UInt32 to_max_digits = 0;
150
6.60k
                UInt32 to_precision = 0;
151
6.60k
                UInt32 to_scale = 0;
152
153
6.60k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
6.60k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
6.60k
                    const auto* to_decimal_type =
157
6.60k
                            check_and_get_data_type<ToDataType>(to_type.get());
158
6.60k
                    to_precision = to_decimal_type->get_precision();
159
6.60k
                    ToDataType::check_type_precision(to_precision);
160
161
6.60k
                    to_scale = to_decimal_type->get_scale();
162
6.60k
                    ToDataType::check_type_scale(to_scale);
163
6.60k
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
6.60k
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
6.60k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
6.60k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
6.60k
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
6.60k
                return narrow_integral || multiply_may_overflow;
178
6.60k
            }
179
0
            return false;
180
6.60k
        });
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
23
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
23
            using Types2 = std::decay_t<decltype(types2)>;
129
23
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
23
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
23
                using FromFieldType = typename FromDataType::FieldType;
137
23
                using ToFieldType = typename ToDataType::FieldType;
138
23
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
23
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
23
                UInt32 to_max_digits = 0;
150
23
                UInt32 to_precision = 0;
151
23
                UInt32 to_scale = 0;
152
153
23
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
23
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
23
                    const auto* to_decimal_type =
157
23
                            check_and_get_data_type<ToDataType>(to_type.get());
158
23
                    to_precision = to_decimal_type->get_precision();
159
23
                    ToDataType::check_type_precision(to_precision);
160
161
23
                    to_scale = to_decimal_type->get_scale();
162
23
                    ToDataType::check_type_scale(to_scale);
163
23
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
23
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
23
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
23
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
23
                if (to_scale > from_scale) {
174
22
                    multiply_may_overflow &=
175
22
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
22
                }
177
23
                return narrow_integral || multiply_may_overflow;
178
23
            }
179
0
            return false;
180
23
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_3EEESE_EEEEbSI_
Line
Count
Source
127
125
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
125
            using Types2 = std::decay_t<decltype(types2)>;
129
125
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
125
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
125
                using FromFieldType = typename FromDataType::FieldType;
137
125
                using ToFieldType = typename ToDataType::FieldType;
138
125
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
125
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
125
                UInt32 to_max_digits = 0;
150
125
                UInt32 to_precision = 0;
151
125
                UInt32 to_scale = 0;
152
153
125
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
125
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
125
                    const auto* to_decimal_type =
157
125
                            check_and_get_data_type<ToDataType>(to_type.get());
158
125
                    to_precision = to_decimal_type->get_precision();
159
125
                    ToDataType::check_type_precision(to_precision);
160
161
125
                    to_scale = to_decimal_type->get_scale();
162
125
                    ToDataType::check_type_scale(to_scale);
163
125
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
125
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
125
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
125
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
125
                if (to_scale > from_scale) {
174
92
                    multiply_may_overflow &=
175
92
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
92
                }
177
125
                return narrow_integral || multiply_may_overflow;
178
125
            }
179
0
            return false;
180
125
        });
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
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
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
112
                UInt32 to_max_digits = 0;
150
112
                UInt32 to_precision = 0;
151
112
                UInt32 to_scale = 0;
152
153
112
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
112
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
112
                    const auto* to_decimal_type =
157
112
                            check_and_get_data_type<ToDataType>(to_type.get());
158
112
                    to_precision = to_decimal_type->get_precision();
159
112
                    ToDataType::check_type_precision(to_precision);
160
161
112
                    to_scale = to_decimal_type->get_scale();
162
112
                    ToDataType::check_type_scale(to_scale);
163
112
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
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
79
                    multiply_may_overflow &=
175
79
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
79
                }
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_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_5EEESE_EEEEbSI_
Line
Count
Source
127
372
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
372
            using Types2 = std::decay_t<decltype(types2)>;
129
372
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
372
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
372
                using FromFieldType = typename FromDataType::FieldType;
137
372
                using ToFieldType = typename ToDataType::FieldType;
138
372
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
372
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
372
                UInt32 to_max_digits = 0;
150
372
                UInt32 to_precision = 0;
151
372
                UInt32 to_scale = 0;
152
153
372
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
372
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
372
                    const auto* to_decimal_type =
157
372
                            check_and_get_data_type<ToDataType>(to_type.get());
158
372
                    to_precision = to_decimal_type->get_precision();
159
372
                    ToDataType::check_type_precision(to_precision);
160
161
372
                    to_scale = to_decimal_type->get_scale();
162
372
                    ToDataType::check_type_scale(to_scale);
163
372
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
372
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
372
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
372
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
372
                if (to_scale > from_scale) {
174
334
                    multiply_may_overflow &=
175
334
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
334
                }
177
372
                return narrow_integral || multiply_may_overflow;
178
372
            }
179
0
            return false;
180
372
        });
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
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
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
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
394
                    multiply_may_overflow &=
175
394
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
394
                }
177
934
                return narrow_integral || multiply_may_overflow;
178
934
            }
179
0
            return false;
180
934
        });
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
288
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
288
            using Types2 = std::decay_t<decltype(types2)>;
129
288
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
288
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
288
                using FromFieldType = typename FromDataType::FieldType;
137
288
                using ToFieldType = typename ToDataType::FieldType;
138
288
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
288
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
288
                UInt32 to_max_digits = 0;
150
288
                UInt32 to_precision = 0;
151
288
                UInt32 to_scale = 0;
152
153
288
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
288
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
288
                    const auto* to_decimal_type =
157
288
                            check_and_get_data_type<ToDataType>(to_type.get());
158
288
                    to_precision = to_decimal_type->get_precision();
159
288
                    ToDataType::check_type_precision(to_precision);
160
161
288
                    to_scale = to_decimal_type->get_scale();
162
288
                    ToDataType::check_type_scale(to_scale);
163
288
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
288
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
288
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
288
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
288
                if (to_scale > from_scale) {
174
147
                    multiply_may_overflow &=
175
147
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
147
                }
177
288
                return narrow_integral || multiply_may_overflow;
178
288
            }
179
0
            return false;
180
288
        });
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
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
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
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
118
                    multiply_may_overflow &=
175
118
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
118
                }
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_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_9EEESE_EEEEbSI_
Line
Count
Source
127
447
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
447
            using Types2 = std::decay_t<decltype(types2)>;
129
447
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
447
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
447
                using FromFieldType = typename FromDataType::FieldType;
137
447
                using ToFieldType = typename ToDataType::FieldType;
138
447
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
447
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
447
                UInt32 to_max_digits = 0;
150
447
                UInt32 to_precision = 0;
151
447
                UInt32 to_scale = 0;
152
153
447
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
447
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
447
                    const auto* to_decimal_type =
157
447
                            check_and_get_data_type<ToDataType>(to_type.get());
158
447
                    to_precision = to_decimal_type->get_precision();
159
447
                    ToDataType::check_type_precision(to_precision);
160
161
447
                    to_scale = to_decimal_type->get_scale();
162
447
                    ToDataType::check_type_scale(to_scale);
163
447
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
447
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
447
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
447
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
447
                if (to_scale > from_scale) {
174
367
                    multiply_may_overflow &=
175
367
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
367
                }
177
447
                return narrow_integral || multiply_may_overflow;
178
447
            }
179
0
            return false;
180
447
        });
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
621
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
621
            using Types2 = std::decay_t<decltype(types2)>;
129
621
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
621
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
621
                using FromFieldType = typename FromDataType::FieldType;
137
621
                using ToFieldType = typename ToDataType::FieldType;
138
621
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
621
                UInt32 from_scale = 0;
140
141
621
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
621
                    const auto* from_decimal_type =
143
621
                            check_and_get_data_type<FromDataType>(from_type.get());
144
621
                    from_precision =
145
621
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
621
                    from_scale = from_decimal_type->get_scale();
147
621
                }
148
149
621
                UInt32 to_max_digits = 0;
150
621
                UInt32 to_precision = 0;
151
621
                UInt32 to_scale = 0;
152
153
621
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
621
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
621
                    const auto* to_decimal_type =
157
621
                            check_and_get_data_type<ToDataType>(to_type.get());
158
621
                    to_precision = to_decimal_type->get_precision();
159
621
                    ToDataType::check_type_precision(to_precision);
160
161
621
                    to_scale = to_decimal_type->get_scale();
162
621
                    ToDataType::check_type_scale(to_scale);
163
621
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
621
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
621
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
621
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
621
                if (to_scale > from_scale) {
174
468
                    multiply_may_overflow &=
175
468
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
468
                }
177
621
                return narrow_integral || multiply_may_overflow;
178
621
            }
179
0
            return false;
180
621
        });
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
814
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
814
            using Types2 = std::decay_t<decltype(types2)>;
129
814
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
814
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
814
                using FromFieldType = typename FromDataType::FieldType;
137
814
                using ToFieldType = typename ToDataType::FieldType;
138
814
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
814
                UInt32 from_scale = 0;
140
141
814
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
814
                    const auto* from_decimal_type =
143
814
                            check_and_get_data_type<FromDataType>(from_type.get());
144
814
                    from_precision =
145
814
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
814
                    from_scale = from_decimal_type->get_scale();
147
814
                }
148
149
814
                UInt32 to_max_digits = 0;
150
814
                UInt32 to_precision = 0;
151
814
                UInt32 to_scale = 0;
152
153
814
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
814
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
814
                    const auto* to_decimal_type =
157
814
                            check_and_get_data_type<ToDataType>(to_type.get());
158
814
                    to_precision = to_decimal_type->get_precision();
159
814
                    ToDataType::check_type_precision(to_precision);
160
161
814
                    to_scale = to_decimal_type->get_scale();
162
814
                    ToDataType::check_type_scale(to_scale);
163
814
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
814
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
814
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
814
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
814
                if (to_scale > from_scale) {
174
471
                    multiply_may_overflow &=
175
471
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
471
                }
177
814
                return narrow_integral || multiply_may_overflow;
178
814
            }
179
0
            return false;
180
814
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_20EEESE_EEEEbSI_
Line
Count
Source
127
257
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
257
            using Types2 = std::decay_t<decltype(types2)>;
129
257
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
257
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
257
                using FromFieldType = typename FromDataType::FieldType;
137
257
                using ToFieldType = typename ToDataType::FieldType;
138
257
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
257
                UInt32 from_scale = 0;
140
141
257
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
257
                    const auto* from_decimal_type =
143
257
                            check_and_get_data_type<FromDataType>(from_type.get());
144
257
                    from_precision =
145
257
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
257
                    from_scale = from_decimal_type->get_scale();
147
257
                }
148
149
257
                UInt32 to_max_digits = 0;
150
257
                UInt32 to_precision = 0;
151
257
                UInt32 to_scale = 0;
152
153
257
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
257
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
257
                    const auto* to_decimal_type =
157
257
                            check_and_get_data_type<ToDataType>(to_type.get());
158
257
                    to_precision = to_decimal_type->get_precision();
159
257
                    ToDataType::check_type_precision(to_precision);
160
161
257
                    to_scale = to_decimal_type->get_scale();
162
257
                    ToDataType::check_type_scale(to_scale);
163
257
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
257
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
257
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
257
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
257
                if (to_scale > from_scale) {
174
71
                    multiply_may_overflow &=
175
71
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
71
                }
177
257
                return narrow_integral || multiply_may_overflow;
178
257
            }
179
0
            return false;
180
257
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_ENKUlSI_E_clINSB_ISE_SE_EEEEbSI_
Line
Count
Source
127
1.18k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
1.18k
            using Types2 = std::decay_t<decltype(types2)>;
129
1.18k
            using FromDataType = typename 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.18k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
1.18k
                using FromFieldType = typename FromDataType::FieldType;
137
1.18k
                using ToFieldType = typename ToDataType::FieldType;
138
1.18k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
1.18k
                UInt32 from_scale = 0;
140
141
1.18k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
1.18k
                    const auto* from_decimal_type =
143
1.18k
                            check_and_get_data_type<FromDataType>(from_type.get());
144
1.18k
                    from_precision =
145
1.18k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
1.18k
                    from_scale = from_decimal_type->get_scale();
147
1.18k
                }
148
149
1.18k
                UInt32 to_max_digits = 0;
150
1.18k
                UInt32 to_precision = 0;
151
1.18k
                UInt32 to_scale = 0;
152
153
1.18k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
1.18k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
1.18k
                    const auto* to_decimal_type =
157
1.18k
                            check_and_get_data_type<ToDataType>(to_type.get());
158
1.18k
                    to_precision = to_decimal_type->get_precision();
159
1.18k
                    ToDataType::check_type_precision(to_precision);
160
161
1.18k
                    to_scale = to_decimal_type->get_scale();
162
1.18k
                    ToDataType::check_type_scale(to_scale);
163
1.18k
                }
164
                if constexpr (IsIntegralV<ToFieldType> || 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.18k
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
1.18k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
1.18k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
1.18k
                if (to_scale > from_scale) {
174
583
                    multiply_may_overflow &=
175
583
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
583
                }
177
1.18k
                return narrow_integral || multiply_may_overflow;
178
1.18k
            }
179
0
            return false;
180
1.18k
        });
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
700
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
700
            using Types2 = std::decay_t<decltype(types2)>;
129
700
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
700
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
700
                using FromFieldType = typename FromDataType::FieldType;
137
700
                using ToFieldType = typename ToDataType::FieldType;
138
700
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
700
                UInt32 from_scale = 0;
140
141
700
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
700
                    const auto* from_decimal_type =
143
700
                            check_and_get_data_type<FromDataType>(from_type.get());
144
700
                    from_precision =
145
700
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
700
                    from_scale = from_decimal_type->get_scale();
147
700
                }
148
149
700
                UInt32 to_max_digits = 0;
150
700
                UInt32 to_precision = 0;
151
700
                UInt32 to_scale = 0;
152
153
700
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
700
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
700
                    const auto* to_decimal_type =
157
700
                            check_and_get_data_type<ToDataType>(to_type.get());
158
700
                    to_precision = to_decimal_type->get_precision();
159
700
                    ToDataType::check_type_precision(to_precision);
160
161
700
                    to_scale = to_decimal_type->get_scale();
162
700
                    ToDataType::check_type_scale(to_scale);
163
700
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
700
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
700
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
700
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
700
                if (to_scale > from_scale) {
174
274
                    multiply_may_overflow &=
175
274
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
274
                }
177
700
                return narrow_integral || multiply_may_overflow;
178
700
            }
179
0
            return false;
180
700
        });
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
3.86k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
3.86k
            using Types2 = std::decay_t<decltype(types2)>;
129
3.86k
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
3.86k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
3.86k
                return false;
134
3.86k
            }
135
3.86k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
3.86k
                using FromFieldType = typename FromDataType::FieldType;
137
3.86k
                using ToFieldType = typename ToDataType::FieldType;
138
3.86k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
3.86k
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
3.86k
                UInt32 to_max_digits = 0;
150
3.86k
                UInt32 to_precision = 0;
151
3.86k
                UInt32 to_scale = 0;
152
153
3.86k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
3.86k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
3.86k
                    const auto* to_decimal_type =
157
3.86k
                            check_and_get_data_type<ToDataType>(to_type.get());
158
3.86k
                    to_precision = to_decimal_type->get_precision();
159
3.86k
                    ToDataType::check_type_precision(to_precision);
160
161
3.86k
                    to_scale = to_decimal_type->get_scale();
162
3.86k
                    ToDataType::check_type_scale(to_scale);
163
3.86k
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
3.86k
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
3.86k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
3.86k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
3.86k
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
3.86k
                return narrow_integral || multiply_may_overflow;
178
3.86k
            }
179
0
            return false;
180
3.86k
        });
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
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
106
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
106
                using FromFieldType = typename FromDataType::FieldType;
137
106
                using ToFieldType = typename ToDataType::FieldType;
138
106
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
106
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
106
                UInt32 to_max_digits = 0;
150
106
                UInt32 to_precision = 0;
151
106
                UInt32 to_scale = 0;
152
153
106
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
106
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
106
                    const auto* to_decimal_type =
157
106
                            check_and_get_data_type<ToDataType>(to_type.get());
158
106
                    to_precision = to_decimal_type->get_precision();
159
106
                    ToDataType::check_type_precision(to_precision);
160
161
106
                    to_scale = to_decimal_type->get_scale();
162
106
                    ToDataType::check_type_scale(to_scale);
163
106
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
106
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
106
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
106
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
106
                if (to_scale > from_scale) {
174
73
                    multiply_may_overflow &=
175
73
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
73
                }
177
106
                return narrow_integral || multiply_may_overflow;
178
106
            }
179
0
            return false;
180
106
        });
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
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
71
                    multiply_may_overflow &=
175
71
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
71
                }
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_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_5EEESE_EEEEbSI_
Line
Count
Source
127
122
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
122
            using Types2 = std::decay_t<decltype(types2)>;
129
122
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
122
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
122
                using FromFieldType = typename FromDataType::FieldType;
137
122
                using ToFieldType = typename ToDataType::FieldType;
138
122
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
122
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
122
                UInt32 to_max_digits = 0;
150
122
                UInt32 to_precision = 0;
151
122
                UInt32 to_scale = 0;
152
153
122
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
122
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
122
                    const auto* to_decimal_type =
157
122
                            check_and_get_data_type<ToDataType>(to_type.get());
158
122
                    to_precision = to_decimal_type->get_precision();
159
122
                    ToDataType::check_type_precision(to_precision);
160
161
122
                    to_scale = to_decimal_type->get_scale();
162
122
                    ToDataType::check_type_scale(to_scale);
163
122
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
122
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
122
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
122
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
122
                if (to_scale > from_scale) {
174
84
                    multiply_may_overflow &=
175
84
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
84
                }
177
122
                return narrow_integral || multiply_may_overflow;
178
122
            }
179
0
            return false;
180
122
        });
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
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
71
                    multiply_may_overflow &=
175
71
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
71
                }
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_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_7EEESE_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
122
                    multiply_may_overflow &=
175
122
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
122
                }
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_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_INS_14DataTypeNumberILSD_8EEESE_EEEEbSI_
Line
Count
Source
127
180
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
180
            using Types2 = std::decay_t<decltype(types2)>;
129
180
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
180
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
180
                using FromFieldType = typename FromDataType::FieldType;
137
180
                using ToFieldType = typename ToDataType::FieldType;
138
180
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
180
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
180
                UInt32 to_max_digits = 0;
150
180
                UInt32 to_precision = 0;
151
180
                UInt32 to_scale = 0;
152
153
180
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
180
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
180
                    const auto* to_decimal_type =
157
180
                            check_and_get_data_type<ToDataType>(to_type.get());
158
180
                    to_precision = to_decimal_type->get_precision();
159
180
                    ToDataType::check_type_precision(to_precision);
160
161
180
                    to_scale = to_decimal_type->get_scale();
162
180
                    ToDataType::check_type_scale(to_scale);
163
180
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
180
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
180
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
180
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
180
                if (to_scale > from_scale) {
174
114
                    multiply_may_overflow &=
175
114
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
114
                }
177
180
                return narrow_integral || multiply_may_overflow;
178
180
            }
179
0
            return false;
180
180
        });
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
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
276
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
276
                using FromFieldType = typename FromDataType::FieldType;
137
276
                using ToFieldType = typename ToDataType::FieldType;
138
276
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
276
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
276
                UInt32 to_max_digits = 0;
150
276
                UInt32 to_precision = 0;
151
276
                UInt32 to_scale = 0;
152
153
276
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
276
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
276
                    const auto* to_decimal_type =
157
276
                            check_and_get_data_type<ToDataType>(to_type.get());
158
276
                    to_precision = to_decimal_type->get_precision();
159
276
                    ToDataType::check_type_precision(to_precision);
160
161
276
                    to_scale = to_decimal_type->get_scale();
162
276
                    ToDataType::check_type_scale(to_scale);
163
276
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
276
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
276
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
276
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
276
                if (to_scale > from_scale) {
174
196
                    multiply_may_overflow &=
175
196
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
196
                }
177
276
                return narrow_integral || multiply_may_overflow;
178
276
            }
179
0
            return false;
180
276
        });
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
429
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
429
            using Types2 = std::decay_t<decltype(types2)>;
129
429
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
429
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
429
                using FromFieldType = typename FromDataType::FieldType;
137
429
                using ToFieldType = typename ToDataType::FieldType;
138
429
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
429
                UInt32 from_scale = 0;
140
141
429
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
429
                    const auto* from_decimal_type =
143
429
                            check_and_get_data_type<FromDataType>(from_type.get());
144
429
                    from_precision =
145
429
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
429
                    from_scale = from_decimal_type->get_scale();
147
429
                }
148
149
429
                UInt32 to_max_digits = 0;
150
429
                UInt32 to_precision = 0;
151
429
                UInt32 to_scale = 0;
152
153
429
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
429
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
429
                    const auto* to_decimal_type =
157
429
                            check_and_get_data_type<ToDataType>(to_type.get());
158
429
                    to_precision = to_decimal_type->get_precision();
159
429
                    ToDataType::check_type_precision(to_precision);
160
161
429
                    to_scale = to_decimal_type->get_scale();
162
429
                    ToDataType::check_type_scale(to_scale);
163
429
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
429
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
429
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
429
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
429
                if (to_scale > from_scale) {
174
361
                    multiply_may_overflow &=
175
361
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
361
                }
177
429
                return narrow_integral || multiply_may_overflow;
178
429
            }
179
0
            return false;
180
429
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_ENKUlSI_E_clINSB_INSC_ILSD_29EEESE_EEEEbSI_
Line
Count
Source
127
671
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
671
            using Types2 = std::decay_t<decltype(types2)>;
129
671
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
671
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
671
                using FromFieldType = typename FromDataType::FieldType;
137
671
                using ToFieldType = typename ToDataType::FieldType;
138
671
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
671
                UInt32 from_scale = 0;
140
141
671
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
671
                    const auto* from_decimal_type =
143
671
                            check_and_get_data_type<FromDataType>(from_type.get());
144
671
                    from_precision =
145
671
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
671
                    from_scale = from_decimal_type->get_scale();
147
671
                }
148
149
671
                UInt32 to_max_digits = 0;
150
671
                UInt32 to_precision = 0;
151
671
                UInt32 to_scale = 0;
152
153
671
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
671
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
671
                    const auto* to_decimal_type =
157
671
                            check_and_get_data_type<ToDataType>(to_type.get());
158
671
                    to_precision = to_decimal_type->get_precision();
159
671
                    ToDataType::check_type_precision(to_precision);
160
161
671
                    to_scale = to_decimal_type->get_scale();
162
671
                    ToDataType::check_type_scale(to_scale);
163
671
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
671
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
671
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
671
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
671
                if (to_scale > from_scale) {
174
544
                    multiply_may_overflow &=
175
544
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
544
                }
177
671
                return narrow_integral || multiply_may_overflow;
178
671
            }
179
0
            return false;
180
671
        });
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
976
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
976
            using Types2 = std::decay_t<decltype(types2)>;
129
976
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
976
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
976
                using FromFieldType = typename FromDataType::FieldType;
137
976
                using ToFieldType = typename ToDataType::FieldType;
138
976
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
976
                UInt32 from_scale = 0;
140
141
976
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
976
                    const auto* from_decimal_type =
143
976
                            check_and_get_data_type<FromDataType>(from_type.get());
144
976
                    from_precision =
145
976
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
976
                    from_scale = from_decimal_type->get_scale();
147
976
                }
148
149
976
                UInt32 to_max_digits = 0;
150
976
                UInt32 to_precision = 0;
151
976
                UInt32 to_scale = 0;
152
153
976
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
976
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
976
                    const auto* to_decimal_type =
157
976
                            check_and_get_data_type<ToDataType>(to_type.get());
158
976
                    to_precision = to_decimal_type->get_precision();
159
976
                    ToDataType::check_type_precision(to_precision);
160
161
976
                    to_scale = to_decimal_type->get_scale();
162
976
                    ToDataType::check_type_scale(to_scale);
163
976
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
976
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
976
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
976
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
976
                if (to_scale > from_scale) {
174
509
                    multiply_may_overflow &=
175
509
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
509
                }
177
976
                return narrow_integral || multiply_may_overflow;
178
976
            }
179
0
            return false;
180
976
        });
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
686
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
686
            using Types2 = std::decay_t<decltype(types2)>;
129
686
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
686
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
686
                using FromFieldType = typename FromDataType::FieldType;
137
686
                using ToFieldType = typename ToDataType::FieldType;
138
686
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
686
                UInt32 from_scale = 0;
140
141
686
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
686
                    const auto* from_decimal_type =
143
686
                            check_and_get_data_type<FromDataType>(from_type.get());
144
686
                    from_precision =
145
686
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
686
                    from_scale = from_decimal_type->get_scale();
147
686
                }
148
149
686
                UInt32 to_max_digits = 0;
150
686
                UInt32 to_precision = 0;
151
686
                UInt32 to_scale = 0;
152
153
686
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
686
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
686
                    const auto* to_decimal_type =
157
686
                            check_and_get_data_type<ToDataType>(to_type.get());
158
686
                    to_precision = to_decimal_type->get_precision();
159
686
                    ToDataType::check_type_precision(to_precision);
160
161
686
                    to_scale = to_decimal_type->get_scale();
162
686
                    ToDataType::check_type_scale(to_scale);
163
686
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
686
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
686
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
686
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
686
                if (to_scale > from_scale) {
174
335
                    multiply_may_overflow &=
175
335
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
335
                }
177
686
                return narrow_integral || multiply_may_overflow;
178
686
            }
179
0
            return false;
180
686
        });
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
3.57k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
3.57k
            using Types2 = std::decay_t<decltype(types2)>;
129
3.57k
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
3.57k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
3.57k
                return false;
134
3.57k
            }
135
3.57k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
3.57k
                using FromFieldType = typename FromDataType::FieldType;
137
3.57k
                using ToFieldType = typename ToDataType::FieldType;
138
3.57k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
3.57k
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
3.57k
                UInt32 to_max_digits = 0;
150
3.57k
                UInt32 to_precision = 0;
151
3.57k
                UInt32 to_scale = 0;
152
153
3.57k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
3.57k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
3.57k
                    const auto* to_decimal_type =
157
3.57k
                            check_and_get_data_type<ToDataType>(to_type.get());
158
3.57k
                    to_precision = to_decimal_type->get_precision();
159
3.57k
                    ToDataType::check_type_precision(to_precision);
160
161
3.57k
                    to_scale = to_decimal_type->get_scale();
162
3.57k
                    ToDataType::check_type_scale(to_scale);
163
3.57k
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
3.57k
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
3.57k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
3.57k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
3.57k
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
3.57k
                return narrow_integral || multiply_may_overflow;
178
3.57k
            }
179
0
            return false;
180
3.57k
        });
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
29
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
29
            using Types2 = std::decay_t<decltype(types2)>;
129
29
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
29
            return false;
180
29
        });
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
202
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
202
            using Types2 = std::decay_t<decltype(types2)>;
129
202
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
202
            return false;
180
202
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_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.27k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
5.27k
            using Types2 = std::decay_t<decltype(types2)>;
129
5.27k
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
5.27k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
5.27k
                return false;
134
5.27k
            }
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.27k
            return false;
180
5.27k
        });
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
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_14DataTypeNumberILNS_13PrimitiveTypeE6EEESC_EEEEbSG_
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
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE7EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE8EEESC_EEEEbSG_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE9EEESC_EEEEbSG_
Line
Count
Source
127
12
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
12
            using Types2 = std::decay_t<decltype(types2)>;
129
12
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
                using FromFieldType = typename FromDataType::FieldType;
137
                using ToFieldType = typename ToDataType::FieldType;
138
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
                UInt32 from_scale = 0;
140
141
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
                    const auto* from_decimal_type =
143
                            check_and_get_data_type<FromDataType>(from_type.get());
144
                    from_precision =
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
                    from_scale = from_decimal_type->get_scale();
147
                }
148
149
                UInt32 to_max_digits = 0;
150
                UInt32 to_precision = 0;
151
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
                if (to_scale > from_scale) {
174
                    multiply_may_overflow &=
175
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
                }
177
                return narrow_integral || multiply_may_overflow;
178
            }
179
12
            return false;
180
12
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEESC_EEEEbSG_
Line
Count
Source
127
18
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
18
            using Types2 = std::decay_t<decltype(types2)>;
129
18
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
18
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
18
                using FromFieldType = typename FromDataType::FieldType;
137
18
                using ToFieldType = typename ToDataType::FieldType;
138
18
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
18
                UInt32 from_scale = 0;
140
141
18
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
18
                    const auto* from_decimal_type =
143
18
                            check_and_get_data_type<FromDataType>(from_type.get());
144
18
                    from_precision =
145
18
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
18
                    from_scale = from_decimal_type->get_scale();
147
18
                }
148
149
18
                UInt32 to_max_digits = 0;
150
18
                UInt32 to_precision = 0;
151
18
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
18
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
18
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
18
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
18
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
18
                return narrow_integral || multiply_may_overflow;
178
18
            }
179
0
            return false;
180
18
        });
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEESC_EEEEbSG_
Line
Count
Source
127
14
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
14
            using Types2 = std::decay_t<decltype(types2)>;
129
14
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
14
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
14
                using FromFieldType = typename FromDataType::FieldType;
137
14
                using ToFieldType = typename ToDataType::FieldType;
138
14
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
14
                UInt32 from_scale = 0;
140
141
14
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
14
                    const auto* from_decimal_type =
143
14
                            check_and_get_data_type<FromDataType>(from_type.get());
144
14
                    from_precision =
145
14
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
14
                    from_scale = from_decimal_type->get_scale();
147
14
                }
148
149
14
                UInt32 to_max_digits = 0;
150
14
                UInt32 to_precision = 0;
151
14
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
14
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
14
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
14
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
14
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
14
                return narrow_integral || multiply_may_overflow;
178
14
            }
179
0
            return false;
180
14
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEESC_EEEEbSG_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEESC_EEEEbSG_
Line
Count
Source
127
5
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
5
            using Types2 = std::decay_t<decltype(types2)>;
129
5
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
                return false;
134
            }
135
5
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
5
                using FromFieldType = typename FromDataType::FieldType;
137
5
                using ToFieldType = typename ToDataType::FieldType;
138
5
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
5
                UInt32 from_scale = 0;
140
141
5
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
5
                    const auto* from_decimal_type =
143
5
                            check_and_get_data_type<FromDataType>(from_type.get());
144
5
                    from_precision =
145
5
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
5
                    from_scale = from_decimal_type->get_scale();
147
5
                }
148
149
5
                UInt32 to_max_digits = 0;
150
5
                UInt32 to_precision = 0;
151
5
                UInt32 to_scale = 0;
152
153
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
                    const auto* to_decimal_type =
157
                            check_and_get_data_type<ToDataType>(to_type.get());
158
                    to_precision = to_decimal_type->get_precision();
159
                    ToDataType::check_type_precision(to_precision);
160
161
                    to_scale = to_decimal_type->get_scale();
162
                    ToDataType::check_type_scale(to_scale);
163
                }
164
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
                    to_precision = to_max_digits;
167
                }
168
169
5
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
5
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
5
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
5
                if (to_scale > from_scale) {
174
0
                    multiply_may_overflow &=
175
0
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
0
                }
177
5
                return narrow_integral || multiply_may_overflow;
178
5
            }
179
0
            return false;
180
5
        });
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEESC_EEEEbSG_
Unexecuted instantiation: function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_12DataTypeDateESC_EEEEbSG_
function_cast.cpp:_ZZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeDateV2ESC_EEEEbSG_
Line
Count
Source
127
381
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
381
            using Types2 = std::decay_t<decltype(types2)>;
129
381
            using FromDataType = typename 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
381
            return false;
180
381
        });
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
105
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
105
            using Types2 = std::decay_t<decltype(types2)>;
129
105
            using FromDataType = typename 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
105
            return false;
180
105
        });
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
36
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
36
            using Types2 = std::decay_t<decltype(types2)>;
129
36
            using FromDataType = typename 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
36
            return false;
180
36
        });
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
2.79k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
2.79k
            using Types2 = std::decay_t<decltype(types2)>;
129
2.79k
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
2.79k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
2.79k
                return false;
134
2.79k
            }
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.79k
            return false;
180
2.79k
        });
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
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_14DataTypeTimeV2EvEEEEbRKT_ENKUlSG_E_clINSB_INS_14DataTypeNumberILNS_13PrimitiveTypeE5EEESC_EEEEbSG_
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_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
231
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
231
            using Types2 = std::decay_t<decltype(types2)>;
129
231
            using FromDataType = typename Types2::LeftType;
130
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
231
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
231
                return false;
134
231
            }
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
231
            return false;
180
231
        });
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
195k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE2EEEvEEEEbRKT_
Line
Count
Source
117
2.34k
    auto make_default_wrapper = [&](const auto& types) -> bool {
118
2.34k
        using Types = std::decay_t<decltype(types)>;
119
2.34k
        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.34k
        return call_on_index_and_data_type<
127
2.34k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
2.34k
            using Types2 = std::decay_t<decltype(types2)>;
129
2.34k
            using FromDataType = typename Types2::LeftType;
130
2.34k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
2.34k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
2.34k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
2.34k
                return false;
134
2.34k
            }
135
2.34k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
2.34k
                using FromFieldType = typename FromDataType::FieldType;
137
2.34k
                using ToFieldType = typename ToDataType::FieldType;
138
2.34k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
2.34k
                UInt32 from_scale = 0;
140
141
2.34k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
2.34k
                    const auto* from_decimal_type =
143
2.34k
                            check_and_get_data_type<FromDataType>(from_type.get());
144
2.34k
                    from_precision =
145
2.34k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
2.34k
                    from_scale = from_decimal_type->get_scale();
147
2.34k
                }
148
149
2.34k
                UInt32 to_max_digits = 0;
150
2.34k
                UInt32 to_precision = 0;
151
2.34k
                UInt32 to_scale = 0;
152
153
2.34k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
2.34k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
2.34k
                    const auto* to_decimal_type =
157
2.34k
                            check_and_get_data_type<ToDataType>(to_type.get());
158
2.34k
                    to_precision = to_decimal_type->get_precision();
159
2.34k
                    ToDataType::check_type_precision(to_precision);
160
161
2.34k
                    to_scale = to_decimal_type->get_scale();
162
2.34k
                    ToDataType::check_type_scale(to_scale);
163
2.34k
                }
164
2.34k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
2.34k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
2.34k
                    to_precision = to_max_digits;
167
2.34k
                }
168
169
2.34k
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
2.34k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
2.34k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
2.34k
                if (to_scale > from_scale) {
174
2.34k
                    multiply_may_overflow &=
175
2.34k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
2.34k
                }
177
2.34k
                return narrow_integral || multiply_may_overflow;
178
2.34k
            }
179
2.34k
            return false;
180
2.34k
        });
181
2.34k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE3EEEvEEEEbRKT_
Line
Count
Source
117
3.64k
    auto make_default_wrapper = [&](const auto& types) -> bool {
118
3.64k
        using Types = std::decay_t<decltype(types)>;
119
3.64k
        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.64k
        return call_on_index_and_data_type<
127
3.64k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
3.64k
            using Types2 = std::decay_t<decltype(types2)>;
129
3.64k
            using FromDataType = typename Types2::LeftType;
130
3.64k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
3.64k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
3.64k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
3.64k
                return false;
134
3.64k
            }
135
3.64k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
3.64k
                using FromFieldType = typename FromDataType::FieldType;
137
3.64k
                using ToFieldType = typename ToDataType::FieldType;
138
3.64k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
3.64k
                UInt32 from_scale = 0;
140
141
3.64k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
3.64k
                    const auto* from_decimal_type =
143
3.64k
                            check_and_get_data_type<FromDataType>(from_type.get());
144
3.64k
                    from_precision =
145
3.64k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
3.64k
                    from_scale = from_decimal_type->get_scale();
147
3.64k
                }
148
149
3.64k
                UInt32 to_max_digits = 0;
150
3.64k
                UInt32 to_precision = 0;
151
3.64k
                UInt32 to_scale = 0;
152
153
3.64k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
3.64k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
3.64k
                    const auto* to_decimal_type =
157
3.64k
                            check_and_get_data_type<ToDataType>(to_type.get());
158
3.64k
                    to_precision = to_decimal_type->get_precision();
159
3.64k
                    ToDataType::check_type_precision(to_precision);
160
161
3.64k
                    to_scale = to_decimal_type->get_scale();
162
3.64k
                    ToDataType::check_type_scale(to_scale);
163
3.64k
                }
164
3.64k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
3.64k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
3.64k
                    to_precision = to_max_digits;
167
3.64k
                }
168
169
3.64k
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
3.64k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
3.64k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
3.64k
                if (to_scale > from_scale) {
174
3.64k
                    multiply_may_overflow &=
175
3.64k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
3.64k
                }
177
3.64k
                return narrow_integral || multiply_may_overflow;
178
3.64k
            }
179
3.64k
            return false;
180
3.64k
        });
181
3.64k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE4EEEvEEEEbRKT_
Line
Count
Source
117
5.28k
    auto make_default_wrapper = [&](const auto& types) -> bool {
118
5.28k
        using Types = std::decay_t<decltype(types)>;
119
5.28k
        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.28k
        return call_on_index_and_data_type<
127
5.28k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
5.28k
            using Types2 = std::decay_t<decltype(types2)>;
129
5.28k
            using FromDataType = typename Types2::LeftType;
130
5.28k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
5.28k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
5.28k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
5.28k
                return false;
134
5.28k
            }
135
5.28k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
5.28k
                using FromFieldType = typename FromDataType::FieldType;
137
5.28k
                using ToFieldType = typename ToDataType::FieldType;
138
5.28k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
5.28k
                UInt32 from_scale = 0;
140
141
5.28k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
5.28k
                    const auto* from_decimal_type =
143
5.28k
                            check_and_get_data_type<FromDataType>(from_type.get());
144
5.28k
                    from_precision =
145
5.28k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
5.28k
                    from_scale = from_decimal_type->get_scale();
147
5.28k
                }
148
149
5.28k
                UInt32 to_max_digits = 0;
150
5.28k
                UInt32 to_precision = 0;
151
5.28k
                UInt32 to_scale = 0;
152
153
5.28k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
5.28k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
5.28k
                    const auto* to_decimal_type =
157
5.28k
                            check_and_get_data_type<ToDataType>(to_type.get());
158
5.28k
                    to_precision = to_decimal_type->get_precision();
159
5.28k
                    ToDataType::check_type_precision(to_precision);
160
161
5.28k
                    to_scale = to_decimal_type->get_scale();
162
5.28k
                    ToDataType::check_type_scale(to_scale);
163
5.28k
                }
164
5.28k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
5.28k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
5.28k
                    to_precision = to_max_digits;
167
5.28k
                }
168
169
5.28k
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
5.28k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
5.28k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
5.28k
                if (to_scale > from_scale) {
174
5.28k
                    multiply_may_overflow &=
175
5.28k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
5.28k
                }
177
5.28k
                return narrow_integral || multiply_may_overflow;
178
5.28k
            }
179
5.28k
            return false;
180
5.28k
        });
181
5.28k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE5EEEvEEEEbRKT_
Line
Count
Source
117
33.2k
    auto make_default_wrapper = [&](const auto& types) -> bool {
118
33.2k
        using Types = std::decay_t<decltype(types)>;
119
33.2k
        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
33.2k
        return call_on_index_and_data_type<
127
33.2k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
33.2k
            using Types2 = std::decay_t<decltype(types2)>;
129
33.2k
            using FromDataType = typename Types2::LeftType;
130
33.2k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
33.2k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
33.2k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
33.2k
                return false;
134
33.2k
            }
135
33.2k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
33.2k
                using FromFieldType = typename FromDataType::FieldType;
137
33.2k
                using ToFieldType = typename ToDataType::FieldType;
138
33.2k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
33.2k
                UInt32 from_scale = 0;
140
141
33.2k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
33.2k
                    const auto* from_decimal_type =
143
33.2k
                            check_and_get_data_type<FromDataType>(from_type.get());
144
33.2k
                    from_precision =
145
33.2k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
33.2k
                    from_scale = from_decimal_type->get_scale();
147
33.2k
                }
148
149
33.2k
                UInt32 to_max_digits = 0;
150
33.2k
                UInt32 to_precision = 0;
151
33.2k
                UInt32 to_scale = 0;
152
153
33.2k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
33.2k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
33.2k
                    const auto* to_decimal_type =
157
33.2k
                            check_and_get_data_type<ToDataType>(to_type.get());
158
33.2k
                    to_precision = to_decimal_type->get_precision();
159
33.2k
                    ToDataType::check_type_precision(to_precision);
160
161
33.2k
                    to_scale = to_decimal_type->get_scale();
162
33.2k
                    ToDataType::check_type_scale(to_scale);
163
33.2k
                }
164
33.2k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
33.2k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
33.2k
                    to_precision = to_max_digits;
167
33.2k
                }
168
169
33.2k
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
33.2k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
33.2k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
33.2k
                if (to_scale > from_scale) {
174
33.2k
                    multiply_may_overflow &=
175
33.2k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
33.2k
                }
177
33.2k
                return narrow_integral || multiply_may_overflow;
178
33.2k
            }
179
33.2k
            return false;
180
33.2k
        });
181
33.2k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE6EEEvEEEEbRKT_
Line
Count
Source
117
34.3k
    auto make_default_wrapper = [&](const auto& types) -> bool {
118
34.3k
        using Types = std::decay_t<decltype(types)>;
119
34.3k
        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
34.3k
        return call_on_index_and_data_type<
127
34.3k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
34.3k
            using Types2 = std::decay_t<decltype(types2)>;
129
34.3k
            using FromDataType = typename Types2::LeftType;
130
34.3k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
34.3k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
34.3k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
34.3k
                return false;
134
34.3k
            }
135
34.3k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
34.3k
                using FromFieldType = typename FromDataType::FieldType;
137
34.3k
                using ToFieldType = typename ToDataType::FieldType;
138
34.3k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
34.3k
                UInt32 from_scale = 0;
140
141
34.3k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
34.3k
                    const auto* from_decimal_type =
143
34.3k
                            check_and_get_data_type<FromDataType>(from_type.get());
144
34.3k
                    from_precision =
145
34.3k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
34.3k
                    from_scale = from_decimal_type->get_scale();
147
34.3k
                }
148
149
34.3k
                UInt32 to_max_digits = 0;
150
34.3k
                UInt32 to_precision = 0;
151
34.3k
                UInt32 to_scale = 0;
152
153
34.3k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
34.3k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
34.3k
                    const auto* to_decimal_type =
157
34.3k
                            check_and_get_data_type<ToDataType>(to_type.get());
158
34.3k
                    to_precision = to_decimal_type->get_precision();
159
34.3k
                    ToDataType::check_type_precision(to_precision);
160
161
34.3k
                    to_scale = to_decimal_type->get_scale();
162
34.3k
                    ToDataType::check_type_scale(to_scale);
163
34.3k
                }
164
34.3k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
34.3k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
34.3k
                    to_precision = to_max_digits;
167
34.3k
                }
168
169
34.3k
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
34.3k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
34.3k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
34.3k
                if (to_scale > from_scale) {
174
34.3k
                    multiply_may_overflow &=
175
34.3k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
34.3k
                }
177
34.3k
                return narrow_integral || multiply_may_overflow;
178
34.3k
            }
179
34.3k
            return false;
180
34.3k
        });
181
34.3k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE7EEEvEEEEbRKT_
Line
Count
Source
117
4.56k
    auto make_default_wrapper = [&](const auto& types) -> bool {
118
4.56k
        using Types = std::decay_t<decltype(types)>;
119
4.56k
        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.56k
        return call_on_index_and_data_type<
127
4.56k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
4.56k
            using Types2 = std::decay_t<decltype(types2)>;
129
4.56k
            using FromDataType = typename Types2::LeftType;
130
4.56k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
4.56k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
4.56k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
4.56k
                return false;
134
4.56k
            }
135
4.56k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
4.56k
                using FromFieldType = typename FromDataType::FieldType;
137
4.56k
                using ToFieldType = typename ToDataType::FieldType;
138
4.56k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
4.56k
                UInt32 from_scale = 0;
140
141
4.56k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
4.56k
                    const auto* from_decimal_type =
143
4.56k
                            check_and_get_data_type<FromDataType>(from_type.get());
144
4.56k
                    from_precision =
145
4.56k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
4.56k
                    from_scale = from_decimal_type->get_scale();
147
4.56k
                }
148
149
4.56k
                UInt32 to_max_digits = 0;
150
4.56k
                UInt32 to_precision = 0;
151
4.56k
                UInt32 to_scale = 0;
152
153
4.56k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
4.56k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
4.56k
                    const auto* to_decimal_type =
157
4.56k
                            check_and_get_data_type<ToDataType>(to_type.get());
158
4.56k
                    to_precision = to_decimal_type->get_precision();
159
4.56k
                    ToDataType::check_type_precision(to_precision);
160
161
4.56k
                    to_scale = to_decimal_type->get_scale();
162
4.56k
                    ToDataType::check_type_scale(to_scale);
163
4.56k
                }
164
4.56k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
4.56k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
4.56k
                    to_precision = to_max_digits;
167
4.56k
                }
168
169
4.56k
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
4.56k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
4.56k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
4.56k
                if (to_scale > from_scale) {
174
4.56k
                    multiply_may_overflow &=
175
4.56k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
4.56k
                }
177
4.56k
                return narrow_integral || multiply_may_overflow;
178
4.56k
            }
179
4.56k
            return false;
180
4.56k
        });
181
4.56k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE8EEEvEEEEbRKT_
Line
Count
Source
117
10.0k
    auto make_default_wrapper = [&](const auto& types) -> bool {
118
10.0k
        using Types = std::decay_t<decltype(types)>;
119
10.0k
        using ToDataType = typename Types::LeftType;
120
121
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
122
                        IsDatelikeV2Types<ToDataType> ||
123
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
124
            return false;
125
        }
126
10.0k
        return call_on_index_and_data_type<
127
10.0k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
10.0k
            using Types2 = std::decay_t<decltype(types2)>;
129
10.0k
            using FromDataType = typename Types2::LeftType;
130
10.0k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
10.0k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
10.0k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
10.0k
                return false;
134
10.0k
            }
135
10.0k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
10.0k
                using FromFieldType = typename FromDataType::FieldType;
137
10.0k
                using ToFieldType = typename ToDataType::FieldType;
138
10.0k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
10.0k
                UInt32 from_scale = 0;
140
141
10.0k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
10.0k
                    const auto* from_decimal_type =
143
10.0k
                            check_and_get_data_type<FromDataType>(from_type.get());
144
10.0k
                    from_precision =
145
10.0k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
10.0k
                    from_scale = from_decimal_type->get_scale();
147
10.0k
                }
148
149
10.0k
                UInt32 to_max_digits = 0;
150
10.0k
                UInt32 to_precision = 0;
151
10.0k
                UInt32 to_scale = 0;
152
153
10.0k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
10.0k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
10.0k
                    const auto* to_decimal_type =
157
10.0k
                            check_and_get_data_type<ToDataType>(to_type.get());
158
10.0k
                    to_precision = to_decimal_type->get_precision();
159
10.0k
                    ToDataType::check_type_precision(to_precision);
160
161
10.0k
                    to_scale = to_decimal_type->get_scale();
162
10.0k
                    ToDataType::check_type_scale(to_scale);
163
10.0k
                }
164
10.0k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
10.0k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
10.0k
                    to_precision = to_max_digits;
167
10.0k
                }
168
169
10.0k
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
10.0k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
10.0k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
10.0k
                if (to_scale > from_scale) {
174
10.0k
                    multiply_may_overflow &=
175
10.0k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
10.0k
                }
177
10.0k
                return narrow_integral || multiply_may_overflow;
178
10.0k
            }
179
10.0k
            return false;
180
10.0k
        });
181
10.0k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeNumberILNS_13PrimitiveTypeE9EEEvEEEEbRKT_
Line
Count
Source
117
23.5k
    auto make_default_wrapper = [&](const auto& types) -> bool {
118
23.5k
        using Types = std::decay_t<decltype(types)>;
119
23.5k
        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
23.5k
        return call_on_index_and_data_type<
127
23.5k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
23.5k
            using Types2 = std::decay_t<decltype(types2)>;
129
23.5k
            using FromDataType = typename Types2::LeftType;
130
23.5k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
23.5k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
23.5k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
23.5k
                return false;
134
23.5k
            }
135
23.5k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
23.5k
                using FromFieldType = typename FromDataType::FieldType;
137
23.5k
                using ToFieldType = typename ToDataType::FieldType;
138
23.5k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
23.5k
                UInt32 from_scale = 0;
140
141
23.5k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
23.5k
                    const auto* from_decimal_type =
143
23.5k
                            check_and_get_data_type<FromDataType>(from_type.get());
144
23.5k
                    from_precision =
145
23.5k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
23.5k
                    from_scale = from_decimal_type->get_scale();
147
23.5k
                }
148
149
23.5k
                UInt32 to_max_digits = 0;
150
23.5k
                UInt32 to_precision = 0;
151
23.5k
                UInt32 to_scale = 0;
152
153
23.5k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
23.5k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
23.5k
                    const auto* to_decimal_type =
157
23.5k
                            check_and_get_data_type<ToDataType>(to_type.get());
158
23.5k
                    to_precision = to_decimal_type->get_precision();
159
23.5k
                    ToDataType::check_type_precision(to_precision);
160
161
23.5k
                    to_scale = to_decimal_type->get_scale();
162
23.5k
                    ToDataType::check_type_scale(to_scale);
163
23.5k
                }
164
23.5k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
23.5k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
23.5k
                    to_precision = to_max_digits;
167
23.5k
                }
168
169
23.5k
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
23.5k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
23.5k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
23.5k
                if (to_scale > from_scale) {
174
23.5k
                    multiply_may_overflow &=
175
23.5k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
23.5k
                }
177
23.5k
                return narrow_integral || multiply_may_overflow;
178
23.5k
            }
179
23.5k
            return false;
180
23.5k
        });
181
23.5k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEvEEEEbRKT_
Line
Count
Source
117
6.56k
    auto make_default_wrapper = [&](const auto& types) -> bool {
118
6.56k
        using Types = std::decay_t<decltype(types)>;
119
6.56k
        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
6.56k
        return call_on_index_and_data_type<
127
6.56k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
6.56k
            using Types2 = std::decay_t<decltype(types2)>;
129
6.56k
            using FromDataType = typename Types2::LeftType;
130
6.56k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
6.56k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
6.56k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
6.56k
                return false;
134
6.56k
            }
135
6.56k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
6.56k
                using FromFieldType = typename FromDataType::FieldType;
137
6.56k
                using ToFieldType = typename ToDataType::FieldType;
138
6.56k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
6.56k
                UInt32 from_scale = 0;
140
141
6.56k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
6.56k
                    const auto* from_decimal_type =
143
6.56k
                            check_and_get_data_type<FromDataType>(from_type.get());
144
6.56k
                    from_precision =
145
6.56k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
6.56k
                    from_scale = from_decimal_type->get_scale();
147
6.56k
                }
148
149
6.56k
                UInt32 to_max_digits = 0;
150
6.56k
                UInt32 to_precision = 0;
151
6.56k
                UInt32 to_scale = 0;
152
153
6.56k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
6.56k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
6.56k
                    const auto* to_decimal_type =
157
6.56k
                            check_and_get_data_type<ToDataType>(to_type.get());
158
6.56k
                    to_precision = to_decimal_type->get_precision();
159
6.56k
                    ToDataType::check_type_precision(to_precision);
160
161
6.56k
                    to_scale = to_decimal_type->get_scale();
162
6.56k
                    ToDataType::check_type_scale(to_scale);
163
6.56k
                }
164
6.56k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
6.56k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
6.56k
                    to_precision = to_max_digits;
167
6.56k
                }
168
169
6.56k
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
6.56k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
6.56k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
6.56k
                if (to_scale > from_scale) {
174
6.56k
                    multiply_may_overflow &=
175
6.56k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
6.56k
                }
177
6.56k
                return narrow_integral || multiply_may_overflow;
178
6.56k
            }
179
6.56k
            return false;
180
6.56k
        });
181
6.56k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEvEEEEbRKT_
Line
Count
Source
117
10.6k
    auto make_default_wrapper = [&](const auto& types) -> bool {
118
10.6k
        using Types = std::decay_t<decltype(types)>;
119
10.6k
        using ToDataType = typename Types::LeftType;
120
121
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
122
                        IsDatelikeV2Types<ToDataType> ||
123
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
124
            return false;
125
        }
126
10.6k
        return call_on_index_and_data_type<
127
10.6k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
10.6k
            using Types2 = std::decay_t<decltype(types2)>;
129
10.6k
            using FromDataType = typename Types2::LeftType;
130
10.6k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
10.6k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
10.6k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
10.6k
                return false;
134
10.6k
            }
135
10.6k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
10.6k
                using FromFieldType = typename FromDataType::FieldType;
137
10.6k
                using ToFieldType = typename ToDataType::FieldType;
138
10.6k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
10.6k
                UInt32 from_scale = 0;
140
141
10.6k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
10.6k
                    const auto* from_decimal_type =
143
10.6k
                            check_and_get_data_type<FromDataType>(from_type.get());
144
10.6k
                    from_precision =
145
10.6k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
10.6k
                    from_scale = from_decimal_type->get_scale();
147
10.6k
                }
148
149
10.6k
                UInt32 to_max_digits = 0;
150
10.6k
                UInt32 to_precision = 0;
151
10.6k
                UInt32 to_scale = 0;
152
153
10.6k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
10.6k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
10.6k
                    const auto* to_decimal_type =
157
10.6k
                            check_and_get_data_type<ToDataType>(to_type.get());
158
10.6k
                    to_precision = to_decimal_type->get_precision();
159
10.6k
                    ToDataType::check_type_precision(to_precision);
160
161
10.6k
                    to_scale = to_decimal_type->get_scale();
162
10.6k
                    ToDataType::check_type_scale(to_scale);
163
10.6k
                }
164
10.6k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
10.6k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
10.6k
                    to_precision = to_max_digits;
167
10.6k
                }
168
169
10.6k
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
10.6k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
10.6k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
10.6k
                if (to_scale > from_scale) {
174
10.6k
                    multiply_may_overflow &=
175
10.6k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
10.6k
                }
177
10.6k
                return narrow_integral || multiply_may_overflow;
178
10.6k
            }
179
10.6k
            return false;
180
10.6k
        });
181
10.6k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEvEEEEbRKT_
Line
Count
Source
117
228
    auto make_default_wrapper = [&](const auto& types) -> bool {
118
228
        using Types = std::decay_t<decltype(types)>;
119
228
        using ToDataType = typename Types::LeftType;
120
121
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
122
                        IsDatelikeV2Types<ToDataType> ||
123
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
124
            return false;
125
        }
126
228
        return call_on_index_and_data_type<
127
228
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
228
            using Types2 = std::decay_t<decltype(types2)>;
129
228
            using FromDataType = typename Types2::LeftType;
130
228
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
228
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
228
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
228
                return false;
134
228
            }
135
228
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
228
                using FromFieldType = typename FromDataType::FieldType;
137
228
                using ToFieldType = typename ToDataType::FieldType;
138
228
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
228
                UInt32 from_scale = 0;
140
141
228
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
228
                    const auto* from_decimal_type =
143
228
                            check_and_get_data_type<FromDataType>(from_type.get());
144
228
                    from_precision =
145
228
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
228
                    from_scale = from_decimal_type->get_scale();
147
228
                }
148
149
228
                UInt32 to_max_digits = 0;
150
228
                UInt32 to_precision = 0;
151
228
                UInt32 to_scale = 0;
152
153
228
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
228
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
228
                    const auto* to_decimal_type =
157
228
                            check_and_get_data_type<ToDataType>(to_type.get());
158
228
                    to_precision = to_decimal_type->get_precision();
159
228
                    ToDataType::check_type_precision(to_precision);
160
161
228
                    to_scale = to_decimal_type->get_scale();
162
228
                    ToDataType::check_type_scale(to_scale);
163
228
                }
164
228
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
228
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
228
                    to_precision = to_max_digits;
167
228
                }
168
169
228
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
228
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
228
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
228
                if (to_scale > from_scale) {
174
228
                    multiply_may_overflow &=
175
228
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
228
                }
177
228
                return narrow_integral || multiply_may_overflow;
178
228
            }
179
228
            return false;
180
228
        });
181
228
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEvEEEEbRKT_
Line
Count
Source
117
10.2k
    auto make_default_wrapper = [&](const auto& types) -> bool {
118
10.2k
        using Types = std::decay_t<decltype(types)>;
119
10.2k
        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.2k
        return call_on_index_and_data_type<
127
10.2k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
10.2k
            using Types2 = std::decay_t<decltype(types2)>;
129
10.2k
            using FromDataType = typename Types2::LeftType;
130
10.2k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
10.2k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
10.2k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
10.2k
                return false;
134
10.2k
            }
135
10.2k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
10.2k
                using FromFieldType = typename FromDataType::FieldType;
137
10.2k
                using ToFieldType = typename ToDataType::FieldType;
138
10.2k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
10.2k
                UInt32 from_scale = 0;
140
141
10.2k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
10.2k
                    const auto* from_decimal_type =
143
10.2k
                            check_and_get_data_type<FromDataType>(from_type.get());
144
10.2k
                    from_precision =
145
10.2k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
10.2k
                    from_scale = from_decimal_type->get_scale();
147
10.2k
                }
148
149
10.2k
                UInt32 to_max_digits = 0;
150
10.2k
                UInt32 to_precision = 0;
151
10.2k
                UInt32 to_scale = 0;
152
153
10.2k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
10.2k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
10.2k
                    const auto* to_decimal_type =
157
10.2k
                            check_and_get_data_type<ToDataType>(to_type.get());
158
10.2k
                    to_precision = to_decimal_type->get_precision();
159
10.2k
                    ToDataType::check_type_precision(to_precision);
160
161
10.2k
                    to_scale = to_decimal_type->get_scale();
162
10.2k
                    ToDataType::check_type_scale(to_scale);
163
10.2k
                }
164
10.2k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
10.2k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
10.2k
                    to_precision = to_max_digits;
167
10.2k
                }
168
169
10.2k
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
10.2k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
10.2k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
10.2k
                if (to_scale > from_scale) {
174
10.2k
                    multiply_may_overflow &=
175
10.2k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
10.2k
                }
177
10.2k
                return narrow_integral || multiply_may_overflow;
178
10.2k
            }
179
10.2k
            return false;
180
10.2k
        });
181
10.2k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEvEEEEbRKT_
Line
Count
Source
117
7.58k
    auto make_default_wrapper = [&](const auto& types) -> bool {
118
7.58k
        using Types = std::decay_t<decltype(types)>;
119
7.58k
        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.58k
        return call_on_index_and_data_type<
127
7.58k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
7.58k
            using Types2 = std::decay_t<decltype(types2)>;
129
7.58k
            using FromDataType = typename Types2::LeftType;
130
7.58k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
7.58k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
7.58k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
7.58k
                return false;
134
7.58k
            }
135
7.58k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
7.58k
                using FromFieldType = typename FromDataType::FieldType;
137
7.58k
                using ToFieldType = typename ToDataType::FieldType;
138
7.58k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
7.58k
                UInt32 from_scale = 0;
140
141
7.58k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
7.58k
                    const auto* from_decimal_type =
143
7.58k
                            check_and_get_data_type<FromDataType>(from_type.get());
144
7.58k
                    from_precision =
145
7.58k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
7.58k
                    from_scale = from_decimal_type->get_scale();
147
7.58k
                }
148
149
7.58k
                UInt32 to_max_digits = 0;
150
7.58k
                UInt32 to_precision = 0;
151
7.58k
                UInt32 to_scale = 0;
152
153
7.58k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
7.58k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
7.58k
                    const auto* to_decimal_type =
157
7.58k
                            check_and_get_data_type<ToDataType>(to_type.get());
158
7.58k
                    to_precision = to_decimal_type->get_precision();
159
7.58k
                    ToDataType::check_type_precision(to_precision);
160
161
7.58k
                    to_scale = to_decimal_type->get_scale();
162
7.58k
                    ToDataType::check_type_scale(to_scale);
163
7.58k
                }
164
7.58k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
7.58k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
7.58k
                    to_precision = to_max_digits;
167
7.58k
                }
168
169
7.58k
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
7.58k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
7.58k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
7.58k
                if (to_scale > from_scale) {
174
7.58k
                    multiply_may_overflow &=
175
7.58k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
7.58k
                }
177
7.58k
                return narrow_integral || multiply_may_overflow;
178
7.58k
            }
179
7.58k
            return false;
180
7.58k
        });
181
7.58k
    };
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
6.61k
    auto make_default_wrapper = [&](const auto& types) -> bool {
118
6.61k
        using Types = std::decay_t<decltype(types)>;
119
6.61k
        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
6.61k
        return call_on_index_and_data_type<
127
6.61k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
6.61k
            using Types2 = std::decay_t<decltype(types2)>;
129
6.61k
            using FromDataType = typename Types2::LeftType;
130
6.61k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
6.61k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
6.61k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
6.61k
                return false;
134
6.61k
            }
135
6.61k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
6.61k
                using FromFieldType = typename FromDataType::FieldType;
137
6.61k
                using ToFieldType = typename ToDataType::FieldType;
138
6.61k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
6.61k
                UInt32 from_scale = 0;
140
141
6.61k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
6.61k
                    const auto* from_decimal_type =
143
6.61k
                            check_and_get_data_type<FromDataType>(from_type.get());
144
6.61k
                    from_precision =
145
6.61k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
6.61k
                    from_scale = from_decimal_type->get_scale();
147
6.61k
                }
148
149
6.61k
                UInt32 to_max_digits = 0;
150
6.61k
                UInt32 to_precision = 0;
151
6.61k
                UInt32 to_scale = 0;
152
153
6.61k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
6.61k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
6.61k
                    const auto* to_decimal_type =
157
6.61k
                            check_and_get_data_type<ToDataType>(to_type.get());
158
6.61k
                    to_precision = to_decimal_type->get_precision();
159
6.61k
                    ToDataType::check_type_precision(to_precision);
160
161
6.61k
                    to_scale = to_decimal_type->get_scale();
162
6.61k
                    ToDataType::check_type_scale(to_scale);
163
6.61k
                }
164
6.61k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
6.61k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
6.61k
                    to_precision = to_max_digits;
167
6.61k
                }
168
169
6.61k
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
6.61k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
6.61k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
6.61k
                if (to_scale > from_scale) {
174
6.61k
                    multiply_may_overflow &=
175
6.61k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
6.61k
                }
177
6.61k
                return narrow_integral || multiply_may_overflow;
178
6.61k
            }
179
6.61k
            return false;
180
6.61k
        });
181
6.61k
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_18DataTypeDateTimeV2EvEEEEbRKT_
Line
Count
Source
117
3.51k
    auto make_default_wrapper = [&](const auto& types) -> bool {
118
3.51k
        using Types = std::decay_t<decltype(types)>;
119
3.51k
        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.51k
        return call_on_index_and_data_type<
127
3.51k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
3.51k
            using Types2 = std::decay_t<decltype(types2)>;
129
3.51k
            using FromDataType = typename Types2::LeftType;
130
3.51k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
3.51k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
3.51k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
3.51k
                return false;
134
3.51k
            }
135
3.51k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
3.51k
                using FromFieldType = typename FromDataType::FieldType;
137
3.51k
                using ToFieldType = typename ToDataType::FieldType;
138
3.51k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
3.51k
                UInt32 from_scale = 0;
140
141
3.51k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
3.51k
                    const auto* from_decimal_type =
143
3.51k
                            check_and_get_data_type<FromDataType>(from_type.get());
144
3.51k
                    from_precision =
145
3.51k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
3.51k
                    from_scale = from_decimal_type->get_scale();
147
3.51k
                }
148
149
3.51k
                UInt32 to_max_digits = 0;
150
3.51k
                UInt32 to_precision = 0;
151
3.51k
                UInt32 to_scale = 0;
152
153
3.51k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
3.51k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
3.51k
                    const auto* to_decimal_type =
157
3.51k
                            check_and_get_data_type<ToDataType>(to_type.get());
158
3.51k
                    to_precision = to_decimal_type->get_precision();
159
3.51k
                    ToDataType::check_type_precision(to_precision);
160
161
3.51k
                    to_scale = to_decimal_type->get_scale();
162
3.51k
                    ToDataType::check_type_scale(to_scale);
163
3.51k
                }
164
3.51k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
3.51k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
3.51k
                    to_precision = to_max_digits;
167
3.51k
                }
168
169
3.51k
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
3.51k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
3.51k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
3.51k
                if (to_scale > from_scale) {
174
3.51k
                    multiply_may_overflow &=
175
3.51k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
3.51k
                }
177
3.51k
                return narrow_integral || multiply_may_overflow;
178
3.51k
            }
179
3.51k
            return false;
180
3.51k
        });
181
3.51k
    };
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
392
    auto make_default_wrapper = [&](const auto& types) -> bool {
118
392
        using Types = std::decay_t<decltype(types)>;
119
392
        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
392
        return call_on_index_and_data_type<
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
392
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
392
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
392
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
392
                return false;
134
392
            }
135
392
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
392
                using FromFieldType = typename FromDataType::FieldType;
137
392
                using ToFieldType = typename ToDataType::FieldType;
138
392
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
392
                UInt32 from_scale = 0;
140
141
392
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
392
                    const auto* from_decimal_type =
143
392
                            check_and_get_data_type<FromDataType>(from_type.get());
144
392
                    from_precision =
145
392
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
392
                    from_scale = from_decimal_type->get_scale();
147
392
                }
148
149
392
                UInt32 to_max_digits = 0;
150
392
                UInt32 to_precision = 0;
151
392
                UInt32 to_scale = 0;
152
153
392
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
392
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
392
                    const auto* to_decimal_type =
157
392
                            check_and_get_data_type<ToDataType>(to_type.get());
158
392
                    to_precision = to_decimal_type->get_precision();
159
392
                    ToDataType::check_type_precision(to_precision);
160
161
392
                    to_scale = to_decimal_type->get_scale();
162
392
                    ToDataType::check_type_scale(to_scale);
163
392
                }
164
392
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
392
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
392
                    to_precision = to_max_digits;
167
392
                }
168
169
392
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
392
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
392
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
392
                if (to_scale > from_scale) {
174
392
                    multiply_may_overflow &=
175
392
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
392
                }
177
392
                return narrow_integral || multiply_may_overflow;
178
392
            }
179
392
            return false;
180
392
        });
181
392
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_19DataTypeTimeStampTzEvEEEEbRKT_
Line
Count
Source
117
145
    auto make_default_wrapper = [&](const auto& types) -> bool {
118
145
        using Types = std::decay_t<decltype(types)>;
119
145
        using ToDataType = typename Types::LeftType;
120
121
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
122
                        IsDatelikeV2Types<ToDataType> ||
123
145
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
124
145
            return false;
125
145
        }
126
0
        return call_on_index_and_data_type<
127
145
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
145
            using Types2 = std::decay_t<decltype(types2)>;
129
145
            using FromDataType = typename Types2::LeftType;
130
145
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
145
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
145
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
145
                return false;
134
145
            }
135
145
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
145
                using FromFieldType = typename FromDataType::FieldType;
137
145
                using ToFieldType = typename ToDataType::FieldType;
138
145
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
145
                UInt32 from_scale = 0;
140
141
145
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
145
                    const auto* from_decimal_type =
143
145
                            check_and_get_data_type<FromDataType>(from_type.get());
144
145
                    from_precision =
145
145
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
145
                    from_scale = from_decimal_type->get_scale();
147
145
                }
148
149
145
                UInt32 to_max_digits = 0;
150
145
                UInt32 to_precision = 0;
151
145
                UInt32 to_scale = 0;
152
153
145
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
145
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
145
                    const auto* to_decimal_type =
157
145
                            check_and_get_data_type<ToDataType>(to_type.get());
158
145
                    to_precision = to_decimal_type->get_precision();
159
145
                    ToDataType::check_type_precision(to_precision);
160
161
145
                    to_scale = to_decimal_type->get_scale();
162
145
                    ToDataType::check_type_scale(to_scale);
163
145
                }
164
145
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
145
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
145
                    to_precision = to_max_digits;
167
145
                }
168
169
145
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
145
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
145
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
145
                if (to_scale > from_scale) {
174
145
                    multiply_may_overflow &=
175
145
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
145
                }
177
145
                return narrow_integral || multiply_may_overflow;
178
145
            }
179
145
            return false;
180
145
        });
181
145
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv4EvEEEEbRKT_
Line
Count
Source
117
631
    auto make_default_wrapper = [&](const auto& types) -> bool {
118
631
        using Types = std::decay_t<decltype(types)>;
119
631
        using ToDataType = typename Types::LeftType;
120
121
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
122
                        IsDatelikeV2Types<ToDataType> ||
123
631
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
124
631
            return false;
125
631
        }
126
0
        return call_on_index_and_data_type<
127
631
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
631
            using Types2 = std::decay_t<decltype(types2)>;
129
631
            using FromDataType = typename Types2::LeftType;
130
631
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
631
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
631
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
631
                return false;
134
631
            }
135
631
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
631
                using FromFieldType = typename FromDataType::FieldType;
137
631
                using ToFieldType = typename ToDataType::FieldType;
138
631
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
631
                UInt32 from_scale = 0;
140
141
631
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
631
                    const auto* from_decimal_type =
143
631
                            check_and_get_data_type<FromDataType>(from_type.get());
144
631
                    from_precision =
145
631
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
631
                    from_scale = from_decimal_type->get_scale();
147
631
                }
148
149
631
                UInt32 to_max_digits = 0;
150
631
                UInt32 to_precision = 0;
151
631
                UInt32 to_scale = 0;
152
153
631
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
631
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
631
                    const auto* to_decimal_type =
157
631
                            check_and_get_data_type<ToDataType>(to_type.get());
158
631
                    to_precision = to_decimal_type->get_precision();
159
631
                    ToDataType::check_type_precision(to_precision);
160
161
631
                    to_scale = to_decimal_type->get_scale();
162
631
                    ToDataType::check_type_scale(to_scale);
163
631
                }
164
631
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
631
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
631
                    to_precision = to_max_digits;
167
631
                }
168
169
631
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
631
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
631
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
631
                if (to_scale > from_scale) {
174
631
                    multiply_may_overflow &=
175
631
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
631
                }
177
631
                return narrow_integral || multiply_may_overflow;
178
631
            }
179
631
            return false;
180
631
        });
181
631
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_12DataTypeIPv6EvEEEEbRKT_
Line
Count
Source
117
283
    auto make_default_wrapper = [&](const auto& types) -> bool {
118
283
        using Types = std::decay_t<decltype(types)>;
119
283
        using ToDataType = typename Types::LeftType;
120
121
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
122
                        IsDatelikeV2Types<ToDataType> ||
123
283
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
124
283
            return false;
125
283
        }
126
0
        return call_on_index_and_data_type<
127
283
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
283
            using Types2 = std::decay_t<decltype(types2)>;
129
283
            using FromDataType = typename Types2::LeftType;
130
283
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
283
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
283
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
283
                return false;
134
283
            }
135
283
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
283
                using FromFieldType = typename FromDataType::FieldType;
137
283
                using ToFieldType = typename ToDataType::FieldType;
138
283
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
283
                UInt32 from_scale = 0;
140
141
283
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
283
                    const auto* from_decimal_type =
143
283
                            check_and_get_data_type<FromDataType>(from_type.get());
144
283
                    from_precision =
145
283
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
283
                    from_scale = from_decimal_type->get_scale();
147
283
                }
148
149
283
                UInt32 to_max_digits = 0;
150
283
                UInt32 to_precision = 0;
151
283
                UInt32 to_scale = 0;
152
153
283
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
283
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
283
                    const auto* to_decimal_type =
157
283
                            check_and_get_data_type<ToDataType>(to_type.get());
158
283
                    to_precision = to_decimal_type->get_precision();
159
283
                    ToDataType::check_type_precision(to_precision);
160
161
283
                    to_scale = to_decimal_type->get_scale();
162
283
                    ToDataType::check_type_scale(to_scale);
163
283
                }
164
283
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
283
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
283
                    to_precision = to_max_digits;
167
283
                }
168
169
283
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
283
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
283
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
283
                if (to_scale > from_scale) {
174
283
                    multiply_may_overflow &=
175
283
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
283
                }
177
283
                return narrow_integral || multiply_may_overflow;
178
283
            }
179
283
            return false;
180
283
        });
181
283
    };
function_cast.cpp:_ZZN5doris11CastWrapper33need_replace_null_data_to_defaultEPNS_15FunctionContextERKSt10shared_ptrIKNS_9IDataTypeEES8_ENK3$_0clINS_8TypePairINS_14DataTypeStringEvEEEEbRKT_
Line
Count
Source
117
31.2k
    auto make_default_wrapper = [&](const auto& types) -> bool {
118
31.2k
        using Types = std::decay_t<decltype(types)>;
119
31.2k
        using ToDataType = typename Types::LeftType;
120
121
        if constexpr (!(IsDataTypeDecimalOrNumber<ToDataType> || IsDatelikeV1Types<ToDataType> ||
122
                        IsDatelikeV2Types<ToDataType> ||
123
31.2k
                        std::is_same_v<ToDataType, DataTypeTimeV2>)) {
124
31.2k
            return false;
125
31.2k
        }
126
0
        return call_on_index_and_data_type<
127
31.2k
                ToDataType>(from_type->get_primitive_type(), [&](const auto& types2) -> bool {
128
31.2k
            using Types2 = std::decay_t<decltype(types2)>;
129
31.2k
            using FromDataType = typename Types2::LeftType;
130
31.2k
            if constexpr (!(IsDataTypeDecimalOrNumber<FromDataType> ||
131
31.2k
                            IsDatelikeV1Types<FromDataType> || IsDatelikeV2Types<FromDataType> ||
132
31.2k
                            std::is_same_v<FromDataType, DataTypeTimeV2>)) {
133
31.2k
                return false;
134
31.2k
            }
135
31.2k
            if constexpr (IsDataTypeDecimal<FromDataType> || IsDataTypeDecimal<ToDataType>) {
136
31.2k
                using FromFieldType = typename FromDataType::FieldType;
137
31.2k
                using ToFieldType = typename ToDataType::FieldType;
138
31.2k
                UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>();
139
31.2k
                UInt32 from_scale = 0;
140
141
31.2k
                if constexpr (IsDataTypeDecimal<FromDataType>) {
142
31.2k
                    const auto* from_decimal_type =
143
31.2k
                            check_and_get_data_type<FromDataType>(from_type.get());
144
31.2k
                    from_precision =
145
31.2k
                            NumberTraits::max_ascii_len<typename FromFieldType::NativeType>();
146
31.2k
                    from_scale = from_decimal_type->get_scale();
147
31.2k
                }
148
149
31.2k
                UInt32 to_max_digits = 0;
150
31.2k
                UInt32 to_precision = 0;
151
31.2k
                UInt32 to_scale = 0;
152
153
31.2k
                if constexpr (IsDataTypeDecimal<ToDataType>) {
154
31.2k
                    to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>();
155
156
31.2k
                    const auto* to_decimal_type =
157
31.2k
                            check_and_get_data_type<ToDataType>(to_type.get());
158
31.2k
                    to_precision = to_decimal_type->get_precision();
159
31.2k
                    ToDataType::check_type_precision(to_precision);
160
161
31.2k
                    to_scale = to_decimal_type->get_scale();
162
31.2k
                    ToDataType::check_type_scale(to_scale);
163
31.2k
                }
164
31.2k
                if constexpr (IsIntegralV<ToFieldType> || std::is_floating_point_v<ToFieldType>) {
165
31.2k
                    to_max_digits = NumberTraits::max_ascii_len<ToFieldType>();
166
31.2k
                    to_precision = to_max_digits;
167
31.2k
                }
168
169
31.2k
                bool narrow_integral = context->check_overflow_for_decimal() &&
170
31.2k
                                       (to_precision - to_scale) <= (from_precision - from_scale);
171
172
31.2k
                bool multiply_may_overflow = context->check_overflow_for_decimal();
173
31.2k
                if (to_scale > from_scale) {
174
31.2k
                    multiply_may_overflow &=
175
31.2k
                            (from_precision + to_scale - from_scale) >= to_max_digits;
176
31.2k
                }
177
31.2k
                return narrow_integral || multiply_may_overflow;
178
31.2k
            }
179
31.2k
            return false;
180
31.2k
        });
181
31.2k
    };
182
183
281k
    return call_on_index_and_data_type<void>(to_type->get_primitive_type(), make_default_wrapper);
184
344k
}
185
186
WrapperType prepare_remove_nullable(FunctionContext* context, const DataTypePtr& from_type,
187
368k
                                    const DataTypePtr& to_type) {
188
    /// Determine whether pre-processing and/or post-processing must take place during conversion.
189
368k
    bool result_is_nullable = to_type->is_nullable();
190
191
368k
    if (result_is_nullable) {
192
344k
        return [from_type, to_type](FunctionContext* context, Block& block,
193
344k
                                    const ColumnNumbers& arguments, uint32_t result,
194
344k
                                    size_t input_rows_count,
195
345k
                                    const NullMap::value_type* null_map = nullptr) {
196
345k
            auto from_type_not_nullable = remove_nullable(from_type);
197
345k
            auto to_type_not_nullable = remove_nullable(to_type);
198
199
345k
            bool replace_null_data_to_default = need_replace_null_data_to_default(
200
345k
                    context, from_type_not_nullable, to_type_not_nullable);
201
202
345k
            auto nested_result_index = block.columns();
203
345k
            block.insert(block.get_by_position(result).unnest_nullable());
204
345k
            auto nested_source_index = block.columns();
205
345k
            block.insert(block.get_by_position(arguments[0])
206
345k
                                 .unnest_nullable(replace_null_data_to_default));
207
208
345k
            const auto& arg_col = block.get_by_position(arguments[0]);
209
345k
            const NullMap::value_type* arg_null_map = nullptr;
210
345k
            if (const auto* nullable = check_and_get_column<ColumnNullable>(*arg_col.column)) {
211
301k
                arg_null_map = nullable->get_null_map_data().data();
212
301k
            }
213
345k
            RETURN_IF_ERROR(prepare_impl(context, from_type_not_nullable, to_type_not_nullable)(
214
345k
                    context, block, {nested_source_index}, nested_result_index, input_rows_count,
215
345k
                    arg_null_map));
216
217
319k
            block.get_by_position(result).column =
218
319k
                    wrap_in_nullable(block.get_by_position(nested_result_index).column, block,
219
319k
                                     arguments, input_rows_count);
220
221
319k
            block.erase(nested_source_index);
222
319k
            block.erase(nested_result_index);
223
319k
            return Status::OK();
224
345k
        };
225
344k
    } else {
226
23.1k
        return prepare_impl(context, from_type, to_type);
227
23.1k
    }
228
368k
}
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
383k
                         const DataTypePtr& origin_to_type) {
234
383k
    auto to_type = get_serialized_type(origin_to_type);
235
383k
    auto from_type = get_serialized_type(origin_from_type);
236
383k
    if (from_type->equals(*to_type)) {
237
68.0k
        return create_identity_wrapper(from_type);
238
68.0k
    }
239
240
    // variant needs to be judged first
241
315k
    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
303k
    if (from_type->get_primitive_type() == PrimitiveType::TYPE_VARIANT) {
246
17.5k
        return create_cast_from_variant_wrapper(static_cast<const DataTypeVariant&>(*from_type),
247
17.5k
                                                to_type);
248
17.5k
    }
249
250
285k
    if (from_type->get_primitive_type() == PrimitiveType::TYPE_JSONB) {
251
9.28k
        return create_cast_from_jsonb_wrapper(static_cast<const DataTypeJsonb&>(*from_type),
252
9.28k
                                              to_type,
253
18.4E
                                              context ? context->jsonb_string_as_string() : false);
254
9.28k
    }
255
256
276k
    switch (to_type->get_primitive_type()) {
257
924
    case PrimitiveType::TYPE_BOOLEAN:
258
924
        return create_boolean_wrapper(context, from_type);
259
3.72k
    case PrimitiveType::TYPE_TINYINT:
260
3.72k
        return create_int_wrapper<DataTypeInt8>(context, from_type);
261
5.25k
    case PrimitiveType::TYPE_SMALLINT:
262
5.25k
        return create_int_wrapper<DataTypeInt16>(context, from_type);
263
31.1k
    case PrimitiveType::TYPE_INT:
264
31.1k
        return create_int_wrapper<DataTypeInt32>(context, from_type);
265
40.0k
    case PrimitiveType::TYPE_BIGINT:
266
40.0k
        return create_int_wrapper<DataTypeInt64>(context, from_type);
267
4.04k
    case PrimitiveType::TYPE_LARGEINT:
268
4.04k
        return create_int_wrapper<DataTypeInt128>(context, from_type);
269
10.2k
    case PrimitiveType::TYPE_FLOAT:
270
10.2k
        return create_float_wrapper<DataTypeFloat32>(context, from_type);
271
24.8k
    case PrimitiveType::TYPE_DOUBLE:
272
24.8k
        return create_float_wrapper<DataTypeFloat64>(context, from_type);
273
30
    case PrimitiveType::TYPE_DATE:
274
30
        return create_datelike_wrapper<DataTypeDate>(context, from_type);
275
25
    case PrimitiveType::TYPE_DATETIME:
276
25
        return create_datelike_wrapper<DataTypeDateTime>(context, from_type);
277
6.66k
    case PrimitiveType::TYPE_DATEV2:
278
6.66k
        return create_datelike_wrapper<DataTypeDateV2>(context, from_type);
279
3.93k
    case PrimitiveType::TYPE_DATETIMEV2:
280
3.93k
        return create_datelike_wrapper<DataTypeDateTimeV2>(context, from_type);
281
145
    case PrimitiveType::TYPE_TIMESTAMPTZ:
282
145
        return create_timestamptz_wrapper(context, from_type);
283
392
    case PrimitiveType::TYPE_TIMEV2:
284
392
        return create_datelike_wrapper<DataTypeTimeV2>(context, from_type);
285
475
    case PrimitiveType::TYPE_IPV4:
286
475
        return create_ip_wrapper<DataTypeIPv4>(context, from_type);
287
284
    case PrimitiveType::TYPE_IPV6:
288
284
        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
6.64k
    case PrimitiveType::TYPE_DECIMAL32:
292
6.64k
        return create_decimal_wrapper<DataTypeDecimal32>(context, from_type);
293
14.1k
    case PrimitiveType::TYPE_DECIMAL64:
294
14.1k
        return create_decimal_wrapper<DataTypeDecimal64>(context, from_type);
295
12.2k
    case PrimitiveType::TYPE_DECIMAL128I:
296
12.2k
        return create_decimal_wrapper<DataTypeDecimal128>(context, from_type);
297
7.65k
    case PrimitiveType::TYPE_DECIMAL256:
298
7.65k
        return create_decimal_wrapper<DataTypeDecimal256>(context, from_type);
299
32
    case PrimitiveType::TYPE_CHAR:
300
4.32k
    case PrimitiveType::TYPE_VARCHAR:
301
28.0k
    case PrimitiveType::TYPE_STRING:
302
28.0k
        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
936
    case PrimitiveType::TYPE_MAP:
310
936
        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
276k
    }
327
328
0
    return create_unsupport_wrapper(from_type->get_name(), to_type->get_name());
329
276k
}
330
331
} // namespace CastWrapper
332
333
class PreparedFunctionCast : public PreparedFunctionImpl {
334
public:
335
    explicit PreparedFunctionCast(CastWrapper::WrapperType&& wrapper_function_, const char* name_)
336
358k
            : 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
357k
                        uint32_t result, size_t input_rows_count) const override {
343
357k
        return wrapper_function(context, block, arguments, result, input_rows_count, nullptr);
344
357k
    }
345
346
358k
    bool use_default_implementation_for_nulls() const override { return false; }
347
357k
    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
270k
            : name(name_),
358
270k
              argument_types(std::move(argument_types_)),
359
270k
              return_type(std::move(return_type_)) {}
360
361
358k
    const DataTypes& get_argument_types() const override { return argument_types; }
362
358k
    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
358k
                                uint32_t /*result*/) const override {
367
358k
        return std::make_shared<PreparedFunctionCast>(
368
358k
                CastWrapper::prepare_unpack_dictionaries(context, get_argument_types()[0],
369
358k
                                                         get_return_type()),
370
358k
                name);
371
358k
    }
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
270k
    static FunctionBuilderPtr create() { return std::make_shared<FunctionBuilderCast>(); }
388
389
270k
    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
270k
                               const DataTypePtr& return_type) const override {
400
270k
        DataTypes data_types(arguments.size());
401
402
811k
        for (size_t i = 0; i < arguments.size(); ++i) {
403
541k
            data_types[i] = arguments[i].type;
404
541k
        }
405
406
270k
        return std::make_shared<FunctionCast>(name, data_types, return_type);
407
270k
    }
408
409
270k
    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