be/src/exprs/function/cast/cast_to_decimal.h
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 | | #pragma once |
19 | | |
20 | | #include <cmath> |
21 | | #include <type_traits> |
22 | | |
23 | | #include "common/status.h" |
24 | | #include "core/data_type/data_type_decimal.h" |
25 | | #include "core/data_type/data_type_number.h" |
26 | | #include "core/types.h" |
27 | | #include "exprs/function/cast/cast_to_basic_number_common.h" |
28 | | #include "util/io_helper.h" |
29 | | |
30 | | namespace doris { |
31 | | |
32 | | #define DECIMAL_CONVERT_OVERFLOW_ERROR(value, from_type_name, precision, scale) \ |
33 | 4.28k | Status(ErrorCode::ARITHMETIC_OVERFLOW_ERRROR, \ |
34 | 4.28k | fmt::format( \ |
35 | 4.28k | "Arithmetic overflow when converting value {} from type {} to decimal({}, {})", \ |
36 | 4.28k | value, from_type_name, precision, scale)) |
37 | | struct CastToDecimal { |
38 | | template <typename ToCppT> |
39 | | requires(IsDecimalNumber<ToCppT>) |
40 | | static inline bool from_string(const StringRef& from, ToCppT& to, UInt32 precision, |
41 | 221k | UInt32 scale, CastParameters& params) { |
42 | 221k | if constexpr (IsDecimalV2<ToCppT>) { |
43 | 28 | return StringParser::PARSE_SUCCESS == |
44 | 28 | try_read_decimal_text<TYPE_DECIMALV2>(to, from, precision, scale); |
45 | 28 | } |
46 | | |
47 | 59.5k | if constexpr (IsDecimal32<ToCppT>) { |
48 | 59.5k | return StringParser::PARSE_SUCCESS == |
49 | 59.5k | try_read_decimal_text<TYPE_DECIMAL32>(to, from, precision, scale); |
50 | 59.5k | } |
51 | | |
52 | 53.8k | if constexpr (IsDecimal64<ToCppT>) { |
53 | 53.8k | return StringParser::PARSE_SUCCESS == |
54 | 53.8k | try_read_decimal_text<TYPE_DECIMAL64>(to, from, precision, scale); |
55 | 53.8k | } |
56 | | |
57 | 53.8k | if constexpr (IsDecimal128V3<ToCppT>) { |
58 | 53.8k | return StringParser::PARSE_SUCCESS == |
59 | 53.8k | try_read_decimal_text<TYPE_DECIMAL128I>(to, from, precision, scale); |
60 | 53.8k | } |
61 | | |
62 | 53.7k | if constexpr (IsDecimal256<ToCppT>) { |
63 | 53.7k | return StringParser::PARSE_SUCCESS == |
64 | 53.7k | try_read_decimal_text<TYPE_DECIMAL256>(to, from, precision, scale); |
65 | 53.7k | } |
66 | 221k | } _ZN5doris13CastToDecimal11from_stringINS_7DecimalIiEEQ15IsDecimalNumberIT_EEEbRKNS_9StringRefERS4_jjRNS_14CastParametersE Line | Count | Source | 41 | 59.5k | UInt32 scale, CastParameters& params) { | 42 | | if constexpr (IsDecimalV2<ToCppT>) { | 43 | | return StringParser::PARSE_SUCCESS == | 44 | | try_read_decimal_text<TYPE_DECIMALV2>(to, from, precision, scale); | 45 | | } | 46 | | | 47 | 59.5k | if constexpr (IsDecimal32<ToCppT>) { | 48 | 59.5k | return StringParser::PARSE_SUCCESS == | 49 | 59.5k | try_read_decimal_text<TYPE_DECIMAL32>(to, from, precision, scale); | 50 | 59.5k | } | 51 | | | 52 | | if constexpr (IsDecimal64<ToCppT>) { | 53 | | return StringParser::PARSE_SUCCESS == | 54 | | try_read_decimal_text<TYPE_DECIMAL64>(to, from, precision, scale); | 55 | | } | 56 | | | 57 | | if constexpr (IsDecimal128V3<ToCppT>) { | 58 | | return StringParser::PARSE_SUCCESS == | 59 | | try_read_decimal_text<TYPE_DECIMAL128I>(to, from, precision, scale); | 60 | | } | 61 | | | 62 | | if constexpr (IsDecimal256<ToCppT>) { | 63 | | return StringParser::PARSE_SUCCESS == | 64 | | try_read_decimal_text<TYPE_DECIMAL256>(to, from, precision, scale); | 65 | | } | 66 | 59.5k | } |
_ZN5doris13CastToDecimal11from_stringINS_7DecimalIlEEQ15IsDecimalNumberIT_EEEbRKNS_9StringRefERS4_jjRNS_14CastParametersE Line | Count | Source | 41 | 53.8k | UInt32 scale, CastParameters& params) { | 42 | | if constexpr (IsDecimalV2<ToCppT>) { | 43 | | return StringParser::PARSE_SUCCESS == | 44 | | try_read_decimal_text<TYPE_DECIMALV2>(to, from, precision, scale); | 45 | | } | 46 | | | 47 | | if constexpr (IsDecimal32<ToCppT>) { | 48 | | return StringParser::PARSE_SUCCESS == | 49 | | try_read_decimal_text<TYPE_DECIMAL32>(to, from, precision, scale); | 50 | | } | 51 | | | 52 | 53.8k | if constexpr (IsDecimal64<ToCppT>) { | 53 | 53.8k | return StringParser::PARSE_SUCCESS == | 54 | 53.8k | try_read_decimal_text<TYPE_DECIMAL64>(to, from, precision, scale); | 55 | 53.8k | } | 56 | | | 57 | | if constexpr (IsDecimal128V3<ToCppT>) { | 58 | | return StringParser::PARSE_SUCCESS == | 59 | | try_read_decimal_text<TYPE_DECIMAL128I>(to, from, precision, scale); | 60 | | } | 61 | | | 62 | | if constexpr (IsDecimal256<ToCppT>) { | 63 | | return StringParser::PARSE_SUCCESS == | 64 | | try_read_decimal_text<TYPE_DECIMAL256>(to, from, precision, scale); | 65 | | } | 66 | 53.8k | } |
_ZN5doris13CastToDecimal11from_stringINS_12Decimal128V3EQ15IsDecimalNumberIT_EEEbRKNS_9StringRefERS3_jjRNS_14CastParametersE Line | Count | Source | 41 | 53.8k | UInt32 scale, CastParameters& params) { | 42 | | if constexpr (IsDecimalV2<ToCppT>) { | 43 | | return StringParser::PARSE_SUCCESS == | 44 | | try_read_decimal_text<TYPE_DECIMALV2>(to, from, precision, scale); | 45 | | } | 46 | | | 47 | | if constexpr (IsDecimal32<ToCppT>) { | 48 | | return StringParser::PARSE_SUCCESS == | 49 | | try_read_decimal_text<TYPE_DECIMAL32>(to, from, precision, scale); | 50 | | } | 51 | | | 52 | | if constexpr (IsDecimal64<ToCppT>) { | 53 | | return StringParser::PARSE_SUCCESS == | 54 | | try_read_decimal_text<TYPE_DECIMAL64>(to, from, precision, scale); | 55 | | } | 56 | | | 57 | 53.8k | if constexpr (IsDecimal128V3<ToCppT>) { | 58 | 53.8k | return StringParser::PARSE_SUCCESS == | 59 | 53.8k | try_read_decimal_text<TYPE_DECIMAL128I>(to, from, precision, scale); | 60 | 53.8k | } | 61 | | | 62 | | if constexpr (IsDecimal256<ToCppT>) { | 63 | | return StringParser::PARSE_SUCCESS == | 64 | | try_read_decimal_text<TYPE_DECIMAL256>(to, from, precision, scale); | 65 | | } | 66 | 53.8k | } |
_ZN5doris13CastToDecimal11from_stringINS_14DecimalV2ValueEQ15IsDecimalNumberIT_EEEbRKNS_9StringRefERS3_jjRNS_14CastParametersE Line | Count | Source | 41 | 28 | UInt32 scale, CastParameters& params) { | 42 | 28 | if constexpr (IsDecimalV2<ToCppT>) { | 43 | 28 | return StringParser::PARSE_SUCCESS == | 44 | 28 | try_read_decimal_text<TYPE_DECIMALV2>(to, from, precision, scale); | 45 | 28 | } | 46 | | | 47 | | if constexpr (IsDecimal32<ToCppT>) { | 48 | | return StringParser::PARSE_SUCCESS == | 49 | | try_read_decimal_text<TYPE_DECIMAL32>(to, from, precision, scale); | 50 | | } | 51 | | | 52 | | if constexpr (IsDecimal64<ToCppT>) { | 53 | | return StringParser::PARSE_SUCCESS == | 54 | | try_read_decimal_text<TYPE_DECIMAL64>(to, from, precision, scale); | 55 | | } | 56 | | | 57 | | if constexpr (IsDecimal128V3<ToCppT>) { | 58 | | return StringParser::PARSE_SUCCESS == | 59 | | try_read_decimal_text<TYPE_DECIMAL128I>(to, from, precision, scale); | 60 | | } | 61 | | | 62 | | if constexpr (IsDecimal256<ToCppT>) { | 63 | | return StringParser::PARSE_SUCCESS == | 64 | | try_read_decimal_text<TYPE_DECIMAL256>(to, from, precision, scale); | 65 | | } | 66 | 28 | } |
_ZN5doris13CastToDecimal11from_stringINS_7DecimalIN4wide7integerILm256EiEEEEQ15IsDecimalNumberIT_EEEbRKNS_9StringRefERS7_jjRNS_14CastParametersE Line | Count | Source | 41 | 53.7k | UInt32 scale, CastParameters& params) { | 42 | | if constexpr (IsDecimalV2<ToCppT>) { | 43 | | return StringParser::PARSE_SUCCESS == | 44 | | try_read_decimal_text<TYPE_DECIMALV2>(to, from, precision, scale); | 45 | | } | 46 | | | 47 | | if constexpr (IsDecimal32<ToCppT>) { | 48 | | return StringParser::PARSE_SUCCESS == | 49 | | try_read_decimal_text<TYPE_DECIMAL32>(to, from, precision, scale); | 50 | | } | 51 | | | 52 | | if constexpr (IsDecimal64<ToCppT>) { | 53 | | return StringParser::PARSE_SUCCESS == | 54 | | try_read_decimal_text<TYPE_DECIMAL64>(to, from, precision, scale); | 55 | | } | 56 | | | 57 | | if constexpr (IsDecimal128V3<ToCppT>) { | 58 | | return StringParser::PARSE_SUCCESS == | 59 | | try_read_decimal_text<TYPE_DECIMAL128I>(to, from, precision, scale); | 60 | | } | 61 | | | 62 | 53.7k | if constexpr (IsDecimal256<ToCppT>) { | 63 | 53.7k | return StringParser::PARSE_SUCCESS == | 64 | 53.7k | try_read_decimal_text<TYPE_DECIMAL256>(to, from, precision, scale); | 65 | 53.7k | } | 66 | 53.7k | } |
|
67 | | |
68 | | // cast int to decimal |
69 | | template <typename FromCppT, typename ToCppT, |
70 | | typename MaxNativeType = |
71 | | std::conditional_t<(sizeof(FromCppT) > sizeof(typename ToCppT::NativeType)), |
72 | | FromCppT, typename ToCppT::NativeType>> |
73 | | requires(IsDecimalNumber<ToCppT> && |
74 | | (IsCppTypeInt<FromCppT> || std::is_same_v<FromCppT, UInt8>)) |
75 | | static inline bool from_int(const FromCppT& from, ToCppT& to, UInt32 to_precision, |
76 | 14 | UInt32 to_scale, CastParameters& params) { |
77 | 14 | MaxNativeType scale_multiplier = |
78 | 14 | DataTypeDecimal<ToCppT::PType>::get_scale_multiplier(to_scale); |
79 | 14 | typename ToCppT::NativeType max_result = |
80 | 14 | DataTypeDecimal<ToCppT::PType>::get_max_digits_number(to_precision); |
81 | 14 | typename ToCppT::NativeType min_result = -max_result; |
82 | | |
83 | 14 | UInt32 from_precision = NumberTraits::max_ascii_len<FromCppT>(); |
84 | 14 | constexpr UInt32 from_scale = 0; |
85 | 14 | constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToCppT::NativeType>(); |
86 | | |
87 | 14 | auto from_max_int_digit_count = from_precision - from_scale; |
88 | 14 | auto to_max_int_digit_count = to_precision - to_scale; |
89 | 14 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); |
90 | 14 | bool multiply_may_overflow = false; |
91 | 14 | if (to_scale > from_scale) { |
92 | 14 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; |
93 | 14 | } |
94 | 14 | return std::visit( |
95 | 14 | [&](auto multiply_may_overflow, auto narrow_integral) { |
96 | 14 | return _from_int<FromCppT, ToCppT, multiply_may_overflow, narrow_integral>( |
97 | 14 | from, to, to_precision, to_scale, scale_multiplier, min_result, |
98 | 14 | max_result, params); |
99 | 14 | }, _ZZN5doris13CastToDecimal8from_intIhNS_7DecimalIiEEiQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRNS_14CastParametersEENKUlS5_S4_E_clISt17integral_constantIbLb0EESE_EEDaS5_S4_ Line | Count | Source | 95 | 4 | [&](auto multiply_may_overflow, auto narrow_integral) { | 96 | 4 | return _from_int<FromCppT, ToCppT, multiply_may_overflow, narrow_integral>( | 97 | 4 | from, to, to_precision, to_scale, scale_multiplier, min_result, | 98 | 4 | max_result, params); | 99 | 4 | }, |
Unexecuted instantiation: _ZZN5doris13CastToDecimal8from_intIhNS_7DecimalIiEEiQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRNS_14CastParametersEENKUlS5_S4_E_clISt17integral_constantIbLb0EESD_IbLb1EEEEDaS5_S4_ Unexecuted instantiation: _ZZN5doris13CastToDecimal8from_intIhNS_7DecimalIiEEiQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRNS_14CastParametersEENKUlS5_S4_E_clISt17integral_constantIbLb1EESD_IbLb0EEEEDaS5_S4_ Unexecuted instantiation: _ZZN5doris13CastToDecimal8from_intIhNS_7DecimalIiEEiQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRNS_14CastParametersEENKUlS5_S4_E_clISt17integral_constantIbLb1EESE_EEDaS5_S4_ _ZZN5doris13CastToDecimal8from_intIaNS_7DecimalIiEEiQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRNS_14CastParametersEENKUlS5_S4_E_clISt17integral_constantIbLb0EESE_EEDaS5_S4_ Line | Count | Source | 95 | 2 | [&](auto multiply_may_overflow, auto narrow_integral) { | 96 | 2 | return _from_int<FromCppT, ToCppT, multiply_may_overflow, narrow_integral>( | 97 | 2 | from, to, to_precision, to_scale, scale_multiplier, min_result, | 98 | 2 | max_result, params); | 99 | 2 | }, |
Unexecuted instantiation: _ZZN5doris13CastToDecimal8from_intIaNS_7DecimalIiEEiQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRNS_14CastParametersEENKUlS5_S4_E_clISt17integral_constantIbLb0EESD_IbLb1EEEEDaS5_S4_ Unexecuted instantiation: _ZZN5doris13CastToDecimal8from_intIaNS_7DecimalIiEEiQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRNS_14CastParametersEENKUlS5_S4_E_clISt17integral_constantIbLb1EESD_IbLb0EEEEDaS5_S4_ Unexecuted instantiation: _ZZN5doris13CastToDecimal8from_intIaNS_7DecimalIiEEiQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRNS_14CastParametersEENKUlS5_S4_E_clISt17integral_constantIbLb1EESE_EEDaS5_S4_ Unexecuted instantiation: _ZZN5doris13CastToDecimal8from_intIsNS_7DecimalIiEEiQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRNS_14CastParametersEENKUlS5_S4_E_clISt17integral_constantIbLb0EESE_EEDaS5_S4_ _ZZN5doris13CastToDecimal8from_intIsNS_7DecimalIiEEiQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRNS_14CastParametersEENKUlS5_S4_E_clISt17integral_constantIbLb0EESD_IbLb1EEEEDaS5_S4_ Line | Count | Source | 95 | 2 | [&](auto multiply_may_overflow, auto narrow_integral) { | 96 | 2 | return _from_int<FromCppT, ToCppT, multiply_may_overflow, narrow_integral>( | 97 | 2 | from, to, to_precision, to_scale, scale_multiplier, min_result, | 98 | 2 | max_result, params); | 99 | 2 | }, |
Unexecuted instantiation: _ZZN5doris13CastToDecimal8from_intIsNS_7DecimalIiEEiQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRNS_14CastParametersEENKUlS5_S4_E_clISt17integral_constantIbLb1EESD_IbLb0EEEEDaS5_S4_ Unexecuted instantiation: _ZZN5doris13CastToDecimal8from_intIsNS_7DecimalIiEEiQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRNS_14CastParametersEENKUlS5_S4_E_clISt17integral_constantIbLb1EESE_EEDaS5_S4_ Unexecuted instantiation: _ZZN5doris13CastToDecimal8from_intIiNS_7DecimalIiEEiQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRNS_14CastParametersEENKUlS5_S4_E_clISt17integral_constantIbLb0EESE_EEDaS5_S4_ Unexecuted instantiation: _ZZN5doris13CastToDecimal8from_intIiNS_7DecimalIiEEiQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRNS_14CastParametersEENKUlS5_S4_E_clISt17integral_constantIbLb0EESD_IbLb1EEEEDaS5_S4_ Unexecuted instantiation: _ZZN5doris13CastToDecimal8from_intIiNS_7DecimalIiEEiQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRNS_14CastParametersEENKUlS5_S4_E_clISt17integral_constantIbLb1EESD_IbLb0EEEEDaS5_S4_ _ZZN5doris13CastToDecimal8from_intIiNS_7DecimalIiEEiQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRNS_14CastParametersEENKUlS5_S4_E_clISt17integral_constantIbLb1EESE_EEDaS5_S4_ Line | Count | Source | 95 | 2 | [&](auto multiply_may_overflow, auto narrow_integral) { | 96 | 2 | return _from_int<FromCppT, ToCppT, multiply_may_overflow, narrow_integral>( | 97 | 2 | from, to, to_precision, to_scale, scale_multiplier, min_result, | 98 | 2 | max_result, params); | 99 | 2 | }, |
Unexecuted instantiation: _ZZN5doris13CastToDecimal8from_intIlNS_7DecimalIiEElQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRNS_14CastParametersEENKUlS5_S4_E_clISt17integral_constantIbLb0EESE_EEDaS5_S4_ Unexecuted instantiation: _ZZN5doris13CastToDecimal8from_intIlNS_7DecimalIiEElQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRNS_14CastParametersEENKUlS5_S4_E_clISt17integral_constantIbLb0EESD_IbLb1EEEEDaS5_S4_ Unexecuted instantiation: _ZZN5doris13CastToDecimal8from_intIlNS_7DecimalIiEElQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRNS_14CastParametersEENKUlS5_S4_E_clISt17integral_constantIbLb1EESD_IbLb0EEEEDaS5_S4_ _ZZN5doris13CastToDecimal8from_intIlNS_7DecimalIiEElQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRNS_14CastParametersEENKUlS5_S4_E_clISt17integral_constantIbLb1EESE_EEDaS5_S4_ Line | Count | Source | 95 | 2 | [&](auto multiply_may_overflow, auto narrow_integral) { | 96 | 2 | return _from_int<FromCppT, ToCppT, multiply_may_overflow, narrow_integral>( | 97 | 2 | from, to, to_precision, to_scale, scale_multiplier, min_result, | 98 | 2 | max_result, params); | 99 | 2 | }, |
Unexecuted instantiation: _ZZN5doris13CastToDecimal8from_intInNS_7DecimalIiEEnQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRNS_14CastParametersEENKUlS5_S4_E_clISt17integral_constantIbLb0EESE_EEDaS5_S4_ Unexecuted instantiation: _ZZN5doris13CastToDecimal8from_intInNS_7DecimalIiEEnQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRNS_14CastParametersEENKUlS5_S4_E_clISt17integral_constantIbLb0EESD_IbLb1EEEEDaS5_S4_ Unexecuted instantiation: _ZZN5doris13CastToDecimal8from_intInNS_7DecimalIiEEnQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRNS_14CastParametersEENKUlS5_S4_E_clISt17integral_constantIbLb1EESD_IbLb0EEEEDaS5_S4_ _ZZN5doris13CastToDecimal8from_intInNS_7DecimalIiEEnQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRNS_14CastParametersEENKUlS5_S4_E_clISt17integral_constantIbLb1EESE_EEDaS5_S4_ Line | Count | Source | 95 | 2 | [&](auto multiply_may_overflow, auto narrow_integral) { | 96 | 2 | return _from_int<FromCppT, ToCppT, multiply_may_overflow, narrow_integral>( | 97 | 2 | from, to, to_precision, to_scale, scale_multiplier, min_result, | 98 | 2 | max_result, params); | 99 | 2 | }, |
Unexecuted instantiation: _ZZN5doris13CastToDecimal8from_intIhNS_7DecimalIlEElQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRNS_14CastParametersEENKUlS5_S4_E_clISt17integral_constantIbLb0EESE_EEDaS5_S4_ Unexecuted instantiation: _ZZN5doris13CastToDecimal8from_intIhNS_7DecimalIlEElQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRNS_14CastParametersEENKUlS5_S4_E_clISt17integral_constantIbLb0EESD_IbLb1EEEEDaS5_S4_ Unexecuted instantiation: _ZZN5doris13CastToDecimal8from_intIhNS_7DecimalIlEElQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRNS_14CastParametersEENKUlS5_S4_E_clISt17integral_constantIbLb1EESD_IbLb0EEEEDaS5_S4_ Unexecuted instantiation: _ZZN5doris13CastToDecimal8from_intIhNS_7DecimalIlEElQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRNS_14CastParametersEENKUlS5_S4_E_clISt17integral_constantIbLb1EESE_EEDaS5_S4_ Unexecuted instantiation: _ZZN5doris13CastToDecimal8from_intIaNS_7DecimalIlEElQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRNS_14CastParametersEENKUlS5_S4_E_clISt17integral_constantIbLb0EESE_EEDaS5_S4_ Unexecuted instantiation: _ZZN5doris13CastToDecimal8from_intIaNS_7DecimalIlEElQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRNS_14CastParametersEENKUlS5_S4_E_clISt17integral_constantIbLb0EESD_IbLb1EEEEDaS5_S4_ Unexecuted instantiation: _ZZN5doris13CastToDecimal8from_intIaNS_7DecimalIlEElQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRNS_14CastParametersEENKUlS5_S4_E_clISt17integral_constantIbLb1EESD_IbLb0EEEEDaS5_S4_ Unexecuted instantiation: _ZZN5doris13CastToDecimal8from_intIaNS_7DecimalIlEElQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRNS_14CastParametersEENKUlS5_S4_E_clISt17integral_constantIbLb1EESE_EEDaS5_S4_ Unexecuted instantiation: _ZZN5doris13CastToDecimal8from_intIsNS_7DecimalIlEElQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRNS_14CastParametersEENKUlS5_S4_E_clISt17integral_constantIbLb0EESE_EEDaS5_S4_ Unexecuted instantiation: _ZZN5doris13CastToDecimal8from_intIsNS_7DecimalIlEElQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRNS_14CastParametersEENKUlS5_S4_E_clISt17integral_constantIbLb0EESD_IbLb1EEEEDaS5_S4_ Unexecuted instantiation: _ZZN5doris13CastToDecimal8from_intIsNS_7DecimalIlEElQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRNS_14CastParametersEENKUlS5_S4_E_clISt17integral_constantIbLb1EESD_IbLb0EEEEDaS5_S4_ Unexecuted instantiation: _ZZN5doris13CastToDecimal8from_intIsNS_7DecimalIlEElQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRNS_14CastParametersEENKUlS5_S4_E_clISt17integral_constantIbLb1EESE_EEDaS5_S4_ Unexecuted instantiation: _ZZN5doris13CastToDecimal8from_intIiNS_7DecimalIlEElQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRNS_14CastParametersEENKUlS5_S4_E_clISt17integral_constantIbLb0EESE_EEDaS5_S4_ Unexecuted instantiation: _ZZN5doris13CastToDecimal8from_intIiNS_7DecimalIlEElQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRNS_14CastParametersEENKUlS5_S4_E_clISt17integral_constantIbLb0EESD_IbLb1EEEEDaS5_S4_ Unexecuted instantiation: _ZZN5doris13CastToDecimal8from_intIiNS_7DecimalIlEElQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRNS_14CastParametersEENKUlS5_S4_E_clISt17integral_constantIbLb1EESD_IbLb0EEEEDaS5_S4_ Unexecuted instantiation: _ZZN5doris13CastToDecimal8from_intIiNS_7DecimalIlEElQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRNS_14CastParametersEENKUlS5_S4_E_clISt17integral_constantIbLb1EESE_EEDaS5_S4_ Unexecuted instantiation: _ZZN5doris13CastToDecimal8from_intIlNS_7DecimalIlEElQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRNS_14CastParametersEENKUlS5_S4_E_clISt17integral_constantIbLb0EESE_EEDaS5_S4_ Unexecuted instantiation: _ZZN5doris13CastToDecimal8from_intIlNS_7DecimalIlEElQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRNS_14CastParametersEENKUlS5_S4_E_clISt17integral_constantIbLb0EESD_IbLb1EEEEDaS5_S4_ Unexecuted instantiation: _ZZN5doris13CastToDecimal8from_intIlNS_7DecimalIlEElQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRNS_14CastParametersEENKUlS5_S4_E_clISt17integral_constantIbLb1EESD_IbLb0EEEEDaS5_S4_ Unexecuted instantiation: _ZZN5doris13CastToDecimal8from_intIlNS_7DecimalIlEElQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRNS_14CastParametersEENKUlS5_S4_E_clISt17integral_constantIbLb1EESE_EEDaS5_S4_ Unexecuted instantiation: _ZZN5doris13CastToDecimal8from_intInNS_7DecimalIlEEnQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRNS_14CastParametersEENKUlS5_S4_E_clISt17integral_constantIbLb0EESE_EEDaS5_S4_ Unexecuted instantiation: _ZZN5doris13CastToDecimal8from_intInNS_7DecimalIlEEnQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRNS_14CastParametersEENKUlS5_S4_E_clISt17integral_constantIbLb0EESD_IbLb1EEEEDaS5_S4_ Unexecuted instantiation: _ZZN5doris13CastToDecimal8from_intInNS_7DecimalIlEEnQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRNS_14CastParametersEENKUlS5_S4_E_clISt17integral_constantIbLb1EESD_IbLb0EEEEDaS5_S4_ Unexecuted instantiation: _ZZN5doris13CastToDecimal8from_intInNS_7DecimalIlEEnQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRNS_14CastParametersEENKUlS5_S4_E_clISt17integral_constantIbLb1EESE_EEDaS5_S4_ Unexecuted instantiation: _ZZN5doris13CastToDecimal8from_intIhNS_12Decimal128V3EnQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRNS_14CastParametersEENKUlS4_S3_E_clISt17integral_constantIbLb0EESD_EEDaS4_S3_ Unexecuted instantiation: _ZZN5doris13CastToDecimal8from_intIhNS_12Decimal128V3EnQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRNS_14CastParametersEENKUlS4_S3_E_clISt17integral_constantIbLb0EESC_IbLb1EEEEDaS4_S3_ Unexecuted instantiation: _ZZN5doris13CastToDecimal8from_intIhNS_12Decimal128V3EnQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRNS_14CastParametersEENKUlS4_S3_E_clISt17integral_constantIbLb1EESC_IbLb0EEEEDaS4_S3_ Unexecuted instantiation: _ZZN5doris13CastToDecimal8from_intIhNS_12Decimal128V3EnQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRNS_14CastParametersEENKUlS4_S3_E_clISt17integral_constantIbLb1EESD_EEDaS4_S3_ Unexecuted instantiation: _ZZN5doris13CastToDecimal8from_intIaNS_12Decimal128V3EnQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRNS_14CastParametersEENKUlS4_S3_E_clISt17integral_constantIbLb0EESD_EEDaS4_S3_ Unexecuted instantiation: _ZZN5doris13CastToDecimal8from_intIaNS_12Decimal128V3EnQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRNS_14CastParametersEENKUlS4_S3_E_clISt17integral_constantIbLb0EESC_IbLb1EEEEDaS4_S3_ Unexecuted instantiation: _ZZN5doris13CastToDecimal8from_intIaNS_12Decimal128V3EnQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRNS_14CastParametersEENKUlS4_S3_E_clISt17integral_constantIbLb1EESC_IbLb0EEEEDaS4_S3_ Unexecuted instantiation: _ZZN5doris13CastToDecimal8from_intIaNS_12Decimal128V3EnQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRNS_14CastParametersEENKUlS4_S3_E_clISt17integral_constantIbLb1EESD_EEDaS4_S3_ Unexecuted instantiation: _ZZN5doris13CastToDecimal8from_intIsNS_12Decimal128V3EnQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRNS_14CastParametersEENKUlS4_S3_E_clISt17integral_constantIbLb0EESD_EEDaS4_S3_ Unexecuted instantiation: _ZZN5doris13CastToDecimal8from_intIsNS_12Decimal128V3EnQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRNS_14CastParametersEENKUlS4_S3_E_clISt17integral_constantIbLb0EESC_IbLb1EEEEDaS4_S3_ Unexecuted instantiation: _ZZN5doris13CastToDecimal8from_intIsNS_12Decimal128V3EnQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRNS_14CastParametersEENKUlS4_S3_E_clISt17integral_constantIbLb1EESC_IbLb0EEEEDaS4_S3_ Unexecuted instantiation: _ZZN5doris13CastToDecimal8from_intIsNS_12Decimal128V3EnQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRNS_14CastParametersEENKUlS4_S3_E_clISt17integral_constantIbLb1EESD_EEDaS4_S3_ Unexecuted instantiation: _ZZN5doris13CastToDecimal8from_intIiNS_12Decimal128V3EnQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRNS_14CastParametersEENKUlS4_S3_E_clISt17integral_constantIbLb0EESD_EEDaS4_S3_ Unexecuted instantiation: _ZZN5doris13CastToDecimal8from_intIiNS_12Decimal128V3EnQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRNS_14CastParametersEENKUlS4_S3_E_clISt17integral_constantIbLb0EESC_IbLb1EEEEDaS4_S3_ Unexecuted instantiation: _ZZN5doris13CastToDecimal8from_intIiNS_12Decimal128V3EnQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRNS_14CastParametersEENKUlS4_S3_E_clISt17integral_constantIbLb1EESC_IbLb0EEEEDaS4_S3_ Unexecuted instantiation: _ZZN5doris13CastToDecimal8from_intIiNS_12Decimal128V3EnQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRNS_14CastParametersEENKUlS4_S3_E_clISt17integral_constantIbLb1EESD_EEDaS4_S3_ Unexecuted instantiation: _ZZN5doris13CastToDecimal8from_intIlNS_12Decimal128V3EnQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRNS_14CastParametersEENKUlS4_S3_E_clISt17integral_constantIbLb0EESD_EEDaS4_S3_ Unexecuted instantiation: _ZZN5doris13CastToDecimal8from_intIlNS_12Decimal128V3EnQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRNS_14CastParametersEENKUlS4_S3_E_clISt17integral_constantIbLb0EESC_IbLb1EEEEDaS4_S3_ Unexecuted instantiation: _ZZN5doris13CastToDecimal8from_intIlNS_12Decimal128V3EnQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRNS_14CastParametersEENKUlS4_S3_E_clISt17integral_constantIbLb1EESC_IbLb0EEEEDaS4_S3_ Unexecuted instantiation: _ZZN5doris13CastToDecimal8from_intIlNS_12Decimal128V3EnQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRNS_14CastParametersEENKUlS4_S3_E_clISt17integral_constantIbLb1EESD_EEDaS4_S3_ Unexecuted instantiation: _ZZN5doris13CastToDecimal8from_intInNS_12Decimal128V3EnQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRNS_14CastParametersEENKUlS4_S3_E_clISt17integral_constantIbLb0EESD_EEDaS4_S3_ Unexecuted instantiation: _ZZN5doris13CastToDecimal8from_intInNS_12Decimal128V3EnQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRNS_14CastParametersEENKUlS4_S3_E_clISt17integral_constantIbLb0EESC_IbLb1EEEEDaS4_S3_ Unexecuted instantiation: _ZZN5doris13CastToDecimal8from_intInNS_12Decimal128V3EnQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRNS_14CastParametersEENKUlS4_S3_E_clISt17integral_constantIbLb1EESC_IbLb0EEEEDaS4_S3_ Unexecuted instantiation: _ZZN5doris13CastToDecimal8from_intInNS_12Decimal128V3EnQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRNS_14CastParametersEENKUlS4_S3_E_clISt17integral_constantIbLb1EESD_EEDaS4_S3_ Unexecuted instantiation: _ZZN5doris13CastToDecimal8from_intIhNS_7DecimalIN4wide7integerILm256EiEEEES5_Qaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS8_hEEEbRKS8_RS7_jjRNS_14CastParametersEENKUlS8_S7_E_clISt17integral_constantIbLb0EESH_EEDaS8_S7_ Unexecuted instantiation: _ZZN5doris13CastToDecimal8from_intIhNS_7DecimalIN4wide7integerILm256EiEEEES5_Qaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS8_hEEEbRKS8_RS7_jjRNS_14CastParametersEENKUlS8_S7_E_clISt17integral_constantIbLb0EESG_IbLb1EEEEDaS8_S7_ Unexecuted instantiation: _ZZN5doris13CastToDecimal8from_intIhNS_7DecimalIN4wide7integerILm256EiEEEES5_Qaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS8_hEEEbRKS8_RS7_jjRNS_14CastParametersEENKUlS8_S7_E_clISt17integral_constantIbLb1EESG_IbLb0EEEEDaS8_S7_ Unexecuted instantiation: _ZZN5doris13CastToDecimal8from_intIhNS_7DecimalIN4wide7integerILm256EiEEEES5_Qaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS8_hEEEbRKS8_RS7_jjRNS_14CastParametersEENKUlS8_S7_E_clISt17integral_constantIbLb1EESH_EEDaS8_S7_ Unexecuted instantiation: _ZZN5doris13CastToDecimal8from_intIaNS_7DecimalIN4wide7integerILm256EiEEEES5_Qaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS8_hEEEbRKS8_RS7_jjRNS_14CastParametersEENKUlS8_S7_E_clISt17integral_constantIbLb0EESH_EEDaS8_S7_ Unexecuted instantiation: _ZZN5doris13CastToDecimal8from_intIaNS_7DecimalIN4wide7integerILm256EiEEEES5_Qaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS8_hEEEbRKS8_RS7_jjRNS_14CastParametersEENKUlS8_S7_E_clISt17integral_constantIbLb0EESG_IbLb1EEEEDaS8_S7_ Unexecuted instantiation: _ZZN5doris13CastToDecimal8from_intIaNS_7DecimalIN4wide7integerILm256EiEEEES5_Qaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS8_hEEEbRKS8_RS7_jjRNS_14CastParametersEENKUlS8_S7_E_clISt17integral_constantIbLb1EESG_IbLb0EEEEDaS8_S7_ Unexecuted instantiation: _ZZN5doris13CastToDecimal8from_intIaNS_7DecimalIN4wide7integerILm256EiEEEES5_Qaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS8_hEEEbRKS8_RS7_jjRNS_14CastParametersEENKUlS8_S7_E_clISt17integral_constantIbLb1EESH_EEDaS8_S7_ Unexecuted instantiation: _ZZN5doris13CastToDecimal8from_intIsNS_7DecimalIN4wide7integerILm256EiEEEES5_Qaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS8_hEEEbRKS8_RS7_jjRNS_14CastParametersEENKUlS8_S7_E_clISt17integral_constantIbLb0EESH_EEDaS8_S7_ Unexecuted instantiation: _ZZN5doris13CastToDecimal8from_intIsNS_7DecimalIN4wide7integerILm256EiEEEES5_Qaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS8_hEEEbRKS8_RS7_jjRNS_14CastParametersEENKUlS8_S7_E_clISt17integral_constantIbLb0EESG_IbLb1EEEEDaS8_S7_ Unexecuted instantiation: _ZZN5doris13CastToDecimal8from_intIsNS_7DecimalIN4wide7integerILm256EiEEEES5_Qaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS8_hEEEbRKS8_RS7_jjRNS_14CastParametersEENKUlS8_S7_E_clISt17integral_constantIbLb1EESG_IbLb0EEEEDaS8_S7_ Unexecuted instantiation: _ZZN5doris13CastToDecimal8from_intIsNS_7DecimalIN4wide7integerILm256EiEEEES5_Qaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS8_hEEEbRKS8_RS7_jjRNS_14CastParametersEENKUlS8_S7_E_clISt17integral_constantIbLb1EESH_EEDaS8_S7_ Unexecuted instantiation: _ZZN5doris13CastToDecimal8from_intIiNS_7DecimalIN4wide7integerILm256EiEEEES5_Qaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS8_hEEEbRKS8_RS7_jjRNS_14CastParametersEENKUlS8_S7_E_clISt17integral_constantIbLb0EESH_EEDaS8_S7_ Unexecuted instantiation: _ZZN5doris13CastToDecimal8from_intIiNS_7DecimalIN4wide7integerILm256EiEEEES5_Qaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS8_hEEEbRKS8_RS7_jjRNS_14CastParametersEENKUlS8_S7_E_clISt17integral_constantIbLb0EESG_IbLb1EEEEDaS8_S7_ Unexecuted instantiation: _ZZN5doris13CastToDecimal8from_intIiNS_7DecimalIN4wide7integerILm256EiEEEES5_Qaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS8_hEEEbRKS8_RS7_jjRNS_14CastParametersEENKUlS8_S7_E_clISt17integral_constantIbLb1EESG_IbLb0EEEEDaS8_S7_ Unexecuted instantiation: _ZZN5doris13CastToDecimal8from_intIiNS_7DecimalIN4wide7integerILm256EiEEEES5_Qaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS8_hEEEbRKS8_RS7_jjRNS_14CastParametersEENKUlS8_S7_E_clISt17integral_constantIbLb1EESH_EEDaS8_S7_ Unexecuted instantiation: _ZZN5doris13CastToDecimal8from_intIlNS_7DecimalIN4wide7integerILm256EiEEEES5_Qaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS8_hEEEbRKS8_RS7_jjRNS_14CastParametersEENKUlS8_S7_E_clISt17integral_constantIbLb0EESH_EEDaS8_S7_ Unexecuted instantiation: _ZZN5doris13CastToDecimal8from_intIlNS_7DecimalIN4wide7integerILm256EiEEEES5_Qaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS8_hEEEbRKS8_RS7_jjRNS_14CastParametersEENKUlS8_S7_E_clISt17integral_constantIbLb0EESG_IbLb1EEEEDaS8_S7_ Unexecuted instantiation: _ZZN5doris13CastToDecimal8from_intIlNS_7DecimalIN4wide7integerILm256EiEEEES5_Qaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS8_hEEEbRKS8_RS7_jjRNS_14CastParametersEENKUlS8_S7_E_clISt17integral_constantIbLb1EESG_IbLb0EEEEDaS8_S7_ Unexecuted instantiation: _ZZN5doris13CastToDecimal8from_intIlNS_7DecimalIN4wide7integerILm256EiEEEES5_Qaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS8_hEEEbRKS8_RS7_jjRNS_14CastParametersEENKUlS8_S7_E_clISt17integral_constantIbLb1EESH_EEDaS8_S7_ Unexecuted instantiation: _ZZN5doris13CastToDecimal8from_intInNS_7DecimalIN4wide7integerILm256EiEEEES5_Qaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS8_hEEEbRKS8_RS7_jjRNS_14CastParametersEENKUlS8_S7_E_clISt17integral_constantIbLb0EESH_EEDaS8_S7_ Unexecuted instantiation: _ZZN5doris13CastToDecimal8from_intInNS_7DecimalIN4wide7integerILm256EiEEEES5_Qaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS8_hEEEbRKS8_RS7_jjRNS_14CastParametersEENKUlS8_S7_E_clISt17integral_constantIbLb0EESG_IbLb1EEEEDaS8_S7_ Unexecuted instantiation: _ZZN5doris13CastToDecimal8from_intInNS_7DecimalIN4wide7integerILm256EiEEEES5_Qaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS8_hEEEbRKS8_RS7_jjRNS_14CastParametersEENKUlS8_S7_E_clISt17integral_constantIbLb1EESG_IbLb0EEEEDaS8_S7_ Unexecuted instantiation: _ZZN5doris13CastToDecimal8from_intInNS_7DecimalIN4wide7integerILm256EiEEEES5_Qaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS8_hEEEbRKS8_RS7_jjRNS_14CastParametersEENKUlS8_S7_E_clISt17integral_constantIbLb1EESH_EEDaS8_S7_ |
100 | 14 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral)); |
101 | 14 | } _ZN5doris13CastToDecimal8from_intIhNS_7DecimalIiEEiQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRNS_14CastParametersE Line | Count | Source | 76 | 4 | UInt32 to_scale, CastParameters& params) { | 77 | 4 | MaxNativeType scale_multiplier = | 78 | 4 | DataTypeDecimal<ToCppT::PType>::get_scale_multiplier(to_scale); | 79 | 4 | typename ToCppT::NativeType max_result = | 80 | 4 | DataTypeDecimal<ToCppT::PType>::get_max_digits_number(to_precision); | 81 | 4 | typename ToCppT::NativeType min_result = -max_result; | 82 | | | 83 | 4 | UInt32 from_precision = NumberTraits::max_ascii_len<FromCppT>(); | 84 | 4 | constexpr UInt32 from_scale = 0; | 85 | 4 | constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToCppT::NativeType>(); | 86 | | | 87 | 4 | auto from_max_int_digit_count = from_precision - from_scale; | 88 | 4 | auto to_max_int_digit_count = to_precision - to_scale; | 89 | 4 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 90 | 4 | bool multiply_may_overflow = false; | 91 | 4 | if (to_scale > from_scale) { | 92 | 4 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 93 | 4 | } | 94 | 4 | return std::visit( | 95 | 4 | [&](auto multiply_may_overflow, auto narrow_integral) { | 96 | 4 | return _from_int<FromCppT, ToCppT, multiply_may_overflow, narrow_integral>( | 97 | 4 | from, to, to_precision, to_scale, scale_multiplier, min_result, | 98 | 4 | max_result, params); | 99 | 4 | }, | 100 | 4 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral)); | 101 | 4 | } |
_ZN5doris13CastToDecimal8from_intIaNS_7DecimalIiEEiQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRNS_14CastParametersE Line | Count | Source | 76 | 2 | UInt32 to_scale, CastParameters& params) { | 77 | 2 | MaxNativeType scale_multiplier = | 78 | 2 | DataTypeDecimal<ToCppT::PType>::get_scale_multiplier(to_scale); | 79 | 2 | typename ToCppT::NativeType max_result = | 80 | 2 | DataTypeDecimal<ToCppT::PType>::get_max_digits_number(to_precision); | 81 | 2 | typename ToCppT::NativeType min_result = -max_result; | 82 | | | 83 | 2 | UInt32 from_precision = NumberTraits::max_ascii_len<FromCppT>(); | 84 | 2 | constexpr UInt32 from_scale = 0; | 85 | 2 | constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToCppT::NativeType>(); | 86 | | | 87 | 2 | auto from_max_int_digit_count = from_precision - from_scale; | 88 | 2 | auto to_max_int_digit_count = to_precision - to_scale; | 89 | 2 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 90 | 2 | bool multiply_may_overflow = false; | 91 | 2 | if (to_scale > from_scale) { | 92 | 2 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 93 | 2 | } | 94 | 2 | return std::visit( | 95 | 2 | [&](auto multiply_may_overflow, auto narrow_integral) { | 96 | 2 | return _from_int<FromCppT, ToCppT, multiply_may_overflow, narrow_integral>( | 97 | 2 | from, to, to_precision, to_scale, scale_multiplier, min_result, | 98 | 2 | max_result, params); | 99 | 2 | }, | 100 | 2 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral)); | 101 | 2 | } |
_ZN5doris13CastToDecimal8from_intIsNS_7DecimalIiEEiQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRNS_14CastParametersE Line | Count | Source | 76 | 2 | UInt32 to_scale, CastParameters& params) { | 77 | 2 | MaxNativeType scale_multiplier = | 78 | 2 | DataTypeDecimal<ToCppT::PType>::get_scale_multiplier(to_scale); | 79 | 2 | typename ToCppT::NativeType max_result = | 80 | 2 | DataTypeDecimal<ToCppT::PType>::get_max_digits_number(to_precision); | 81 | 2 | typename ToCppT::NativeType min_result = -max_result; | 82 | | | 83 | 2 | UInt32 from_precision = NumberTraits::max_ascii_len<FromCppT>(); | 84 | 2 | constexpr UInt32 from_scale = 0; | 85 | 2 | constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToCppT::NativeType>(); | 86 | | | 87 | 2 | auto from_max_int_digit_count = from_precision - from_scale; | 88 | 2 | auto to_max_int_digit_count = to_precision - to_scale; | 89 | 2 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 90 | 2 | bool multiply_may_overflow = false; | 91 | 2 | if (to_scale > from_scale) { | 92 | 2 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 93 | 2 | } | 94 | 2 | return std::visit( | 95 | 2 | [&](auto multiply_may_overflow, auto narrow_integral) { | 96 | 2 | return _from_int<FromCppT, ToCppT, multiply_may_overflow, narrow_integral>( | 97 | 2 | from, to, to_precision, to_scale, scale_multiplier, min_result, | 98 | 2 | max_result, params); | 99 | 2 | }, | 100 | 2 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral)); | 101 | 2 | } |
_ZN5doris13CastToDecimal8from_intIiNS_7DecimalIiEEiQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRNS_14CastParametersE Line | Count | Source | 76 | 2 | UInt32 to_scale, CastParameters& params) { | 77 | 2 | MaxNativeType scale_multiplier = | 78 | 2 | DataTypeDecimal<ToCppT::PType>::get_scale_multiplier(to_scale); | 79 | 2 | typename ToCppT::NativeType max_result = | 80 | 2 | DataTypeDecimal<ToCppT::PType>::get_max_digits_number(to_precision); | 81 | 2 | typename ToCppT::NativeType min_result = -max_result; | 82 | | | 83 | 2 | UInt32 from_precision = NumberTraits::max_ascii_len<FromCppT>(); | 84 | 2 | constexpr UInt32 from_scale = 0; | 85 | 2 | constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToCppT::NativeType>(); | 86 | | | 87 | 2 | auto from_max_int_digit_count = from_precision - from_scale; | 88 | 2 | auto to_max_int_digit_count = to_precision - to_scale; | 89 | 2 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 90 | 2 | bool multiply_may_overflow = false; | 91 | 2 | if (to_scale > from_scale) { | 92 | 2 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 93 | 2 | } | 94 | 2 | return std::visit( | 95 | 2 | [&](auto multiply_may_overflow, auto narrow_integral) { | 96 | 2 | return _from_int<FromCppT, ToCppT, multiply_may_overflow, narrow_integral>( | 97 | 2 | from, to, to_precision, to_scale, scale_multiplier, min_result, | 98 | 2 | max_result, params); | 99 | 2 | }, | 100 | 2 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral)); | 101 | 2 | } |
_ZN5doris13CastToDecimal8from_intIlNS_7DecimalIiEElQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRNS_14CastParametersE Line | Count | Source | 76 | 2 | UInt32 to_scale, CastParameters& params) { | 77 | 2 | MaxNativeType scale_multiplier = | 78 | 2 | DataTypeDecimal<ToCppT::PType>::get_scale_multiplier(to_scale); | 79 | 2 | typename ToCppT::NativeType max_result = | 80 | 2 | DataTypeDecimal<ToCppT::PType>::get_max_digits_number(to_precision); | 81 | 2 | typename ToCppT::NativeType min_result = -max_result; | 82 | | | 83 | 2 | UInt32 from_precision = NumberTraits::max_ascii_len<FromCppT>(); | 84 | 2 | constexpr UInt32 from_scale = 0; | 85 | 2 | constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToCppT::NativeType>(); | 86 | | | 87 | 2 | auto from_max_int_digit_count = from_precision - from_scale; | 88 | 2 | auto to_max_int_digit_count = to_precision - to_scale; | 89 | 2 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 90 | 2 | bool multiply_may_overflow = false; | 91 | 2 | if (to_scale > from_scale) { | 92 | 2 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 93 | 2 | } | 94 | 2 | return std::visit( | 95 | 2 | [&](auto multiply_may_overflow, auto narrow_integral) { | 96 | 2 | return _from_int<FromCppT, ToCppT, multiply_may_overflow, narrow_integral>( | 97 | 2 | from, to, to_precision, to_scale, scale_multiplier, min_result, | 98 | 2 | max_result, params); | 99 | 2 | }, | 100 | 2 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral)); | 101 | 2 | } |
_ZN5doris13CastToDecimal8from_intInNS_7DecimalIiEEnQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRNS_14CastParametersE Line | Count | Source | 76 | 2 | UInt32 to_scale, CastParameters& params) { | 77 | 2 | MaxNativeType scale_multiplier = | 78 | 2 | DataTypeDecimal<ToCppT::PType>::get_scale_multiplier(to_scale); | 79 | 2 | typename ToCppT::NativeType max_result = | 80 | 2 | DataTypeDecimal<ToCppT::PType>::get_max_digits_number(to_precision); | 81 | 2 | typename ToCppT::NativeType min_result = -max_result; | 82 | | | 83 | 2 | UInt32 from_precision = NumberTraits::max_ascii_len<FromCppT>(); | 84 | 2 | constexpr UInt32 from_scale = 0; | 85 | 2 | constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToCppT::NativeType>(); | 86 | | | 87 | 2 | auto from_max_int_digit_count = from_precision - from_scale; | 88 | 2 | auto to_max_int_digit_count = to_precision - to_scale; | 89 | 2 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 90 | 2 | bool multiply_may_overflow = false; | 91 | 2 | if (to_scale > from_scale) { | 92 | 2 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 93 | 2 | } | 94 | 2 | return std::visit( | 95 | 2 | [&](auto multiply_may_overflow, auto narrow_integral) { | 96 | 2 | return _from_int<FromCppT, ToCppT, multiply_may_overflow, narrow_integral>( | 97 | 2 | from, to, to_precision, to_scale, scale_multiplier, min_result, | 98 | 2 | max_result, params); | 99 | 2 | }, | 100 | 2 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral)); | 101 | 2 | } |
Unexecuted instantiation: _ZN5doris13CastToDecimal8from_intIhNS_7DecimalIlEElQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal8from_intIaNS_7DecimalIlEElQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal8from_intIsNS_7DecimalIlEElQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal8from_intIiNS_7DecimalIlEElQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal8from_intIlNS_7DecimalIlEElQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal8from_intInNS_7DecimalIlEEnQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal8from_intIhNS_12Decimal128V3EnQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal8from_intIaNS_12Decimal128V3EnQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal8from_intIsNS_12Decimal128V3EnQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal8from_intIiNS_12Decimal128V3EnQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal8from_intIlNS_12Decimal128V3EnQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal8from_intInNS_12Decimal128V3EnQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal8from_intIhNS_7DecimalIN4wide7integerILm256EiEEEES5_Qaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS8_hEEEbRKS8_RS7_jjRNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal8from_intIaNS_7DecimalIN4wide7integerILm256EiEEEES5_Qaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS8_hEEEbRKS8_RS7_jjRNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal8from_intIsNS_7DecimalIN4wide7integerILm256EiEEEES5_Qaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS8_hEEEbRKS8_RS7_jjRNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal8from_intIiNS_7DecimalIN4wide7integerILm256EiEEEES5_Qaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS8_hEEEbRKS8_RS7_jjRNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal8from_intIlNS_7DecimalIN4wide7integerILm256EiEEEES5_Qaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS8_hEEEbRKS8_RS7_jjRNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal8from_intInNS_7DecimalIN4wide7integerILm256EiEEEES5_Qaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS8_hEEEbRKS8_RS7_jjRNS_14CastParametersE |
102 | | |
103 | | // cast bool to decimal |
104 | | template <typename FromCppT, typename ToCppT, |
105 | | typename MaxNativeType = |
106 | | std::conditional_t<(sizeof(FromCppT) > sizeof(typename ToCppT::NativeType)), |
107 | | FromCppT, typename ToCppT::NativeType>> |
108 | | requires(IsDecimalNumber<ToCppT> && std::is_same_v<FromCppT, UInt8>) |
109 | | static inline bool from_bool(const FromCppT& from, ToCppT& to, UInt32 to_precision, |
110 | 4 | UInt32 to_scale, CastParameters& params) { |
111 | 4 | return from_int<FromCppT, ToCppT, MaxNativeType>(from, to, to_precision, to_scale, params); |
112 | 4 | } _ZN5doris13CastToDecimal9from_boolIhNS_7DecimalIiEEiQaa15IsDecimalNumberIT0_Esr3stdE9is_same_vIT_hEEEbRKS5_RS4_jjRNS_14CastParametersE Line | Count | Source | 110 | 4 | UInt32 to_scale, CastParameters& params) { | 111 | 4 | return from_int<FromCppT, ToCppT, MaxNativeType>(from, to, to_precision, to_scale, params); | 112 | 4 | } |
Unexecuted instantiation: _ZN5doris13CastToDecimal9from_boolIhNS_7DecimalIlEElQaa15IsDecimalNumberIT0_Esr3stdE9is_same_vIT_hEEEbRKS5_RS4_jjRNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal9from_boolIhNS_12Decimal128V3EnQaa15IsDecimalNumberIT0_Esr3stdE9is_same_vIT_hEEEbRKS4_RS3_jjRNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal9from_boolIhNS_7DecimalIN4wide7integerILm256EiEEEES5_Qaa15IsDecimalNumberIT0_Esr3stdE9is_same_vIT_hEEEbRKS8_RS7_jjRNS_14CastParametersE |
113 | | |
114 | | template <typename FromCppT, typename ToCppT> |
115 | | requires(IsDecimalNumber<ToCppT> && IsCppTypeFloat<FromCppT>) |
116 | | static inline bool from_float(const FromCppT& from, ToCppT& to, UInt32 to_precision, |
117 | 4 | UInt32 to_scale, CastParameters& params) { |
118 | 4 | typename ToCppT::NativeType scale_multiplier = |
119 | 4 | DataTypeDecimal<ToCppT::PType>::get_scale_multiplier(to_scale); |
120 | 4 | typename ToCppT::NativeType max_result = |
121 | 4 | DataTypeDecimal<ToCppT::PType>::get_max_digits_number(to_precision); |
122 | 4 | typename ToCppT::NativeType min_result = -max_result; |
123 | | |
124 | 4 | return _from_float<FromCppT, ToCppT>(from, to, to_precision, to_scale, scale_multiplier, |
125 | 4 | min_result, max_result, params); |
126 | 4 | } _ZN5doris13CastToDecimal10from_floatIdNS_7DecimalIiEEQaa15IsDecimalNumberIT0_E14IsCppTypeFloatIT_EEEbRKS5_RS4_jjRNS_14CastParametersE Line | Count | Source | 117 | 2 | UInt32 to_scale, CastParameters& params) { | 118 | 2 | typename ToCppT::NativeType scale_multiplier = | 119 | 2 | DataTypeDecimal<ToCppT::PType>::get_scale_multiplier(to_scale); | 120 | 2 | typename ToCppT::NativeType max_result = | 121 | 2 | DataTypeDecimal<ToCppT::PType>::get_max_digits_number(to_precision); | 122 | 2 | typename ToCppT::NativeType min_result = -max_result; | 123 | | | 124 | 2 | return _from_float<FromCppT, ToCppT>(from, to, to_precision, to_scale, scale_multiplier, | 125 | 2 | min_result, max_result, params); | 126 | 2 | } |
_ZN5doris13CastToDecimal10from_floatIfNS_7DecimalIiEEQaa15IsDecimalNumberIT0_E14IsCppTypeFloatIT_EEEbRKS5_RS4_jjRNS_14CastParametersE Line | Count | Source | 117 | 2 | UInt32 to_scale, CastParameters& params) { | 118 | 2 | typename ToCppT::NativeType scale_multiplier = | 119 | 2 | DataTypeDecimal<ToCppT::PType>::get_scale_multiplier(to_scale); | 120 | 2 | typename ToCppT::NativeType max_result = | 121 | 2 | DataTypeDecimal<ToCppT::PType>::get_max_digits_number(to_precision); | 122 | 2 | typename ToCppT::NativeType min_result = -max_result; | 123 | | | 124 | 2 | return _from_float<FromCppT, ToCppT>(from, to, to_precision, to_scale, scale_multiplier, | 125 | 2 | min_result, max_result, params); | 126 | 2 | } |
Unexecuted instantiation: _ZN5doris13CastToDecimal10from_floatIdNS_7DecimalIlEEQaa15IsDecimalNumberIT0_E14IsCppTypeFloatIT_EEEbRKS5_RS4_jjRNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal10from_floatIfNS_7DecimalIlEEQaa15IsDecimalNumberIT0_E14IsCppTypeFloatIT_EEEbRKS5_RS4_jjRNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal10from_floatIdNS_12Decimal128V3EQaa15IsDecimalNumberIT0_E14IsCppTypeFloatIT_EEEbRKS4_RS3_jjRNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal10from_floatIfNS_12Decimal128V3EQaa15IsDecimalNumberIT0_E14IsCppTypeFloatIT_EEEbRKS4_RS3_jjRNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal10from_floatIdNS_7DecimalIN4wide7integerILm256EiEEEEQaa15IsDecimalNumberIT0_E14IsCppTypeFloatIT_EEEbRKS8_RS7_jjRNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal10from_floatIfNS_7DecimalIN4wide7integerILm256EiEEEEQaa15IsDecimalNumberIT0_E14IsCppTypeFloatIT_EEEbRKS8_RS7_jjRNS_14CastParametersE |
127 | | |
128 | | template <typename FromCppT, typename ToCppT> |
129 | | requires(IsDecimalNumber<ToCppT> && IsCppTypeFloat<FromCppT> && !IsDecimal128V2<ToCppT>) |
130 | | static inline bool _from_float(const FromCppT& from, ToCppT& to, UInt32 to_precision, |
131 | | UInt32 to_scale, |
132 | | const typename ToCppT::NativeType& scale_multiplier, |
133 | | const typename ToCppT::NativeType& min_result, |
134 | | const typename ToCppT::NativeType& max_result, |
135 | 6.70k | CastParameters& params) { |
136 | 6.70k | if (!std::isfinite(from)) { |
137 | 392 | params.status = Status(ErrorCode::ARITHMETIC_OVERFLOW_ERRROR, |
138 | 392 | "Decimal convert overflow. Cannot convert infinity or NaN " |
139 | 392 | "to decimal"); |
140 | 392 | return false; |
141 | 392 | } |
142 | | // For decimal256, we need to use long double to avoid overflow when |
143 | | // static casting the multiplier to floating type, and also to be as precise as possible; |
144 | | // For other decimal types, we use double to be as precise as possible. |
145 | 6.31k | using DoubleType = std::conditional_t<IsDecimal256<ToCppT>, long double, double>; |
146 | 6.31k | DoubleType tmp = from * static_cast<DoubleType>(scale_multiplier); |
147 | 6.31k | if (tmp <= DoubleType(min_result) || tmp >= DoubleType(max_result)) { |
148 | 184 | if (params.is_strict) { |
149 | 92 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, "float/double", to_precision, |
150 | 92 | to_scale); |
151 | 92 | } |
152 | 184 | return false; |
153 | 184 | } |
154 | 6.13k | to.value = static_cast<typename ToCppT::NativeType>(static_cast<double>( |
155 | 6.13k | from * static_cast<DoubleType>(scale_multiplier) + ((from >= 0) ? 0.5 : -0.5))); |
156 | 6.13k | return true; |
157 | 6.31k | } _ZN5doris13CastToDecimal11_from_floatIdNS_7DecimalIiEEQaaaa15IsDecimalNumberIT0_E14IsCppTypeFloatIT_Ent14IsDecimal128V2IS4_EEEbRKS5_RS4_jjRKNS4_10NativeTypeESB_SB_RNS_14CastParametersE Line | Count | Source | 135 | 882 | CastParameters& params) { | 136 | 882 | if (!std::isfinite(from)) { | 137 | 48 | params.status = Status(ErrorCode::ARITHMETIC_OVERFLOW_ERRROR, | 138 | 48 | "Decimal convert overflow. Cannot convert infinity or NaN " | 139 | 48 | "to decimal"); | 140 | 48 | return false; | 141 | 48 | } | 142 | | // For decimal256, we need to use long double to avoid overflow when | 143 | | // static casting the multiplier to floating type, and also to be as precise as possible; | 144 | | // For other decimal types, we use double to be as precise as possible. | 145 | 834 | using DoubleType = std::conditional_t<IsDecimal256<ToCppT>, long double, double>; | 146 | 834 | DoubleType tmp = from * static_cast<DoubleType>(scale_multiplier); | 147 | 834 | if (tmp <= DoubleType(min_result) || tmp >= DoubleType(max_result)) { | 148 | 24 | if (params.is_strict) { | 149 | 12 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, "float/double", to_precision, | 150 | 12 | to_scale); | 151 | 12 | } | 152 | 24 | return false; | 153 | 24 | } | 154 | 810 | to.value = static_cast<typename ToCppT::NativeType>(static_cast<double>( | 155 | 810 | from * static_cast<DoubleType>(scale_multiplier) + ((from >= 0) ? 0.5 : -0.5))); | 156 | 810 | return true; | 157 | 834 | } |
_ZN5doris13CastToDecimal11_from_floatIfNS_7DecimalIiEEQaaaa15IsDecimalNumberIT0_E14IsCppTypeFloatIT_Ent14IsDecimal128V2IS4_EEEbRKS5_RS4_jjRKNS4_10NativeTypeESB_SB_RNS_14CastParametersE Line | Count | Source | 135 | 858 | CastParameters& params) { | 136 | 858 | if (!std::isfinite(from)) { | 137 | 48 | params.status = Status(ErrorCode::ARITHMETIC_OVERFLOW_ERRROR, | 138 | 48 | "Decimal convert overflow. Cannot convert infinity or NaN " | 139 | 48 | "to decimal"); | 140 | 48 | return false; | 141 | 48 | } | 142 | | // For decimal256, we need to use long double to avoid overflow when | 143 | | // static casting the multiplier to floating type, and also to be as precise as possible; | 144 | | // For other decimal types, we use double to be as precise as possible. | 145 | 810 | using DoubleType = std::conditional_t<IsDecimal256<ToCppT>, long double, double>; | 146 | 810 | DoubleType tmp = from * static_cast<DoubleType>(scale_multiplier); | 147 | 810 | if (tmp <= DoubleType(min_result) || tmp >= DoubleType(max_result)) { | 148 | 24 | if (params.is_strict) { | 149 | 12 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, "float/double", to_precision, | 150 | 12 | to_scale); | 151 | 12 | } | 152 | 24 | return false; | 153 | 24 | } | 154 | 786 | to.value = static_cast<typename ToCppT::NativeType>(static_cast<double>( | 155 | 786 | from * static_cast<DoubleType>(scale_multiplier) + ((from >= 0) ? 0.5 : -0.5))); | 156 | 786 | return true; | 157 | 810 | } |
_ZN5doris13CastToDecimal11_from_floatIdNS_7DecimalIlEEQaaaa15IsDecimalNumberIT0_E14IsCppTypeFloatIT_Ent14IsDecimal128V2IS4_EEEbRKS5_RS4_jjRKNS4_10NativeTypeESB_SB_RNS_14CastParametersE Line | Count | Source | 135 | 856 | CastParameters& params) { | 136 | 856 | if (!std::isfinite(from)) { | 137 | 48 | params.status = Status(ErrorCode::ARITHMETIC_OVERFLOW_ERRROR, | 138 | 48 | "Decimal convert overflow. Cannot convert infinity or NaN " | 139 | 48 | "to decimal"); | 140 | 48 | return false; | 141 | 48 | } | 142 | | // For decimal256, we need to use long double to avoid overflow when | 143 | | // static casting the multiplier to floating type, and also to be as precise as possible; | 144 | | // For other decimal types, we use double to be as precise as possible. | 145 | 808 | using DoubleType = std::conditional_t<IsDecimal256<ToCppT>, long double, double>; | 146 | 808 | DoubleType tmp = from * static_cast<DoubleType>(scale_multiplier); | 147 | 808 | if (tmp <= DoubleType(min_result) || tmp >= DoubleType(max_result)) { | 148 | 24 | if (params.is_strict) { | 149 | 12 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, "float/double", to_precision, | 150 | 12 | to_scale); | 151 | 12 | } | 152 | 24 | return false; | 153 | 24 | } | 154 | 784 | to.value = static_cast<typename ToCppT::NativeType>(static_cast<double>( | 155 | 784 | from * static_cast<DoubleType>(scale_multiplier) + ((from >= 0) ? 0.5 : -0.5))); | 156 | 784 | return true; | 157 | 808 | } |
_ZN5doris13CastToDecimal11_from_floatIfNS_7DecimalIlEEQaaaa15IsDecimalNumberIT0_E14IsCppTypeFloatIT_Ent14IsDecimal128V2IS4_EEEbRKS5_RS4_jjRKNS4_10NativeTypeESB_SB_RNS_14CastParametersE Line | Count | Source | 135 | 760 | CastParameters& params) { | 136 | 760 | if (!std::isfinite(from)) { | 137 | 48 | params.status = Status(ErrorCode::ARITHMETIC_OVERFLOW_ERRROR, | 138 | 48 | "Decimal convert overflow. Cannot convert infinity or NaN " | 139 | 48 | "to decimal"); | 140 | 48 | return false; | 141 | 48 | } | 142 | | // For decimal256, we need to use long double to avoid overflow when | 143 | | // static casting the multiplier to floating type, and also to be as precise as possible; | 144 | | // For other decimal types, we use double to be as precise as possible. | 145 | 712 | using DoubleType = std::conditional_t<IsDecimal256<ToCppT>, long double, double>; | 146 | 712 | DoubleType tmp = from * static_cast<DoubleType>(scale_multiplier); | 147 | 712 | if (tmp <= DoubleType(min_result) || tmp >= DoubleType(max_result)) { | 148 | 24 | if (params.is_strict) { | 149 | 12 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, "float/double", to_precision, | 150 | 12 | to_scale); | 151 | 12 | } | 152 | 24 | return false; | 153 | 24 | } | 154 | 688 | to.value = static_cast<typename ToCppT::NativeType>(static_cast<double>( | 155 | 688 | from * static_cast<DoubleType>(scale_multiplier) + ((from >= 0) ? 0.5 : -0.5))); | 156 | 688 | return true; | 157 | 712 | } |
_ZN5doris13CastToDecimal11_from_floatIdNS_12Decimal128V3EQaaaa15IsDecimalNumberIT0_E14IsCppTypeFloatIT_Ent14IsDecimal128V2IS3_EEEbRKS4_RS3_jjRKNS3_10NativeTypeESA_SA_RNS_14CastParametersE Line | Count | Source | 135 | 744 | CastParameters& params) { | 136 | 744 | if (!std::isfinite(from)) { | 137 | 48 | params.status = Status(ErrorCode::ARITHMETIC_OVERFLOW_ERRROR, | 138 | 48 | "Decimal convert overflow. Cannot convert infinity or NaN " | 139 | 48 | "to decimal"); | 140 | 48 | return false; | 141 | 48 | } | 142 | | // For decimal256, we need to use long double to avoid overflow when | 143 | | // static casting the multiplier to floating type, and also to be as precise as possible; | 144 | | // For other decimal types, we use double to be as precise as possible. | 145 | 696 | using DoubleType = std::conditional_t<IsDecimal256<ToCppT>, long double, double>; | 146 | 696 | DoubleType tmp = from * static_cast<DoubleType>(scale_multiplier); | 147 | 696 | if (tmp <= DoubleType(min_result) || tmp >= DoubleType(max_result)) { | 148 | 24 | if (params.is_strict) { | 149 | 12 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, "float/double", to_precision, | 150 | 12 | to_scale); | 151 | 12 | } | 152 | 24 | return false; | 153 | 24 | } | 154 | 672 | to.value = static_cast<typename ToCppT::NativeType>(static_cast<double>( | 155 | 672 | from * static_cast<DoubleType>(scale_multiplier) + ((from >= 0) ? 0.5 : -0.5))); | 156 | 672 | return true; | 157 | 696 | } |
_ZN5doris13CastToDecimal11_from_floatIfNS_12Decimal128V3EQaaaa15IsDecimalNumberIT0_E14IsCppTypeFloatIT_Ent14IsDecimal128V2IS3_EEEbRKS4_RS3_jjRKNS3_10NativeTypeESA_SA_RNS_14CastParametersE Line | Count | Source | 135 | 888 | CastParameters& params) { | 136 | 888 | if (!std::isfinite(from)) { | 137 | 48 | params.status = Status(ErrorCode::ARITHMETIC_OVERFLOW_ERRROR, | 138 | 48 | "Decimal convert overflow. Cannot convert infinity or NaN " | 139 | 48 | "to decimal"); | 140 | 48 | return false; | 141 | 48 | } | 142 | | // For decimal256, we need to use long double to avoid overflow when | 143 | | // static casting the multiplier to floating type, and also to be as precise as possible; | 144 | | // For other decimal types, we use double to be as precise as possible. | 145 | 840 | using DoubleType = std::conditional_t<IsDecimal256<ToCppT>, long double, double>; | 146 | 840 | DoubleType tmp = from * static_cast<DoubleType>(scale_multiplier); | 147 | 840 | if (tmp <= DoubleType(min_result) || tmp >= DoubleType(max_result)) { | 148 | 24 | if (params.is_strict) { | 149 | 12 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, "float/double", to_precision, | 150 | 12 | to_scale); | 151 | 12 | } | 152 | 24 | return false; | 153 | 24 | } | 154 | 816 | to.value = static_cast<typename ToCppT::NativeType>(static_cast<double>( | 155 | 816 | from * static_cast<DoubleType>(scale_multiplier) + ((from >= 0) ? 0.5 : -0.5))); | 156 | 816 | return true; | 157 | 840 | } |
_ZN5doris13CastToDecimal11_from_floatIdNS_7DecimalIN4wide7integerILm256EiEEEEQaaaa15IsDecimalNumberIT0_E14IsCppTypeFloatIT_Ent14IsDecimal128V2IS7_EEEbRKS8_RS7_jjRKNS7_10NativeTypeESE_SE_RNS_14CastParametersE Line | Count | Source | 135 | 872 | CastParameters& params) { | 136 | 872 | if (!std::isfinite(from)) { | 137 | 48 | params.status = Status(ErrorCode::ARITHMETIC_OVERFLOW_ERRROR, | 138 | 48 | "Decimal convert overflow. Cannot convert infinity or NaN " | 139 | 48 | "to decimal"); | 140 | 48 | return false; | 141 | 48 | } | 142 | | // For decimal256, we need to use long double to avoid overflow when | 143 | | // static casting the multiplier to floating type, and also to be as precise as possible; | 144 | | // For other decimal types, we use double to be as precise as possible. | 145 | 824 | using DoubleType = std::conditional_t<IsDecimal256<ToCppT>, long double, double>; | 146 | 824 | DoubleType tmp = from * static_cast<DoubleType>(scale_multiplier); | 147 | 824 | if (tmp <= DoubleType(min_result) || tmp >= DoubleType(max_result)) { | 148 | 24 | if (params.is_strict) { | 149 | 12 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, "float/double", to_precision, | 150 | 12 | to_scale); | 151 | 12 | } | 152 | 24 | return false; | 153 | 24 | } | 154 | 800 | to.value = static_cast<typename ToCppT::NativeType>(static_cast<double>( | 155 | 800 | from * static_cast<DoubleType>(scale_multiplier) + ((from >= 0) ? 0.5 : -0.5))); | 156 | 800 | return true; | 157 | 824 | } |
_ZN5doris13CastToDecimal11_from_floatIfNS_7DecimalIN4wide7integerILm256EiEEEEQaaaa15IsDecimalNumberIT0_E14IsCppTypeFloatIT_Ent14IsDecimal128V2IS7_EEEbRKS8_RS7_jjRKNS7_10NativeTypeESE_SE_RNS_14CastParametersE Line | Count | Source | 135 | 848 | CastParameters& params) { | 136 | 848 | if (!std::isfinite(from)) { | 137 | 56 | params.status = Status(ErrorCode::ARITHMETIC_OVERFLOW_ERRROR, | 138 | 56 | "Decimal convert overflow. Cannot convert infinity or NaN " | 139 | 56 | "to decimal"); | 140 | 56 | return false; | 141 | 56 | } | 142 | | // For decimal256, we need to use long double to avoid overflow when | 143 | | // static casting the multiplier to floating type, and also to be as precise as possible; | 144 | | // For other decimal types, we use double to be as precise as possible. | 145 | 792 | using DoubleType = std::conditional_t<IsDecimal256<ToCppT>, long double, double>; | 146 | 792 | DoubleType tmp = from * static_cast<DoubleType>(scale_multiplier); | 147 | 792 | if (tmp <= DoubleType(min_result) || tmp >= DoubleType(max_result)) { | 148 | 16 | if (params.is_strict) { | 149 | 8 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, "float/double", to_precision, | 150 | 8 | to_scale); | 151 | 8 | } | 152 | 16 | return false; | 153 | 16 | } | 154 | 776 | to.value = static_cast<typename ToCppT::NativeType>(static_cast<double>( | 155 | 776 | from * static_cast<DoubleType>(scale_multiplier) + ((from >= 0) ? 0.5 : -0.5))); | 156 | 776 | return true; | 157 | 792 | } |
|
158 | | template <typename FromCppT, typename ToCppT> |
159 | | requires(IsDecimal128V2<ToCppT> && IsCppTypeFloat<FromCppT>) |
160 | | static inline bool _from_float(const FromCppT& from, ToCppT& to, UInt32 to_precision, |
161 | | UInt32 to_scale, |
162 | | const typename ToCppT::NativeType& scale_multiplier, |
163 | | const typename ToCppT::NativeType& min_result, |
164 | | const typename ToCppT::NativeType& max_result, |
165 | 0 | CastParameters& params) { |
166 | 0 | if (!std::isfinite(from)) { |
167 | 0 | params.status = Status(ErrorCode::ARITHMETIC_OVERFLOW_ERRROR, |
168 | 0 | "Decimal convert overflow. Cannot convert infinity or NaN " |
169 | 0 | "to decimal"); |
170 | 0 | return false; |
171 | 0 | } |
172 | | // For decimal256, we need to use long double to avoid overflow when |
173 | | // static casting the multiplier to floating type, and also to be as precise as possible; |
174 | | // For other decimal types, we use double to be as precise as possible. |
175 | 0 | using DoubleType = std::conditional_t<IsDecimal256<ToCppT>, long double, double>; |
176 | 0 | DoubleType tmp = from * static_cast<DoubleType>(scale_multiplier); |
177 | 0 | if (tmp <= DoubleType(min_result) || tmp >= DoubleType(max_result)) { |
178 | 0 | if (params.is_strict) { |
179 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, "float/double", to_precision, |
180 | 0 | to_scale); |
181 | 0 | } |
182 | 0 | return false; |
183 | 0 | } |
184 | 0 | to = DecimalV2Value(static_cast<typename ToCppT::NativeType>(static_cast<double>( |
185 | 0 | from * static_cast<DoubleType>(scale_multiplier) + ((from >= 0) ? 0.5 : -0.5)))); |
186 | 0 | return true; |
187 | 0 | } Unexecuted instantiation: _ZN5doris13CastToDecimal11_from_floatIfNS_14DecimalV2ValueEQaa14IsDecimal128V2IT0_E14IsCppTypeFloatIT_EEEbRKS4_RS3_jjRKNS3_10NativeTypeESA_SA_RNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal11_from_floatIdNS_14DecimalV2ValueEQaa14IsDecimal128V2IT0_E14IsCppTypeFloatIT_EEEbRKS4_RS3_jjRKNS3_10NativeTypeESA_SA_RNS_14CastParametersE |
188 | | |
189 | | template <typename FromCppT, typename ToCppT, |
190 | | typename MaxFieldType = std::conditional_t< |
191 | | (sizeof(FromCppT) == sizeof(ToCppT)) && |
192 | | (std::is_same_v<ToCppT, Decimal128V3> || |
193 | | std::is_same_v<FromCppT, Decimal128V3>), |
194 | | Decimal128V3, |
195 | | std::conditional_t<(sizeof(FromCppT) > sizeof(ToCppT)), FromCppT, ToCppT>>> |
196 | | requires(IsDecimalNumber<ToCppT> && IsDecimalNumber<FromCppT>) |
197 | | static inline bool from_decimalv2(const FromCppT& from, const UInt32 from_precision, |
198 | | const UInt32 from_scale, UInt32 from_original_precision, |
199 | | UInt32 from_original_scale, ToCppT& to, UInt32 to_precision, |
200 | | UInt32 to_scale, CastParameters& params) { |
201 | | using MaxNativeType = typename MaxFieldType::NativeType; |
202 | | |
203 | | auto from_max_int_digit_count = from_original_precision - from_original_scale; |
204 | | auto to_max_int_digit_count = to_precision - to_scale; |
205 | | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count) || |
206 | | (to_max_int_digit_count == from_max_int_digit_count && |
207 | | to_scale < from_original_scale); |
208 | | |
209 | | constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToCppT::NativeType>(); |
210 | | bool multiply_may_overflow = false; |
211 | | if (to_scale > from_scale) { |
212 | | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; |
213 | | } |
214 | | |
215 | | typename ToCppT::NativeType max_result = |
216 | | DataTypeDecimal<ToCppT::PType>::get_max_digits_number(to_precision); |
217 | | typename ToCppT::NativeType min_result = -max_result; |
218 | | |
219 | | return std::visit( |
220 | | [&](auto multiply_may_overflow, auto narrow_integral) { |
221 | | if (from_scale < to_scale) { |
222 | | MaxNativeType multiplier = |
223 | | DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier( |
224 | | to_scale - from_scale); |
225 | | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, |
226 | | narrow_integral>( |
227 | | from, from_precision, from_scale, to, to_precision, to_scale, |
228 | | multiplier, min_result, max_result, params); |
229 | | } else if (from_scale == to_scale) { |
230 | | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, |
231 | | narrow_integral>( |
232 | | from, from_precision, from_scale, to, to_precision, to_scale, |
233 | | min_result, max_result, params); |
234 | | } else { |
235 | | MaxNativeType multiplier = |
236 | | DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier( |
237 | | from_scale - to_scale); |
238 | | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, |
239 | | narrow_integral>( |
240 | | from, from_precision, from_scale, to, to_precision, to_scale, |
241 | | multiplier, min_result, max_result, params); |
242 | | } |
243 | | return true; |
244 | | }, |
245 | | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral)); |
246 | | } |
247 | | |
248 | | template <typename FromCppT, typename ToCppT, |
249 | | typename MaxFieldType = std::conditional_t< |
250 | | (sizeof(FromCppT) == sizeof(ToCppT)) && |
251 | | (std::is_same_v<ToCppT, Decimal128V3> || |
252 | | std::is_same_v<FromCppT, Decimal128V3>), |
253 | | Decimal128V3, |
254 | | std::conditional_t<(sizeof(FromCppT) > sizeof(ToCppT)), FromCppT, ToCppT>>> |
255 | | requires(IsDecimalNumber<ToCppT> && IsDecimalNumber<FromCppT>) |
256 | | static inline bool from_decimalv3(const FromCppT& from, const UInt32 from_precision, |
257 | | const UInt32 from_scale, ToCppT& to, UInt32 to_precision, |
258 | 10 | UInt32 to_scale, CastParameters& params) { |
259 | 10 | using MaxNativeType = typename MaxFieldType::NativeType; |
260 | | |
261 | 10 | auto from_max_int_digit_count = from_precision - from_scale; |
262 | 10 | auto to_max_int_digit_count = to_precision - to_scale; |
263 | 10 | bool narrow_integral = |
264 | 10 | (to_max_int_digit_count < from_max_int_digit_count) || |
265 | 10 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); |
266 | | |
267 | 10 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToCppT::NativeType>(); |
268 | 10 | bool multiply_may_overflow = false; |
269 | 10 | if (to_scale > from_scale) { |
270 | 0 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; |
271 | 0 | } |
272 | | |
273 | 10 | typename ToCppT::NativeType max_result = |
274 | 10 | DataTypeDecimal<ToCppT::PType>::get_max_digits_number(to_precision); |
275 | 10 | typename ToCppT::NativeType min_result = -max_result; |
276 | | |
277 | 10 | MaxNativeType multiplier {}; |
278 | 10 | if (from_scale < to_scale) { |
279 | 0 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - |
280 | 0 | from_scale); |
281 | 10 | } else if (from_scale > to_scale) { |
282 | 6 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - |
283 | 6 | to_scale); |
284 | 6 | } |
285 | | |
286 | 10 | return std::visit( |
287 | 10 | [&](auto multiply_may_overflow, auto narrow_integral) { |
288 | 10 | return _from_decimal<FromCppT, ToCppT, multiply_may_overflow, narrow_integral>( |
289 | 10 | from, from_precision, from_scale, to, to_precision, to_scale, |
290 | 10 | min_result, max_result, multiplier, params); |
291 | 10 | }, _ZZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIiEES3_S3_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRNS_14CastParametersEENKUlS5_S4_E_clISt17integral_constantIbLb0EESE_EEDaS5_S4_ Line | Count | Source | 287 | 2 | [&](auto multiply_may_overflow, auto narrow_integral) { | 288 | 2 | return _from_decimal<FromCppT, ToCppT, multiply_may_overflow, narrow_integral>( | 289 | 2 | from, from_precision, from_scale, to, to_precision, to_scale, | 290 | 2 | min_result, max_result, multiplier, params); | 291 | 2 | }, |
Unexecuted instantiation: _ZZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIiEES3_S3_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRNS_14CastParametersEENKUlS5_S4_E_clISt17integral_constantIbLb0EESD_IbLb1EEEEDaS5_S4_ Unexecuted instantiation: _ZZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIiEES3_S3_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRNS_14CastParametersEENKUlS5_S4_E_clISt17integral_constantIbLb1EESD_IbLb0EEEEDaS5_S4_ Unexecuted instantiation: _ZZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIiEES3_S3_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRNS_14CastParametersEENKUlS5_S4_E_clISt17integral_constantIbLb1EESE_EEDaS5_S4_ Unexecuted instantiation: _ZZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIlEENS2_IiEES3_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRNS_14CastParametersEENKUlS6_S5_E_clISt17integral_constantIbLb0EESF_EEDaS6_S5_ _ZZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIlEENS2_IiEES3_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRNS_14CastParametersEENKUlS6_S5_E_clISt17integral_constantIbLb0EESE_IbLb1EEEEDaS6_S5_ Line | Count | Source | 287 | 2 | [&](auto multiply_may_overflow, auto narrow_integral) { | 288 | 2 | return _from_decimal<FromCppT, ToCppT, multiply_may_overflow, narrow_integral>( | 289 | 2 | from, from_precision, from_scale, to, to_precision, to_scale, | 290 | 2 | min_result, max_result, multiplier, params); | 291 | 2 | }, |
Unexecuted instantiation: _ZZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIlEENS2_IiEES3_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRNS_14CastParametersEENKUlS6_S5_E_clISt17integral_constantIbLb1EESE_IbLb0EEEEDaS6_S5_ Unexecuted instantiation: _ZZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIlEENS2_IiEES3_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRNS_14CastParametersEENKUlS6_S5_E_clISt17integral_constantIbLb1EESF_EEDaS6_S5_ Unexecuted instantiation: _ZZN5doris13CastToDecimal14from_decimalv3INS_12Decimal128V3ENS_7DecimalIiEES2_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRNS_14CastParametersEENKUlS6_S5_E_clISt17integral_constantIbLb0EESF_EEDaS6_S5_ _ZZN5doris13CastToDecimal14from_decimalv3INS_12Decimal128V3ENS_7DecimalIiEES2_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRNS_14CastParametersEENKUlS6_S5_E_clISt17integral_constantIbLb0EESE_IbLb1EEEEDaS6_S5_ Line | Count | Source | 287 | 2 | [&](auto multiply_may_overflow, auto narrow_integral) { | 288 | 2 | return _from_decimal<FromCppT, ToCppT, multiply_may_overflow, narrow_integral>( | 289 | 2 | from, from_precision, from_scale, to, to_precision, to_scale, | 290 | 2 | min_result, max_result, multiplier, params); | 291 | 2 | }, |
Unexecuted instantiation: _ZZN5doris13CastToDecimal14from_decimalv3INS_12Decimal128V3ENS_7DecimalIiEES2_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRNS_14CastParametersEENKUlS6_S5_E_clISt17integral_constantIbLb1EESE_IbLb0EEEEDaS6_S5_ Unexecuted instantiation: _ZZN5doris13CastToDecimal14from_decimalv3INS_12Decimal128V3ENS_7DecimalIiEES2_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRNS_14CastParametersEENKUlS6_S5_E_clISt17integral_constantIbLb1EESF_EEDaS6_S5_ Unexecuted instantiation: _ZZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIN4wide7integerILm256EiEEEENS2_IiEES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRNS_14CastParametersEENKUlS9_S8_E_clISt17integral_constantIbLb0EESI_EEDaS9_S8_ _ZZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIN4wide7integerILm256EiEEEENS2_IiEES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRNS_14CastParametersEENKUlS9_S8_E_clISt17integral_constantIbLb0EESH_IbLb1EEEEDaS9_S8_ Line | Count | Source | 287 | 2 | [&](auto multiply_may_overflow, auto narrow_integral) { | 288 | 2 | return _from_decimal<FromCppT, ToCppT, multiply_may_overflow, narrow_integral>( | 289 | 2 | from, from_precision, from_scale, to, to_precision, to_scale, | 290 | 2 | min_result, max_result, multiplier, params); | 291 | 2 | }, |
Unexecuted instantiation: _ZZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIN4wide7integerILm256EiEEEENS2_IiEES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRNS_14CastParametersEENKUlS9_S8_E_clISt17integral_constantIbLb1EESH_IbLb0EEEEDaS9_S8_ Unexecuted instantiation: _ZZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIN4wide7integerILm256EiEEEENS2_IiEES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRNS_14CastParametersEENKUlS9_S8_E_clISt17integral_constantIbLb1EESI_EEDaS9_S8_ Unexecuted instantiation: _ZZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIiEENS2_IlEES4_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRNS_14CastParametersEENKUlS6_S5_E_clISt17integral_constantIbLb0EESF_EEDaS6_S5_ Unexecuted instantiation: _ZZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIiEENS2_IlEES4_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRNS_14CastParametersEENKUlS6_S5_E_clISt17integral_constantIbLb0EESE_IbLb1EEEEDaS6_S5_ Unexecuted instantiation: _ZZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIiEENS2_IlEES4_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRNS_14CastParametersEENKUlS6_S5_E_clISt17integral_constantIbLb1EESE_IbLb0EEEEDaS6_S5_ Unexecuted instantiation: _ZZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIiEENS2_IlEES4_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRNS_14CastParametersEENKUlS6_S5_E_clISt17integral_constantIbLb1EESF_EEDaS6_S5_ Unexecuted instantiation: _ZZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIlEES3_S3_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRNS_14CastParametersEENKUlS5_S4_E_clISt17integral_constantIbLb0EESE_EEDaS5_S4_ Unexecuted instantiation: _ZZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIlEES3_S3_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRNS_14CastParametersEENKUlS5_S4_E_clISt17integral_constantIbLb0EESD_IbLb1EEEEDaS5_S4_ Unexecuted instantiation: _ZZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIlEES3_S3_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRNS_14CastParametersEENKUlS5_S4_E_clISt17integral_constantIbLb1EESD_IbLb0EEEEDaS5_S4_ Unexecuted instantiation: _ZZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIlEES3_S3_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRNS_14CastParametersEENKUlS5_S4_E_clISt17integral_constantIbLb1EESE_EEDaS5_S4_ Unexecuted instantiation: _ZZN5doris13CastToDecimal14from_decimalv3INS_12Decimal128V3ENS_7DecimalIlEES2_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRNS_14CastParametersEENKUlS6_S5_E_clISt17integral_constantIbLb0EESF_EEDaS6_S5_ Unexecuted instantiation: _ZZN5doris13CastToDecimal14from_decimalv3INS_12Decimal128V3ENS_7DecimalIlEES2_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRNS_14CastParametersEENKUlS6_S5_E_clISt17integral_constantIbLb0EESE_IbLb1EEEEDaS6_S5_ Unexecuted instantiation: _ZZN5doris13CastToDecimal14from_decimalv3INS_12Decimal128V3ENS_7DecimalIlEES2_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRNS_14CastParametersEENKUlS6_S5_E_clISt17integral_constantIbLb1EESE_IbLb0EEEEDaS6_S5_ Unexecuted instantiation: _ZZN5doris13CastToDecimal14from_decimalv3INS_12Decimal128V3ENS_7DecimalIlEES2_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRNS_14CastParametersEENKUlS6_S5_E_clISt17integral_constantIbLb1EESF_EEDaS6_S5_ Unexecuted instantiation: _ZZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIN4wide7integerILm256EiEEEENS2_IlEES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRNS_14CastParametersEENKUlS9_S8_E_clISt17integral_constantIbLb0EESI_EEDaS9_S8_ Unexecuted instantiation: _ZZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIN4wide7integerILm256EiEEEENS2_IlEES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRNS_14CastParametersEENKUlS9_S8_E_clISt17integral_constantIbLb0EESH_IbLb1EEEEDaS9_S8_ Unexecuted instantiation: _ZZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIN4wide7integerILm256EiEEEENS2_IlEES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRNS_14CastParametersEENKUlS9_S8_E_clISt17integral_constantIbLb1EESH_IbLb0EEEEDaS9_S8_ Unexecuted instantiation: _ZZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIN4wide7integerILm256EiEEEENS2_IlEES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRNS_14CastParametersEENKUlS9_S8_E_clISt17integral_constantIbLb1EESI_EEDaS9_S8_ Unexecuted instantiation: _ZZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIiEENS_12Decimal128V3ES4_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRNS_14CastParametersEENKUlS6_S5_E_clISt17integral_constantIbLb0EESF_EEDaS6_S5_ Unexecuted instantiation: _ZZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIiEENS_12Decimal128V3ES4_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRNS_14CastParametersEENKUlS6_S5_E_clISt17integral_constantIbLb0EESE_IbLb1EEEEDaS6_S5_ Unexecuted instantiation: _ZZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIiEENS_12Decimal128V3ES4_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRNS_14CastParametersEENKUlS6_S5_E_clISt17integral_constantIbLb1EESE_IbLb0EEEEDaS6_S5_ Unexecuted instantiation: _ZZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIiEENS_12Decimal128V3ES4_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRNS_14CastParametersEENKUlS6_S5_E_clISt17integral_constantIbLb1EESF_EEDaS6_S5_ Unexecuted instantiation: _ZZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIlEENS_12Decimal128V3ES4_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRNS_14CastParametersEENKUlS6_S5_E_clISt17integral_constantIbLb0EESF_EEDaS6_S5_ Unexecuted instantiation: _ZZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIlEENS_12Decimal128V3ES4_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRNS_14CastParametersEENKUlS6_S5_E_clISt17integral_constantIbLb0EESE_IbLb1EEEEDaS6_S5_ Unexecuted instantiation: _ZZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIlEENS_12Decimal128V3ES4_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRNS_14CastParametersEENKUlS6_S5_E_clISt17integral_constantIbLb1EESE_IbLb0EEEEDaS6_S5_ Unexecuted instantiation: _ZZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIlEENS_12Decimal128V3ES4_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRNS_14CastParametersEENKUlS6_S5_E_clISt17integral_constantIbLb1EESF_EEDaS6_S5_ _ZZN5doris13CastToDecimal14from_decimalv3INS_12Decimal128V3ES2_S2_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS4_jjRS3_jjRNS_14CastParametersEENKUlS4_S3_E_clISt17integral_constantIbLb0EESD_EEDaS4_S3_ Line | Count | Source | 287 | 2 | [&](auto multiply_may_overflow, auto narrow_integral) { | 288 | 2 | return _from_decimal<FromCppT, ToCppT, multiply_may_overflow, narrow_integral>( | 289 | 2 | from, from_precision, from_scale, to, to_precision, to_scale, | 290 | 2 | min_result, max_result, multiplier, params); | 291 | 2 | }, |
Unexecuted instantiation: _ZZN5doris13CastToDecimal14from_decimalv3INS_12Decimal128V3ES2_S2_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS4_jjRS3_jjRNS_14CastParametersEENKUlS4_S3_E_clISt17integral_constantIbLb0EESC_IbLb1EEEEDaS4_S3_ Unexecuted instantiation: _ZZN5doris13CastToDecimal14from_decimalv3INS_12Decimal128V3ES2_S2_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS4_jjRS3_jjRNS_14CastParametersEENKUlS4_S3_E_clISt17integral_constantIbLb1EESC_IbLb0EEEEDaS4_S3_ Unexecuted instantiation: _ZZN5doris13CastToDecimal14from_decimalv3INS_12Decimal128V3ES2_S2_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS4_jjRS3_jjRNS_14CastParametersEENKUlS4_S3_E_clISt17integral_constantIbLb1EESD_EEDaS4_S3_ Unexecuted instantiation: _ZZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIN4wide7integerILm256EiEEEENS_12Decimal128V3ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRNS_14CastParametersEENKUlS9_S8_E_clISt17integral_constantIbLb0EESI_EEDaS9_S8_ Unexecuted instantiation: _ZZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIN4wide7integerILm256EiEEEENS_12Decimal128V3ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRNS_14CastParametersEENKUlS9_S8_E_clISt17integral_constantIbLb0EESH_IbLb1EEEEDaS9_S8_ Unexecuted instantiation: _ZZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIN4wide7integerILm256EiEEEENS_12Decimal128V3ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRNS_14CastParametersEENKUlS9_S8_E_clISt17integral_constantIbLb1EESH_IbLb0EEEEDaS9_S8_ Unexecuted instantiation: _ZZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIN4wide7integerILm256EiEEEENS_12Decimal128V3ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRNS_14CastParametersEENKUlS9_S8_E_clISt17integral_constantIbLb1EESI_EEDaS9_S8_ Unexecuted instantiation: _ZZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIiEENS2_IN4wide7integerILm256EiEEEES7_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRNS_14CastParametersEENKUlS9_S8_E_clISt17integral_constantIbLb0EESI_EEDaS9_S8_ Unexecuted instantiation: _ZZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIiEENS2_IN4wide7integerILm256EiEEEES7_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRNS_14CastParametersEENKUlS9_S8_E_clISt17integral_constantIbLb0EESH_IbLb1EEEEDaS9_S8_ Unexecuted instantiation: _ZZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIiEENS2_IN4wide7integerILm256EiEEEES7_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRNS_14CastParametersEENKUlS9_S8_E_clISt17integral_constantIbLb1EESH_IbLb0EEEEDaS9_S8_ Unexecuted instantiation: _ZZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIiEENS2_IN4wide7integerILm256EiEEEES7_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRNS_14CastParametersEENKUlS9_S8_E_clISt17integral_constantIbLb1EESI_EEDaS9_S8_ Unexecuted instantiation: _ZZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIlEENS2_IN4wide7integerILm256EiEEEES7_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRNS_14CastParametersEENKUlS9_S8_E_clISt17integral_constantIbLb0EESI_EEDaS9_S8_ Unexecuted instantiation: _ZZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIlEENS2_IN4wide7integerILm256EiEEEES7_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRNS_14CastParametersEENKUlS9_S8_E_clISt17integral_constantIbLb0EESH_IbLb1EEEEDaS9_S8_ Unexecuted instantiation: _ZZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIlEENS2_IN4wide7integerILm256EiEEEES7_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRNS_14CastParametersEENKUlS9_S8_E_clISt17integral_constantIbLb1EESH_IbLb0EEEEDaS9_S8_ Unexecuted instantiation: _ZZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIlEENS2_IN4wide7integerILm256EiEEEES7_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRNS_14CastParametersEENKUlS9_S8_E_clISt17integral_constantIbLb1EESI_EEDaS9_S8_ Unexecuted instantiation: _ZZN5doris13CastToDecimal14from_decimalv3INS_12Decimal128V3ENS_7DecimalIN4wide7integerILm256EiEEEES7_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRNS_14CastParametersEENKUlS9_S8_E_clISt17integral_constantIbLb0EESI_EEDaS9_S8_ Unexecuted instantiation: _ZZN5doris13CastToDecimal14from_decimalv3INS_12Decimal128V3ENS_7DecimalIN4wide7integerILm256EiEEEES7_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRNS_14CastParametersEENKUlS9_S8_E_clISt17integral_constantIbLb0EESH_IbLb1EEEEDaS9_S8_ Unexecuted instantiation: _ZZN5doris13CastToDecimal14from_decimalv3INS_12Decimal128V3ENS_7DecimalIN4wide7integerILm256EiEEEES7_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRNS_14CastParametersEENKUlS9_S8_E_clISt17integral_constantIbLb1EESH_IbLb0EEEEDaS9_S8_ Unexecuted instantiation: _ZZN5doris13CastToDecimal14from_decimalv3INS_12Decimal128V3ENS_7DecimalIN4wide7integerILm256EiEEEES7_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRNS_14CastParametersEENKUlS9_S8_E_clISt17integral_constantIbLb1EESI_EEDaS9_S8_ Unexecuted instantiation: _ZZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIN4wide7integerILm256EiEEEES6_S6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS8_jjRS7_jjRNS_14CastParametersEENKUlS8_S7_E_clISt17integral_constantIbLb0EESH_EEDaS8_S7_ Unexecuted instantiation: _ZZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIN4wide7integerILm256EiEEEES6_S6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS8_jjRS7_jjRNS_14CastParametersEENKUlS8_S7_E_clISt17integral_constantIbLb0EESG_IbLb1EEEEDaS8_S7_ Unexecuted instantiation: _ZZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIN4wide7integerILm256EiEEEES6_S6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS8_jjRS7_jjRNS_14CastParametersEENKUlS8_S7_E_clISt17integral_constantIbLb1EESG_IbLb0EEEEDaS8_S7_ Unexecuted instantiation: _ZZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIN4wide7integerILm256EiEEEES6_S6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS8_jjRS7_jjRNS_14CastParametersEENKUlS8_S7_E_clISt17integral_constantIbLb1EESH_EEDaS8_S7_ |
292 | 10 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral)); |
293 | 10 | } _ZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIiEES3_S3_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRNS_14CastParametersE Line | Count | Source | 258 | 2 | UInt32 to_scale, CastParameters& params) { | 259 | 2 | using MaxNativeType = typename MaxFieldType::NativeType; | 260 | | | 261 | 2 | auto from_max_int_digit_count = from_precision - from_scale; | 262 | 2 | auto to_max_int_digit_count = to_precision - to_scale; | 263 | 2 | bool narrow_integral = | 264 | 2 | (to_max_int_digit_count < from_max_int_digit_count) || | 265 | 2 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 266 | | | 267 | 2 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToCppT::NativeType>(); | 268 | 2 | bool multiply_may_overflow = false; | 269 | 2 | if (to_scale > from_scale) { | 270 | 0 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 271 | 0 | } | 272 | | | 273 | 2 | typename ToCppT::NativeType max_result = | 274 | 2 | DataTypeDecimal<ToCppT::PType>::get_max_digits_number(to_precision); | 275 | 2 | typename ToCppT::NativeType min_result = -max_result; | 276 | | | 277 | 2 | MaxNativeType multiplier {}; | 278 | 2 | if (from_scale < to_scale) { | 279 | 0 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 280 | 0 | from_scale); | 281 | 2 | } else if (from_scale > to_scale) { | 282 | 0 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 283 | 0 | to_scale); | 284 | 0 | } | 285 | | | 286 | 2 | return std::visit( | 287 | 2 | [&](auto multiply_may_overflow, auto narrow_integral) { | 288 | 2 | return _from_decimal<FromCppT, ToCppT, multiply_may_overflow, narrow_integral>( | 289 | 2 | from, from_precision, from_scale, to, to_precision, to_scale, | 290 | 2 | min_result, max_result, multiplier, params); | 291 | 2 | }, | 292 | 2 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral)); | 293 | 2 | } |
_ZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIlEENS2_IiEES3_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRNS_14CastParametersE Line | Count | Source | 258 | 2 | UInt32 to_scale, CastParameters& params) { | 259 | 2 | using MaxNativeType = typename MaxFieldType::NativeType; | 260 | | | 261 | 2 | auto from_max_int_digit_count = from_precision - from_scale; | 262 | 2 | auto to_max_int_digit_count = to_precision - to_scale; | 263 | 2 | bool narrow_integral = | 264 | 2 | (to_max_int_digit_count < from_max_int_digit_count) || | 265 | 2 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 266 | | | 267 | 2 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToCppT::NativeType>(); | 268 | 2 | bool multiply_may_overflow = false; | 269 | 2 | if (to_scale > from_scale) { | 270 | 0 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 271 | 0 | } | 272 | | | 273 | 2 | typename ToCppT::NativeType max_result = | 274 | 2 | DataTypeDecimal<ToCppT::PType>::get_max_digits_number(to_precision); | 275 | 2 | typename ToCppT::NativeType min_result = -max_result; | 276 | | | 277 | 2 | MaxNativeType multiplier {}; | 278 | 2 | if (from_scale < to_scale) { | 279 | 0 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 280 | 0 | from_scale); | 281 | 2 | } else if (from_scale > to_scale) { | 282 | 2 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 283 | 2 | to_scale); | 284 | 2 | } | 285 | | | 286 | 2 | return std::visit( | 287 | 2 | [&](auto multiply_may_overflow, auto narrow_integral) { | 288 | 2 | return _from_decimal<FromCppT, ToCppT, multiply_may_overflow, narrow_integral>( | 289 | 2 | from, from_precision, from_scale, to, to_precision, to_scale, | 290 | 2 | min_result, max_result, multiplier, params); | 291 | 2 | }, | 292 | 2 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral)); | 293 | 2 | } |
_ZN5doris13CastToDecimal14from_decimalv3INS_12Decimal128V3ENS_7DecimalIiEES2_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRNS_14CastParametersE Line | Count | Source | 258 | 2 | UInt32 to_scale, CastParameters& params) { | 259 | 2 | using MaxNativeType = typename MaxFieldType::NativeType; | 260 | | | 261 | 2 | auto from_max_int_digit_count = from_precision - from_scale; | 262 | 2 | auto to_max_int_digit_count = to_precision - to_scale; | 263 | 2 | bool narrow_integral = | 264 | 2 | (to_max_int_digit_count < from_max_int_digit_count) || | 265 | 2 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 266 | | | 267 | 2 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToCppT::NativeType>(); | 268 | 2 | bool multiply_may_overflow = false; | 269 | 2 | if (to_scale > from_scale) { | 270 | 0 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 271 | 0 | } | 272 | | | 273 | 2 | typename ToCppT::NativeType max_result = | 274 | 2 | DataTypeDecimal<ToCppT::PType>::get_max_digits_number(to_precision); | 275 | 2 | typename ToCppT::NativeType min_result = -max_result; | 276 | | | 277 | 2 | MaxNativeType multiplier {}; | 278 | 2 | if (from_scale < to_scale) { | 279 | 0 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 280 | 0 | from_scale); | 281 | 2 | } else if (from_scale > to_scale) { | 282 | 2 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 283 | 2 | to_scale); | 284 | 2 | } | 285 | | | 286 | 2 | return std::visit( | 287 | 2 | [&](auto multiply_may_overflow, auto narrow_integral) { | 288 | 2 | return _from_decimal<FromCppT, ToCppT, multiply_may_overflow, narrow_integral>( | 289 | 2 | from, from_precision, from_scale, to, to_precision, to_scale, | 290 | 2 | min_result, max_result, multiplier, params); | 291 | 2 | }, | 292 | 2 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral)); | 293 | 2 | } |
_ZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIN4wide7integerILm256EiEEEENS2_IiEES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRNS_14CastParametersE Line | Count | Source | 258 | 2 | UInt32 to_scale, CastParameters& params) { | 259 | 2 | using MaxNativeType = typename MaxFieldType::NativeType; | 260 | | | 261 | 2 | auto from_max_int_digit_count = from_precision - from_scale; | 262 | 2 | auto to_max_int_digit_count = to_precision - to_scale; | 263 | 2 | bool narrow_integral = | 264 | 2 | (to_max_int_digit_count < from_max_int_digit_count) || | 265 | 2 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 266 | | | 267 | 2 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToCppT::NativeType>(); | 268 | 2 | bool multiply_may_overflow = false; | 269 | 2 | if (to_scale > from_scale) { | 270 | 0 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 271 | 0 | } | 272 | | | 273 | 2 | typename ToCppT::NativeType max_result = | 274 | 2 | DataTypeDecimal<ToCppT::PType>::get_max_digits_number(to_precision); | 275 | 2 | typename ToCppT::NativeType min_result = -max_result; | 276 | | | 277 | 2 | MaxNativeType multiplier {}; | 278 | 2 | if (from_scale < to_scale) { | 279 | 0 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 280 | 0 | from_scale); | 281 | 2 | } else if (from_scale > to_scale) { | 282 | 2 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 283 | 2 | to_scale); | 284 | 2 | } | 285 | | | 286 | 2 | return std::visit( | 287 | 2 | [&](auto multiply_may_overflow, auto narrow_integral) { | 288 | 2 | return _from_decimal<FromCppT, ToCppT, multiply_may_overflow, narrow_integral>( | 289 | 2 | from, from_precision, from_scale, to, to_precision, to_scale, | 290 | 2 | min_result, max_result, multiplier, params); | 291 | 2 | }, | 292 | 2 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral)); | 293 | 2 | } |
Unexecuted instantiation: _ZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIiEENS2_IlEES4_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIlEES3_S3_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal14from_decimalv3INS_12Decimal128V3ENS_7DecimalIlEES2_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIN4wide7integerILm256EiEEEENS2_IlEES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIiEENS_12Decimal128V3ES4_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIlEENS_12Decimal128V3ES4_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRNS_14CastParametersE _ZN5doris13CastToDecimal14from_decimalv3INS_12Decimal128V3ES2_S2_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS4_jjRS3_jjRNS_14CastParametersE Line | Count | Source | 258 | 2 | UInt32 to_scale, CastParameters& params) { | 259 | 2 | using MaxNativeType = typename MaxFieldType::NativeType; | 260 | | | 261 | 2 | auto from_max_int_digit_count = from_precision - from_scale; | 262 | 2 | auto to_max_int_digit_count = to_precision - to_scale; | 263 | 2 | bool narrow_integral = | 264 | 2 | (to_max_int_digit_count < from_max_int_digit_count) || | 265 | 2 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 266 | | | 267 | 2 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToCppT::NativeType>(); | 268 | 2 | bool multiply_may_overflow = false; | 269 | 2 | if (to_scale > from_scale) { | 270 | 0 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 271 | 0 | } | 272 | | | 273 | 2 | typename ToCppT::NativeType max_result = | 274 | 2 | DataTypeDecimal<ToCppT::PType>::get_max_digits_number(to_precision); | 275 | 2 | typename ToCppT::NativeType min_result = -max_result; | 276 | | | 277 | 2 | MaxNativeType multiplier {}; | 278 | 2 | if (from_scale < to_scale) { | 279 | 0 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 280 | 0 | from_scale); | 281 | 2 | } else if (from_scale > to_scale) { | 282 | 0 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 283 | 0 | to_scale); | 284 | 0 | } | 285 | | | 286 | 2 | return std::visit( | 287 | 2 | [&](auto multiply_may_overflow, auto narrow_integral) { | 288 | 2 | return _from_decimal<FromCppT, ToCppT, multiply_may_overflow, narrow_integral>( | 289 | 2 | from, from_precision, from_scale, to, to_precision, to_scale, | 290 | 2 | min_result, max_result, multiplier, params); | 291 | 2 | }, | 292 | 2 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral)); | 293 | 2 | } |
Unexecuted instantiation: _ZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIN4wide7integerILm256EiEEEENS_12Decimal128V3ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIiEENS2_IN4wide7integerILm256EiEEEES7_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIlEENS2_IN4wide7integerILm256EiEEEES7_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal14from_decimalv3INS_12Decimal128V3ENS_7DecimalIN4wide7integerILm256EiEEEES7_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIN4wide7integerILm256EiEEEES6_S6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS8_jjRS7_jjRNS_14CastParametersE |
294 | | |
295 | | template <typename FromCppT, typename ToCppT, bool multiply_may_overflow, bool narrow_integral, |
296 | | typename MaxFieldType = std::conditional_t< |
297 | | (sizeof(FromCppT) == sizeof(ToCppT)) && |
298 | | (std::is_same_v<ToCppT, Decimal128V3> || |
299 | | std::is_same_v<FromCppT, Decimal128V3>), |
300 | | Decimal128V3, |
301 | | std::conditional_t<(sizeof(FromCppT) > sizeof(ToCppT)), FromCppT, ToCppT>>> |
302 | | requires(IsDecimalNumber<ToCppT> && IsDecimalNumber<FromCppT>) |
303 | | static inline bool _from_decimal(const FromCppT& from, const UInt32 from_precision, |
304 | | const UInt32 from_scale, ToCppT& to, UInt32 to_precision, |
305 | | UInt32 to_scale, const ToCppT::NativeType& min_result, |
306 | | const ToCppT::NativeType& max_result, |
307 | | const typename MaxFieldType::NativeType& scale_multiplier, |
308 | 29.6k | CastParameters& params) { |
309 | 29.6k | using MaxNativeType = typename MaxFieldType::NativeType; |
310 | | |
311 | 29.6k | if (from_scale < to_scale) { |
312 | 9.19k | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, |
313 | 9.19k | narrow_integral>( |
314 | 9.19k | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, |
315 | 9.19k | min_result, max_result, params); |
316 | 20.5k | } else if (from_scale == to_scale) { |
317 | 3.73k | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( |
318 | 3.73k | from, from_precision, from_scale, to, to_precision, to_scale, min_result, |
319 | 3.73k | max_result, params); |
320 | 16.7k | } else { |
321 | 16.7k | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, |
322 | 16.7k | narrow_integral>( |
323 | 16.7k | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, |
324 | 16.7k | min_result, max_result, params); |
325 | 16.7k | } |
326 | 0 | return true; |
327 | 29.6k | } _ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIiEES3_Lb0ELb0ES3_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKNS4_10NativeTypeESB_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 308 | 268 | CastParameters& params) { | 309 | 268 | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 268 | if (from_scale < to_scale) { | 312 | 28 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 28 | narrow_integral>( | 314 | 28 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 28 | min_result, max_result, params); | 316 | 240 | } else if (from_scale == to_scale) { | 317 | 16 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 16 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 16 | max_result, params); | 320 | 224 | } else { | 321 | 224 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 224 | narrow_integral>( | 323 | 224 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 224 | min_result, max_result, params); | 325 | 224 | } | 326 | 0 | return true; | 327 | 268 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIiEES3_Lb0ELb1ES3_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKNS4_10NativeTypeESB_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 308 | 216 | CastParameters& params) { | 309 | 216 | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 216 | if (from_scale < to_scale) { | 312 | 14 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 14 | narrow_integral>( | 314 | 14 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 14 | min_result, max_result, params); | 316 | 202 | } else if (from_scale == to_scale) { | 317 | 38 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 38 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 38 | max_result, params); | 320 | 164 | } else { | 321 | 164 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 164 | narrow_integral>( | 323 | 164 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 164 | min_result, max_result, params); | 325 | 164 | } | 326 | 0 | return true; | 327 | 216 | } |
Unexecuted instantiation: _ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIiEES3_Lb1ELb0ES3_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKNS4_10NativeTypeESB_RKNT3_10NativeTypeERNS_14CastParametersE _ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIiEES3_Lb1ELb1ES3_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKNS4_10NativeTypeESB_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 308 | 168 | CastParameters& params) { | 309 | 168 | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 168 | if (from_scale < to_scale) { | 312 | 168 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 168 | narrow_integral>( | 314 | 168 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 168 | min_result, max_result, params); | 316 | 168 | } else if (from_scale == to_scale) { | 317 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 0 | max_result, params); | 320 | 0 | } else { | 321 | 0 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 0 | narrow_integral>( | 323 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 0 | min_result, max_result, params); | 325 | 0 | } | 326 | 0 | return true; | 327 | 168 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIlEENS2_IiEELb0ELb0ES3_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 308 | 320 | CastParameters& params) { | 309 | 320 | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 320 | if (from_scale < to_scale) { | 312 | 0 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 0 | narrow_integral>( | 314 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 0 | min_result, max_result, params); | 316 | 320 | } else if (from_scale == to_scale) { | 317 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 0 | max_result, params); | 320 | 320 | } else { | 321 | 320 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 320 | narrow_integral>( | 323 | 320 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 320 | min_result, max_result, params); | 325 | 320 | } | 326 | 0 | return true; | 327 | 320 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIlEENS2_IiEELb0ELb1ES3_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 308 | 918 | CastParameters& params) { | 309 | 918 | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 918 | if (from_scale < to_scale) { | 312 | 0 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 0 | narrow_integral>( | 314 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 0 | min_result, max_result, params); | 316 | 918 | } else if (from_scale == to_scale) { | 317 | 272 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 272 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 272 | max_result, params); | 320 | 646 | } else { | 321 | 646 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 646 | narrow_integral>( | 323 | 646 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 646 | min_result, max_result, params); | 325 | 646 | } | 326 | 0 | return true; | 327 | 918 | } |
Unexecuted instantiation: _ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIlEENS2_IiEELb1ELb0ES3_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RKNT3_10NativeTypeERNS_14CastParametersE _ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIlEENS2_IiEELb1ELb1ES3_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 308 | 252 | CastParameters& params) { | 309 | 252 | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 252 | if (from_scale < to_scale) { | 312 | 252 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 252 | narrow_integral>( | 314 | 252 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 252 | min_result, max_result, params); | 316 | 252 | } else if (from_scale == to_scale) { | 317 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 0 | max_result, params); | 320 | 0 | } else { | 321 | 0 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 0 | narrow_integral>( | 323 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 0 | min_result, max_result, params); | 325 | 0 | } | 326 | 0 | return true; | 327 | 252 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_12Decimal128V3ENS_7DecimalIiEELb0ELb0ES2_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 308 | 320 | CastParameters& params) { | 309 | 320 | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 320 | if (from_scale < to_scale) { | 312 | 0 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 0 | narrow_integral>( | 314 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 0 | min_result, max_result, params); | 316 | 320 | } else if (from_scale == to_scale) { | 317 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 0 | max_result, params); | 320 | 320 | } else { | 321 | 320 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 320 | narrow_integral>( | 323 | 320 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 320 | min_result, max_result, params); | 325 | 320 | } | 326 | 0 | return true; | 327 | 320 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_12Decimal128V3ENS_7DecimalIiEELb0ELb1ES2_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 308 | 958 | CastParameters& params) { | 309 | 958 | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 958 | if (from_scale < to_scale) { | 312 | 0 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 0 | narrow_integral>( | 314 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 0 | min_result, max_result, params); | 316 | 958 | } else if (from_scale == to_scale) { | 317 | 244 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 244 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 244 | max_result, params); | 320 | 714 | } else { | 321 | 714 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 714 | narrow_integral>( | 323 | 714 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 714 | min_result, max_result, params); | 325 | 714 | } | 326 | 0 | return true; | 327 | 958 | } |
Unexecuted instantiation: _ZN5doris13CastToDecimal13_from_decimalINS_12Decimal128V3ENS_7DecimalIiEELb1ELb0ES2_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RKNT3_10NativeTypeERNS_14CastParametersE _ZN5doris13CastToDecimal13_from_decimalINS_12Decimal128V3ENS_7DecimalIiEELb1ELb1ES2_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 308 | 252 | CastParameters& params) { | 309 | 252 | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 252 | if (from_scale < to_scale) { | 312 | 252 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 252 | narrow_integral>( | 314 | 252 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 252 | min_result, max_result, params); | 316 | 252 | } else if (from_scale == to_scale) { | 317 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 0 | max_result, params); | 320 | 0 | } else { | 321 | 0 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 0 | narrow_integral>( | 323 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 0 | min_result, max_result, params); | 325 | 0 | } | 326 | 0 | return true; | 327 | 252 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIN4wide7integerILm256EiEEEENS2_IiEELb0ELb0ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKNS8_10NativeTypeESF_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 308 | 320 | CastParameters& params) { | 309 | 320 | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 320 | if (from_scale < to_scale) { | 312 | 0 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 0 | narrow_integral>( | 314 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 0 | min_result, max_result, params); | 316 | 320 | } else if (from_scale == to_scale) { | 317 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 0 | max_result, params); | 320 | 320 | } else { | 321 | 320 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 320 | narrow_integral>( | 323 | 320 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 320 | min_result, max_result, params); | 325 | 320 | } | 326 | 0 | return true; | 327 | 320 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIN4wide7integerILm256EiEEEENS2_IiEELb0ELb1ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKNS8_10NativeTypeESF_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 308 | 958 | CastParameters& params) { | 309 | 958 | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 958 | if (from_scale < to_scale) { | 312 | 0 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 0 | narrow_integral>( | 314 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 0 | min_result, max_result, params); | 316 | 958 | } else if (from_scale == to_scale) { | 317 | 244 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 244 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 244 | max_result, params); | 320 | 714 | } else { | 321 | 714 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 714 | narrow_integral>( | 323 | 714 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 714 | min_result, max_result, params); | 325 | 714 | } | 326 | 0 | return true; | 327 | 958 | } |
Unexecuted instantiation: _ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIN4wide7integerILm256EiEEEENS2_IiEELb1ELb0ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKNS8_10NativeTypeESF_RKNT3_10NativeTypeERNS_14CastParametersE _ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIN4wide7integerILm256EiEEEENS2_IiEELb1ELb1ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKNS8_10NativeTypeESF_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 308 | 252 | CastParameters& params) { | 309 | 252 | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 252 | if (from_scale < to_scale) { | 312 | 252 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 252 | narrow_integral>( | 314 | 252 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 252 | min_result, max_result, params); | 316 | 252 | } else if (from_scale == to_scale) { | 317 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 0 | max_result, params); | 320 | 0 | } else { | 321 | 0 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 0 | narrow_integral>( | 323 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 0 | min_result, max_result, params); | 325 | 0 | } | 326 | 0 | return true; | 327 | 252 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIiEENS2_IlEELb0ELb0ES4_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 308 | 756 | CastParameters& params) { | 309 | 756 | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 756 | if (from_scale < to_scale) { | 312 | 224 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 224 | narrow_integral>( | 314 | 224 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 224 | min_result, max_result, params); | 316 | 532 | } else if (from_scale == to_scale) { | 317 | 164 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 164 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 164 | max_result, params); | 320 | 368 | } else { | 321 | 368 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 368 | narrow_integral>( | 323 | 368 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 368 | min_result, max_result, params); | 325 | 368 | } | 326 | 0 | return true; | 327 | 756 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIiEENS2_IlEELb0ELb1ES4_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 308 | 116 | CastParameters& params) { | 309 | 116 | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 116 | if (from_scale < to_scale) { | 312 | 116 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 116 | narrow_integral>( | 314 | 116 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 116 | min_result, max_result, params); | 316 | 116 | } else if (from_scale == to_scale) { | 317 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 0 | max_result, params); | 320 | 0 | } else { | 321 | 0 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 0 | narrow_integral>( | 323 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 0 | min_result, max_result, params); | 325 | 0 | } | 326 | 0 | return true; | 327 | 116 | } |
Unexecuted instantiation: _ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIiEENS2_IlEELb1ELb0ES4_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RKNT3_10NativeTypeERNS_14CastParametersE _ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIiEENS2_IlEELb1ELb1ES4_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 308 | 144 | CastParameters& params) { | 309 | 144 | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 144 | if (from_scale < to_scale) { | 312 | 144 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 144 | narrow_integral>( | 314 | 144 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 144 | min_result, max_result, params); | 316 | 144 | } else if (from_scale == to_scale) { | 317 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 0 | max_result, params); | 320 | 0 | } else { | 321 | 0 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 0 | narrow_integral>( | 323 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 0 | min_result, max_result, params); | 325 | 0 | } | 326 | 0 | return true; | 327 | 144 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIlEES3_Lb0ELb0ES3_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKNS4_10NativeTypeESB_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 308 | 856 | CastParameters& params) { | 309 | 856 | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 856 | if (from_scale < to_scale) { | 312 | 92 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 92 | narrow_integral>( | 314 | 92 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 92 | min_result, max_result, params); | 316 | 764 | } else if (from_scale == to_scale) { | 317 | 60 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 60 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 60 | max_result, params); | 320 | 704 | } else { | 321 | 704 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 704 | narrow_integral>( | 323 | 704 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 704 | min_result, max_result, params); | 325 | 704 | } | 326 | 0 | return true; | 327 | 856 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIlEES3_Lb0ELb1ES3_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKNS4_10NativeTypeESB_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 308 | 364 | CastParameters& params) { | 309 | 364 | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 364 | if (from_scale < to_scale) { | 312 | 88 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 88 | narrow_integral>( | 314 | 88 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 88 | min_result, max_result, params); | 316 | 276 | } else if (from_scale == to_scale) { | 317 | 84 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 84 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 84 | max_result, params); | 320 | 192 | } else { | 321 | 192 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 192 | narrow_integral>( | 323 | 192 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 192 | min_result, max_result, params); | 325 | 192 | } | 326 | 0 | return true; | 327 | 364 | } |
Unexecuted instantiation: _ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIlEES3_Lb1ELb0ES3_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKNS4_10NativeTypeESB_RKNT3_10NativeTypeERNS_14CastParametersE _ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIlEES3_Lb1ELb1ES3_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKNS4_10NativeTypeESB_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 308 | 420 | CastParameters& params) { | 309 | 420 | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 420 | if (from_scale < to_scale) { | 312 | 420 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 420 | narrow_integral>( | 314 | 420 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 420 | min_result, max_result, params); | 316 | 420 | } else if (from_scale == to_scale) { | 317 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 0 | max_result, params); | 320 | 0 | } else { | 321 | 0 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 0 | narrow_integral>( | 323 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 0 | min_result, max_result, params); | 325 | 0 | } | 326 | 0 | return true; | 327 | 420 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_12Decimal128V3ENS_7DecimalIlEELb0ELb0ES2_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 308 | 576 | CastParameters& params) { | 309 | 576 | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 576 | if (from_scale < to_scale) { | 312 | 0 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 0 | narrow_integral>( | 314 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 0 | min_result, max_result, params); | 316 | 576 | } else if (from_scale == to_scale) { | 317 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 0 | max_result, params); | 320 | 576 | } else { | 321 | 576 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 576 | narrow_integral>( | 323 | 576 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 576 | min_result, max_result, params); | 325 | 576 | } | 326 | 0 | return true; | 327 | 576 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_12Decimal128V3ENS_7DecimalIlEELb0ELb1ES2_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 308 | 1.06k | CastParameters& params) { | 309 | 1.06k | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 1.06k | if (from_scale < to_scale) { | 312 | 0 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 0 | narrow_integral>( | 314 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 0 | min_result, max_result, params); | 316 | 1.06k | } else if (from_scale == to_scale) { | 317 | 364 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 364 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 364 | max_result, params); | 320 | 700 | } else { | 321 | 700 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 700 | narrow_integral>( | 323 | 700 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 700 | min_result, max_result, params); | 325 | 700 | } | 326 | 0 | return true; | 327 | 1.06k | } |
Unexecuted instantiation: _ZN5doris13CastToDecimal13_from_decimalINS_12Decimal128V3ENS_7DecimalIlEELb1ELb0ES2_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RKNT3_10NativeTypeERNS_14CastParametersE _ZN5doris13CastToDecimal13_from_decimalINS_12Decimal128V3ENS_7DecimalIlEELb1ELb1ES2_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 308 | 448 | CastParameters& params) { | 309 | 448 | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 448 | if (from_scale < to_scale) { | 312 | 448 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 448 | narrow_integral>( | 314 | 448 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 448 | min_result, max_result, params); | 316 | 448 | } else if (from_scale == to_scale) { | 317 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 0 | max_result, params); | 320 | 0 | } else { | 321 | 0 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 0 | narrow_integral>( | 323 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 0 | min_result, max_result, params); | 325 | 0 | } | 326 | 0 | return true; | 327 | 448 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIN4wide7integerILm256EiEEEENS2_IlEELb0ELb0ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKNS8_10NativeTypeESF_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 308 | 576 | CastParameters& params) { | 309 | 576 | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 576 | if (from_scale < to_scale) { | 312 | 0 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 0 | narrow_integral>( | 314 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 0 | min_result, max_result, params); | 316 | 576 | } else if (from_scale == to_scale) { | 317 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 0 | max_result, params); | 320 | 576 | } else { | 321 | 576 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 576 | narrow_integral>( | 323 | 576 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 576 | min_result, max_result, params); | 325 | 576 | } | 326 | 0 | return true; | 327 | 576 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIN4wide7integerILm256EiEEEENS2_IlEELb0ELb1ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKNS8_10NativeTypeESF_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 308 | 1.10k | CastParameters& params) { | 309 | 1.10k | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 1.10k | if (from_scale < to_scale) { | 312 | 0 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 0 | narrow_integral>( | 314 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 0 | min_result, max_result, params); | 316 | 1.10k | } else if (from_scale == to_scale) { | 317 | 336 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 336 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 336 | max_result, params); | 320 | 768 | } else { | 321 | 768 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 768 | narrow_integral>( | 323 | 768 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 768 | min_result, max_result, params); | 325 | 768 | } | 326 | 0 | return true; | 327 | 1.10k | } |
Unexecuted instantiation: _ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIN4wide7integerILm256EiEEEENS2_IlEELb1ELb0ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKNS8_10NativeTypeESF_RKNT3_10NativeTypeERNS_14CastParametersE _ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIN4wide7integerILm256EiEEEENS2_IlEELb1ELb1ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKNS8_10NativeTypeESF_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 308 | 448 | CastParameters& params) { | 309 | 448 | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 448 | if (from_scale < to_scale) { | 312 | 448 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 448 | narrow_integral>( | 314 | 448 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 448 | min_result, max_result, params); | 316 | 448 | } else if (from_scale == to_scale) { | 317 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 0 | max_result, params); | 320 | 0 | } else { | 321 | 0 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 0 | narrow_integral>( | 323 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 0 | min_result, max_result, params); | 325 | 0 | } | 326 | 0 | return true; | 327 | 448 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIiEENS_12Decimal128V3ELb0ELb0ES4_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 308 | 756 | CastParameters& params) { | 309 | 756 | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 756 | if (from_scale < to_scale) { | 312 | 240 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 240 | narrow_integral>( | 314 | 240 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 240 | min_result, max_result, params); | 316 | 516 | } else if (from_scale == to_scale) { | 317 | 148 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 148 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 148 | max_result, params); | 320 | 368 | } else { | 321 | 368 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 368 | narrow_integral>( | 323 | 368 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 368 | min_result, max_result, params); | 325 | 368 | } | 326 | 0 | return true; | 327 | 756 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIiEENS_12Decimal128V3ELb0ELb1ES4_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 308 | 130 | CastParameters& params) { | 309 | 130 | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 130 | if (from_scale < to_scale) { | 312 | 130 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 130 | narrow_integral>( | 314 | 130 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 130 | min_result, max_result, params); | 316 | 130 | } else if (from_scale == to_scale) { | 317 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 0 | max_result, params); | 320 | 0 | } else { | 321 | 0 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 0 | narrow_integral>( | 323 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 0 | min_result, max_result, params); | 325 | 0 | } | 326 | 0 | return true; | 327 | 130 | } |
Unexecuted instantiation: _ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIiEENS_12Decimal128V3ELb1ELb0ES4_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RKNT3_10NativeTypeERNS_14CastParametersE _ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIiEENS_12Decimal128V3ELb1ELb1ES4_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 308 | 130 | CastParameters& params) { | 309 | 130 | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 130 | if (from_scale < to_scale) { | 312 | 130 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 130 | narrow_integral>( | 314 | 130 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 130 | min_result, max_result, params); | 316 | 130 | } else if (from_scale == to_scale) { | 317 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 0 | max_result, params); | 320 | 0 | } else { | 321 | 0 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 0 | narrow_integral>( | 323 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 0 | min_result, max_result, params); | 325 | 0 | } | 326 | 0 | return true; | 327 | 130 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIlEENS_12Decimal128V3ELb0ELb0ES4_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 308 | 1.31k | CastParameters& params) { | 309 | 1.31k | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 1.31k | if (from_scale < to_scale) { | 312 | 352 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 352 | narrow_integral>( | 314 | 352 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 352 | min_result, max_result, params); | 316 | 960 | } else if (from_scale == to_scale) { | 317 | 256 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 256 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 256 | max_result, params); | 320 | 704 | } else { | 321 | 704 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 704 | narrow_integral>( | 323 | 704 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 704 | min_result, max_result, params); | 325 | 704 | } | 326 | 0 | return true; | 327 | 1.31k | } |
_ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIlEENS_12Decimal128V3ELb0ELb1ES4_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 308 | 232 | CastParameters& params) { | 309 | 232 | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 232 | if (from_scale < to_scale) { | 312 | 232 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 232 | narrow_integral>( | 314 | 232 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 232 | min_result, max_result, params); | 316 | 232 | } else if (from_scale == to_scale) { | 317 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 0 | max_result, params); | 320 | 0 | } else { | 321 | 0 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 0 | narrow_integral>( | 323 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 0 | min_result, max_result, params); | 325 | 0 | } | 326 | 0 | return true; | 327 | 232 | } |
Unexecuted instantiation: _ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIlEENS_12Decimal128V3ELb1ELb0ES4_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RKNT3_10NativeTypeERNS_14CastParametersE _ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIlEENS_12Decimal128V3ELb1ELb1ES4_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 308 | 232 | CastParameters& params) { | 309 | 232 | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 232 | if (from_scale < to_scale) { | 312 | 232 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 232 | narrow_integral>( | 314 | 232 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 232 | min_result, max_result, params); | 316 | 232 | } else if (from_scale == to_scale) { | 317 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 0 | max_result, params); | 320 | 0 | } else { | 321 | 0 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 0 | narrow_integral>( | 323 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 0 | min_result, max_result, params); | 325 | 0 | } | 326 | 0 | return true; | 327 | 232 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_12Decimal128V3ES2_Lb0ELb0ES2_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS4_jjRS3_jjRKNS3_10NativeTypeESA_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 308 | 858 | CastParameters& params) { | 309 | 858 | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 858 | if (from_scale < to_scale) { | 312 | 92 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 92 | narrow_integral>( | 314 | 92 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 92 | min_result, max_result, params); | 316 | 766 | } else if (from_scale == to_scale) { | 317 | 62 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 62 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 62 | max_result, params); | 320 | 704 | } else { | 321 | 704 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 704 | narrow_integral>( | 323 | 704 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 704 | min_result, max_result, params); | 325 | 704 | } | 326 | 0 | return true; | 327 | 858 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_12Decimal128V3ES2_Lb0ELb1ES2_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS4_jjRS3_jjRKNS3_10NativeTypeESA_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 308 | 416 | CastParameters& params) { | 309 | 416 | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 416 | if (from_scale < to_scale) { | 312 | 140 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 140 | narrow_integral>( | 314 | 140 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 140 | min_result, max_result, params); | 316 | 276 | } else if (from_scale == to_scale) { | 317 | 84 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 84 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 84 | max_result, params); | 320 | 192 | } else { | 321 | 192 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 192 | narrow_integral>( | 323 | 192 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 192 | min_result, max_result, params); | 325 | 192 | } | 326 | 0 | return true; | 327 | 416 | } |
Unexecuted instantiation: _ZN5doris13CastToDecimal13_from_decimalINS_12Decimal128V3ES2_Lb1ELb0ES2_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS4_jjRS3_jjRKNS3_10NativeTypeESA_RKNT3_10NativeTypeERNS_14CastParametersE _ZN5doris13CastToDecimal13_from_decimalINS_12Decimal128V3ES2_Lb1ELb1ES2_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS4_jjRS3_jjRKNS3_10NativeTypeESA_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 308 | 368 | CastParameters& params) { | 309 | 368 | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 368 | if (from_scale < to_scale) { | 312 | 368 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 368 | narrow_integral>( | 314 | 368 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 368 | min_result, max_result, params); | 316 | 368 | } else if (from_scale == to_scale) { | 317 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 0 | max_result, params); | 320 | 0 | } else { | 321 | 0 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 0 | narrow_integral>( | 323 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 0 | min_result, max_result, params); | 325 | 0 | } | 326 | 0 | return true; | 327 | 368 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIN4wide7integerILm256EiEEEENS_12Decimal128V3ELb0ELb0ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKNS8_10NativeTypeESF_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 308 | 576 | CastParameters& params) { | 309 | 576 | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 576 | if (from_scale < to_scale) { | 312 | 0 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 0 | narrow_integral>( | 314 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 0 | min_result, max_result, params); | 316 | 576 | } else if (from_scale == to_scale) { | 317 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 0 | max_result, params); | 320 | 576 | } else { | 321 | 576 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 576 | narrow_integral>( | 323 | 576 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 576 | min_result, max_result, params); | 325 | 576 | } | 326 | 0 | return true; | 327 | 576 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIN4wide7integerILm256EiEEEENS_12Decimal128V3ELb0ELb1ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKNS8_10NativeTypeESF_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 308 | 1.06k | CastParameters& params) { | 309 | 1.06k | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 1.06k | if (from_scale < to_scale) { | 312 | 0 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 0 | narrow_integral>( | 314 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 0 | min_result, max_result, params); | 316 | 1.06k | } else if (from_scale == to_scale) { | 317 | 364 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 364 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 364 | max_result, params); | 320 | 700 | } else { | 321 | 700 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 700 | narrow_integral>( | 323 | 700 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 700 | min_result, max_result, params); | 325 | 700 | } | 326 | 0 | return true; | 327 | 1.06k | } |
Unexecuted instantiation: _ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIN4wide7integerILm256EiEEEENS_12Decimal128V3ELb1ELb0ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKNS8_10NativeTypeESF_RKNT3_10NativeTypeERNS_14CastParametersE _ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIN4wide7integerILm256EiEEEENS_12Decimal128V3ELb1ELb1ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKNS8_10NativeTypeESF_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 308 | 448 | CastParameters& params) { | 309 | 448 | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 448 | if (from_scale < to_scale) { | 312 | 448 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 448 | narrow_integral>( | 314 | 448 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 448 | min_result, max_result, params); | 316 | 448 | } else if (from_scale == to_scale) { | 317 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 0 | max_result, params); | 320 | 0 | } else { | 321 | 0 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 0 | narrow_integral>( | 323 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 0 | min_result, max_result, params); | 325 | 0 | } | 326 | 0 | return true; | 327 | 448 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIiEENS2_IN4wide7integerILm256EiEEEELb0ELb0ES7_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKNS8_10NativeTypeESF_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 308 | 756 | CastParameters& params) { | 309 | 756 | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 756 | if (from_scale < to_scale) { | 312 | 240 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 240 | narrow_integral>( | 314 | 240 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 240 | min_result, max_result, params); | 316 | 516 | } else if (from_scale == to_scale) { | 317 | 148 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 148 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 148 | max_result, params); | 320 | 368 | } else { | 321 | 368 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 368 | narrow_integral>( | 323 | 368 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 368 | min_result, max_result, params); | 325 | 368 | } | 326 | 0 | return true; | 327 | 756 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIiEENS2_IN4wide7integerILm256EiEEEELb0ELb1ES7_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKNS8_10NativeTypeESF_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 308 | 130 | CastParameters& params) { | 309 | 130 | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 130 | if (from_scale < to_scale) { | 312 | 130 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 130 | narrow_integral>( | 314 | 130 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 130 | min_result, max_result, params); | 316 | 130 | } else if (from_scale == to_scale) { | 317 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 0 | max_result, params); | 320 | 0 | } else { | 321 | 0 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 0 | narrow_integral>( | 323 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 0 | min_result, max_result, params); | 325 | 0 | } | 326 | 0 | return true; | 327 | 130 | } |
Unexecuted instantiation: _ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIiEENS2_IN4wide7integerILm256EiEEEELb1ELb0ES7_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKNS8_10NativeTypeESF_RKNT3_10NativeTypeERNS_14CastParametersE _ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIiEENS2_IN4wide7integerILm256EiEEEELb1ELb1ES7_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKNS8_10NativeTypeESF_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 308 | 130 | CastParameters& params) { | 309 | 130 | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 130 | if (from_scale < to_scale) { | 312 | 130 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 130 | narrow_integral>( | 314 | 130 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 130 | min_result, max_result, params); | 316 | 130 | } else if (from_scale == to_scale) { | 317 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 0 | max_result, params); | 320 | 0 | } else { | 321 | 0 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 0 | narrow_integral>( | 323 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 0 | min_result, max_result, params); | 325 | 0 | } | 326 | 0 | return true; | 327 | 130 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIlEENS2_IN4wide7integerILm256EiEEEELb0ELb0ES7_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKNS8_10NativeTypeESF_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 308 | 1.31k | CastParameters& params) { | 309 | 1.31k | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 1.31k | if (from_scale < to_scale) { | 312 | 368 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 368 | narrow_integral>( | 314 | 368 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 368 | min_result, max_result, params); | 316 | 944 | } else if (from_scale == to_scale) { | 317 | 240 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 240 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 240 | max_result, params); | 320 | 704 | } else { | 321 | 704 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 704 | narrow_integral>( | 323 | 704 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 704 | min_result, max_result, params); | 325 | 704 | } | 326 | 0 | return true; | 327 | 1.31k | } |
_ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIlEENS2_IN4wide7integerILm256EiEEEELb0ELb1ES7_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKNS8_10NativeTypeESF_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 308 | 232 | CastParameters& params) { | 309 | 232 | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 232 | if (from_scale < to_scale) { | 312 | 232 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 232 | narrow_integral>( | 314 | 232 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 232 | min_result, max_result, params); | 316 | 232 | } else if (from_scale == to_scale) { | 317 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 0 | max_result, params); | 320 | 0 | } else { | 321 | 0 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 0 | narrow_integral>( | 323 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 0 | min_result, max_result, params); | 325 | 0 | } | 326 | 0 | return true; | 327 | 232 | } |
Unexecuted instantiation: _ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIlEENS2_IN4wide7integerILm256EiEEEELb1ELb0ES7_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKNS8_10NativeTypeESF_RKNT3_10NativeTypeERNS_14CastParametersE _ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIlEENS2_IN4wide7integerILm256EiEEEELb1ELb1ES7_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKNS8_10NativeTypeESF_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 308 | 232 | CastParameters& params) { | 309 | 232 | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 232 | if (from_scale < to_scale) { | 312 | 232 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 232 | narrow_integral>( | 314 | 232 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 232 | min_result, max_result, params); | 316 | 232 | } else if (from_scale == to_scale) { | 317 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 0 | max_result, params); | 320 | 0 | } else { | 321 | 0 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 0 | narrow_integral>( | 323 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 0 | min_result, max_result, params); | 325 | 0 | } | 326 | 0 | return true; | 327 | 232 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_12Decimal128V3ENS_7DecimalIN4wide7integerILm256EiEEEELb0ELb0ES7_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKNS8_10NativeTypeESF_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 308 | 1.31k | CastParameters& params) { | 309 | 1.31k | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 1.31k | if (from_scale < to_scale) { | 312 | 352 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 352 | narrow_integral>( | 314 | 352 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 352 | min_result, max_result, params); | 316 | 960 | } else if (from_scale == to_scale) { | 317 | 256 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 256 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 256 | max_result, params); | 320 | 704 | } else { | 321 | 704 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 704 | narrow_integral>( | 323 | 704 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 704 | min_result, max_result, params); | 325 | 704 | } | 326 | 0 | return true; | 327 | 1.31k | } |
_ZN5doris13CastToDecimal13_from_decimalINS_12Decimal128V3ENS_7DecimalIN4wide7integerILm256EiEEEELb0ELb1ES7_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKNS8_10NativeTypeESF_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 308 | 218 | CastParameters& params) { | 309 | 218 | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 218 | if (from_scale < to_scale) { | 312 | 218 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 218 | narrow_integral>( | 314 | 218 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 218 | min_result, max_result, params); | 316 | 218 | } else if (from_scale == to_scale) { | 317 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 0 | max_result, params); | 320 | 0 | } else { | 321 | 0 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 0 | narrow_integral>( | 323 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 0 | min_result, max_result, params); | 325 | 0 | } | 326 | 0 | return true; | 327 | 218 | } |
Unexecuted instantiation: _ZN5doris13CastToDecimal13_from_decimalINS_12Decimal128V3ENS_7DecimalIN4wide7integerILm256EiEEEELb1ELb0ES7_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKNS8_10NativeTypeESF_RKNT3_10NativeTypeERNS_14CastParametersE _ZN5doris13CastToDecimal13_from_decimalINS_12Decimal128V3ENS_7DecimalIN4wide7integerILm256EiEEEELb1ELb1ES7_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKNS8_10NativeTypeESF_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 308 | 246 | CastParameters& params) { | 309 | 246 | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 246 | if (from_scale < to_scale) { | 312 | 246 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 246 | narrow_integral>( | 314 | 246 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 246 | min_result, max_result, params); | 316 | 246 | } else if (from_scale == to_scale) { | 317 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 0 | max_result, params); | 320 | 0 | } else { | 321 | 0 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 0 | narrow_integral>( | 323 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 0 | min_result, max_result, params); | 325 | 0 | } | 326 | 0 | return true; | 327 | 246 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIN4wide7integerILm256EiEEEES6_Lb0ELb0ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS8_jjRS7_jjRKNS7_10NativeTypeESE_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 308 | 856 | CastParameters& params) { | 309 | 856 | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 856 | if (from_scale < to_scale) { | 312 | 92 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 92 | narrow_integral>( | 314 | 92 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 92 | min_result, max_result, params); | 316 | 764 | } else if (from_scale == to_scale) { | 317 | 60 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 60 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 60 | max_result, params); | 320 | 704 | } else { | 321 | 704 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 704 | narrow_integral>( | 323 | 704 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 704 | min_result, max_result, params); | 325 | 704 | } | 326 | 0 | return true; | 327 | 856 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIN4wide7integerILm256EiEEEES6_Lb0ELb1ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS8_jjRS7_jjRKNS7_10NativeTypeESE_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 308 | 364 | CastParameters& params) { | 309 | 364 | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 364 | if (from_scale < to_scale) { | 312 | 88 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 88 | narrow_integral>( | 314 | 88 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 88 | min_result, max_result, params); | 316 | 276 | } else if (from_scale == to_scale) { | 317 | 84 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 84 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 84 | max_result, params); | 320 | 192 | } else { | 321 | 192 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 192 | narrow_integral>( | 323 | 192 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 192 | min_result, max_result, params); | 325 | 192 | } | 326 | 0 | return true; | 327 | 364 | } |
Unexecuted instantiation: _ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIN4wide7integerILm256EiEEEES6_Lb1ELb0ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS8_jjRS7_jjRKNS7_10NativeTypeESE_RKNT3_10NativeTypeERNS_14CastParametersE _ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIN4wide7integerILm256EiEEEES6_Lb1ELb1ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS8_jjRS7_jjRKNS7_10NativeTypeESE_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 308 | 420 | CastParameters& params) { | 309 | 420 | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 420 | if (from_scale < to_scale) { | 312 | 420 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 420 | narrow_integral>( | 314 | 420 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 420 | min_result, max_result, params); | 316 | 420 | } else if (from_scale == to_scale) { | 317 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 0 | max_result, params); | 320 | 0 | } else { | 321 | 0 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 0 | narrow_integral>( | 323 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 0 | min_result, max_result, params); | 325 | 0 | } | 326 | 0 | return true; | 327 | 420 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_14DecimalV2ValueENS_7DecimalIiEELb0ELb0ES2_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 308 | 72 | CastParameters& params) { | 309 | 72 | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 72 | if (from_scale < to_scale) { | 312 | 0 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 0 | narrow_integral>( | 314 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 0 | min_result, max_result, params); | 316 | 72 | } else if (from_scale == to_scale) { | 317 | 8 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 8 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 8 | max_result, params); | 320 | 64 | } else { | 321 | 64 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 64 | narrow_integral>( | 323 | 64 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 64 | min_result, max_result, params); | 325 | 64 | } | 326 | 0 | return true; | 327 | 72 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_14DecimalV2ValueENS_7DecimalIiEELb0ELb1ES2_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 308 | 940 | CastParameters& params) { | 309 | 940 | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 940 | if (from_scale < to_scale) { | 312 | 0 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 0 | narrow_integral>( | 314 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 0 | min_result, max_result, params); | 316 | 940 | } else if (from_scale == to_scale) { | 317 | 70 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 70 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 70 | max_result, params); | 320 | 870 | } else { | 321 | 870 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 870 | narrow_integral>( | 323 | 870 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 870 | min_result, max_result, params); | 325 | 870 | } | 326 | 0 | return true; | 327 | 940 | } |
Unexecuted instantiation: _ZN5doris13CastToDecimal13_from_decimalINS_14DecimalV2ValueENS_7DecimalIiEELb1ELb0ES2_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RKNT3_10NativeTypeERNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal13_from_decimalINS_14DecimalV2ValueENS_7DecimalIiEELb1ELb1ES2_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RKNT3_10NativeTypeERNS_14CastParametersE _ZN5doris13CastToDecimal13_from_decimalINS_14DecimalV2ValueENS_7DecimalIlEELb0ELb0ES2_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 308 | 262 | CastParameters& params) { | 309 | 262 | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 262 | if (from_scale < to_scale) { | 312 | 0 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 0 | narrow_integral>( | 314 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 0 | min_result, max_result, params); | 316 | 262 | } else if (from_scale == to_scale) { | 317 | 14 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 14 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 14 | max_result, params); | 320 | 248 | } else { | 321 | 248 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 248 | narrow_integral>( | 323 | 248 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 248 | min_result, max_result, params); | 325 | 248 | } | 326 | 0 | return true; | 327 | 262 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_14DecimalV2ValueENS_7DecimalIlEELb0ELb1ES2_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 308 | 828 | CastParameters& params) { | 309 | 828 | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 828 | if (from_scale < to_scale) { | 312 | 0 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 0 | narrow_integral>( | 314 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 0 | min_result, max_result, params); | 316 | 828 | } else if (from_scale == to_scale) { | 317 | 120 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 120 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 120 | max_result, params); | 320 | 708 | } else { | 321 | 708 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 708 | narrow_integral>( | 323 | 708 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 708 | min_result, max_result, params); | 325 | 708 | } | 326 | 0 | return true; | 327 | 828 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_14DecimalV2ValueENS_7DecimalIlEELb1ELb0ES2_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 308 | 30 | CastParameters& params) { | 309 | 30 | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 30 | if (from_scale < to_scale) { | 312 | 30 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 30 | narrow_integral>( | 314 | 30 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 30 | min_result, max_result, params); | 316 | 30 | } else if (from_scale == to_scale) { | 317 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 0 | max_result, params); | 320 | 0 | } else { | 321 | 0 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 0 | narrow_integral>( | 323 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 0 | min_result, max_result, params); | 325 | 0 | } | 326 | 0 | return true; | 327 | 30 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_14DecimalV2ValueENS_7DecimalIlEELb1ELb1ES2_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 308 | 260 | CastParameters& params) { | 309 | 260 | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 260 | if (from_scale < to_scale) { | 312 | 260 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 260 | narrow_integral>( | 314 | 260 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 260 | min_result, max_result, params); | 316 | 260 | } else if (from_scale == to_scale) { | 317 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 0 | max_result, params); | 320 | 0 | } else { | 321 | 0 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 0 | narrow_integral>( | 323 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 0 | min_result, max_result, params); | 325 | 0 | } | 326 | 0 | return true; | 327 | 260 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_14DecimalV2ValueENS_12Decimal128V3ELb0ELb0ES3_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKNS4_10NativeTypeESB_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 308 | 750 | CastParameters& params) { | 309 | 750 | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 750 | if (from_scale < to_scale) { | 312 | 22 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 22 | narrow_integral>( | 314 | 22 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 22 | min_result, max_result, params); | 316 | 728 | } else if (from_scale == to_scale) { | 317 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 0 | max_result, params); | 320 | 728 | } else { | 321 | 728 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 728 | narrow_integral>( | 323 | 728 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 728 | min_result, max_result, params); | 325 | 728 | } | 326 | 0 | return true; | 327 | 750 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_14DecimalV2ValueENS_12Decimal128V3ELb0ELb1ES3_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKNS4_10NativeTypeESB_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 308 | 290 | CastParameters& params) { | 309 | 290 | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 290 | if (from_scale < to_scale) { | 312 | 190 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 190 | narrow_integral>( | 314 | 190 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 190 | min_result, max_result, params); | 316 | 190 | } else if (from_scale == to_scale) { | 317 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 0 | max_result, params); | 320 | 100 | } else { | 321 | 100 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 100 | narrow_integral>( | 323 | 100 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 100 | min_result, max_result, params); | 325 | 100 | } | 326 | 0 | return true; | 327 | 290 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_14DecimalV2ValueENS_12Decimal128V3ELb1ELb0ES3_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKNS4_10NativeTypeESB_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 308 | 22 | CastParameters& params) { | 309 | 22 | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 22 | if (from_scale < to_scale) { | 312 | 22 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 22 | narrow_integral>( | 314 | 22 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 22 | min_result, max_result, params); | 316 | 22 | } else if (from_scale == to_scale) { | 317 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 0 | max_result, params); | 320 | 0 | } else { | 321 | 0 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 0 | narrow_integral>( | 323 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 0 | min_result, max_result, params); | 325 | 0 | } | 326 | 0 | return true; | 327 | 22 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_14DecimalV2ValueENS_12Decimal128V3ELb1ELb1ES3_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKNS4_10NativeTypeESB_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 308 | 190 | CastParameters& params) { | 309 | 190 | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 190 | if (from_scale < to_scale) { | 312 | 190 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 190 | narrow_integral>( | 314 | 190 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 190 | min_result, max_result, params); | 316 | 190 | } else if (from_scale == to_scale) { | 317 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 0 | max_result, params); | 320 | 0 | } else { | 321 | 0 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 0 | narrow_integral>( | 323 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 0 | min_result, max_result, params); | 325 | 0 | } | 326 | 0 | return true; | 327 | 190 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_14DecimalV2ValueENS_7DecimalIN4wide7integerILm256EiEEEELb0ELb0ES7_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKNS8_10NativeTypeESF_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 308 | 846 | CastParameters& params) { | 309 | 846 | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 846 | if (from_scale < to_scale) { | 312 | 22 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 22 | narrow_integral>( | 314 | 22 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 22 | min_result, max_result, params); | 316 | 824 | } else if (from_scale == to_scale) { | 317 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 0 | max_result, params); | 320 | 824 | } else { | 321 | 824 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 824 | narrow_integral>( | 323 | 824 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 824 | min_result, max_result, params); | 325 | 824 | } | 326 | 0 | return true; | 327 | 846 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_14DecimalV2ValueENS_7DecimalIN4wide7integerILm256EiEEEELb0ELb1ES7_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKNS8_10NativeTypeESF_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 308 | 190 | CastParameters& params) { | 309 | 190 | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 190 | if (from_scale < to_scale) { | 312 | 190 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 190 | narrow_integral>( | 314 | 190 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 190 | min_result, max_result, params); | 316 | 190 | } else if (from_scale == to_scale) { | 317 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 0 | max_result, params); | 320 | 0 | } else { | 321 | 0 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 0 | narrow_integral>( | 323 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 0 | min_result, max_result, params); | 325 | 0 | } | 326 | 0 | return true; | 327 | 190 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_14DecimalV2ValueENS_7DecimalIN4wide7integerILm256EiEEEELb1ELb0ES7_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKNS8_10NativeTypeESF_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 308 | 22 | CastParameters& params) { | 309 | 22 | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 22 | if (from_scale < to_scale) { | 312 | 22 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 22 | narrow_integral>( | 314 | 22 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 22 | min_result, max_result, params); | 316 | 22 | } else if (from_scale == to_scale) { | 317 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 0 | max_result, params); | 320 | 0 | } else { | 321 | 0 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 0 | narrow_integral>( | 323 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 0 | min_result, max_result, params); | 325 | 0 | } | 326 | 0 | return true; | 327 | 22 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_14DecimalV2ValueENS_7DecimalIN4wide7integerILm256EiEEEELb1ELb1ES7_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKNS8_10NativeTypeESF_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 308 | 190 | CastParameters& params) { | 309 | 190 | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 190 | if (from_scale < to_scale) { | 312 | 190 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 190 | narrow_integral>( | 314 | 190 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 190 | min_result, max_result, params); | 316 | 190 | } else if (from_scale == to_scale) { | 317 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 0 | max_result, params); | 320 | 0 | } else { | 321 | 0 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 0 | narrow_integral>( | 323 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 0 | min_result, max_result, params); | 325 | 0 | } | 326 | 0 | return true; | 327 | 190 | } |
|
328 | | |
329 | | template < |
330 | | typename FromCppT, typename ToCppT, bool multiply_may_overflow, bool narrow_integral, |
331 | | typename MaxNativeType = std::conditional_t< |
332 | | (sizeof(FromCppT) == sizeof(ToCppT)) && |
333 | | (std::is_same_v<ToCppT, Decimal128V3> || |
334 | | std::is_same_v<FromCppT, Decimal128V3>), |
335 | | Decimal128V3::NativeType, |
336 | | std::conditional_t<(sizeof(FromCppT) > sizeof(ToCppT)), |
337 | | typename FromCppT::NativeType, typename ToCppT::NativeType>>> |
338 | | requires(IsDecimalNumber<ToCppT> && IsDecimalNumber<FromCppT>) |
339 | | static inline bool _from_decimal_smaller_scale( |
340 | | const FromCppT& from, const UInt32 precision_from, const UInt32 scale_from, ToCppT& to, |
341 | | UInt32 precision_to, UInt32 scale_to, const MaxNativeType& scale_multiplier, |
342 | | const typename ToCppT::NativeType& min_result, |
343 | 9.19k | const typename ToCppT::NativeType& max_result, CastParameters& params) { |
344 | 9.19k | MaxNativeType res; |
345 | 9.19k | if constexpr (multiply_may_overflow) { |
346 | 5.30k | if constexpr (IsDecimal128V2<FromCppT>) { |
347 | 714 | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, |
348 | 714 | res)) { |
349 | 56 | if (params.is_strict) { |
350 | 12 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( |
351 | 12 | decimal_to_string(from.value(), scale_from), |
352 | 12 | fmt::format("decimal({}, {})", precision_from, scale_from), |
353 | 12 | precision_to, scale_to); |
354 | 12 | } |
355 | 56 | return false; |
356 | 658 | } else { |
357 | 658 | if (UNLIKELY(res > max_result || res < -max_result)) { |
358 | 160 | if (params.is_strict) { |
359 | 96 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( |
360 | 96 | decimal_to_string(from.value(), scale_from), |
361 | 96 | fmt::format("decimal({}, {})", precision_from, scale_from), |
362 | 96 | precision_to, scale_to); |
363 | 96 | } |
364 | 160 | return false; |
365 | 498 | } else { |
366 | 498 | to = ToCppT(res); |
367 | 498 | } |
368 | 658 | } |
369 | 4.59k | } else { |
370 | 4.59k | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, |
371 | 4.59k | res)) { |
372 | 718 | if (params.is_strict) { |
373 | 60 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( |
374 | 60 | decimal_to_string(from.value, scale_from), |
375 | 60 | fmt::format("decimal({}, {})", precision_from, scale_from), |
376 | 60 | precision_to, scale_to); |
377 | 60 | } |
378 | 718 | return false; |
379 | 3.87k | } else { |
380 | 3.87k | if (UNLIKELY(res > max_result || res < -max_result)) { |
381 | 1.77k | if (params.is_strict) { |
382 | 1.18k | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( |
383 | 1.18k | decimal_to_string(from.value, scale_from), |
384 | 1.18k | fmt::format("decimal({}, {})", precision_from, scale_from), |
385 | 1.18k | precision_to, scale_to); |
386 | 1.18k | } |
387 | 1.77k | return false; |
388 | 2.09k | } else { |
389 | 2.09k | to = ToCppT(res); |
390 | 2.09k | } |
391 | 3.87k | } |
392 | 4.59k | } |
393 | 5.30k | } else { |
394 | 3.89k | if constexpr (IsDecimal128V2<FromCppT>) { |
395 | 424 | res = from.value() * scale_multiplier; |
396 | 3.46k | } else { |
397 | 3.46k | res = from.value * scale_multiplier; |
398 | 3.46k | } |
399 | 3.89k | if constexpr (narrow_integral) { |
400 | 1.76k | if (UNLIKELY(res > max_result || res < -max_result)) { |
401 | 828 | if constexpr (IsDecimal128V2<FromCppT>) { |
402 | 120 | if (params.is_strict) { |
403 | 60 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( |
404 | 60 | decimal_to_string(from.value(), scale_from), |
405 | 60 | fmt::format("decimal({}, {})", precision_from, scale_from), |
406 | 60 | precision_to, scale_to); |
407 | 60 | } |
408 | 708 | } else { |
409 | 708 | if (params.is_strict) { |
410 | 354 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( |
411 | 354 | decimal_to_string(from.value, scale_from), |
412 | 354 | fmt::format("decimal({}, {})", precision_from, scale_from), |
413 | 354 | precision_to, scale_to); |
414 | 354 | } |
415 | 708 | } |
416 | 828 | return false; |
417 | 828 | } |
418 | 1.76k | } |
419 | 940 | to = ToCppT(res); |
420 | 3.89k | } |
421 | 2.59k | return true; |
422 | 9.19k | } _ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_7DecimalIiEES3_Lb0ELb0EiQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 343 | 28 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 344 | 28 | MaxNativeType res; | 345 | | if constexpr (multiply_may_overflow) { | 346 | | if constexpr (IsDecimal128V2<FromCppT>) { | 347 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 348 | | res)) { | 349 | | if (params.is_strict) { | 350 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 351 | | decimal_to_string(from.value(), scale_from), | 352 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 353 | | precision_to, scale_to); | 354 | | } | 355 | | return false; | 356 | | } else { | 357 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 358 | | if (params.is_strict) { | 359 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 360 | | decimal_to_string(from.value(), scale_from), | 361 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 362 | | precision_to, scale_to); | 363 | | } | 364 | | return false; | 365 | | } else { | 366 | | to = ToCppT(res); | 367 | | } | 368 | | } | 369 | | } else { | 370 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 371 | | res)) { | 372 | | if (params.is_strict) { | 373 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 374 | | decimal_to_string(from.value, scale_from), | 375 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 376 | | precision_to, scale_to); | 377 | | } | 378 | | return false; | 379 | | } else { | 380 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 381 | | if (params.is_strict) { | 382 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 383 | | decimal_to_string(from.value, scale_from), | 384 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 385 | | precision_to, scale_to); | 386 | | } | 387 | | return false; | 388 | | } else { | 389 | | to = ToCppT(res); | 390 | | } | 391 | | } | 392 | | } | 393 | 28 | } else { | 394 | | if constexpr (IsDecimal128V2<FromCppT>) { | 395 | | res = from.value() * scale_multiplier; | 396 | 28 | } else { | 397 | 28 | res = from.value * scale_multiplier; | 398 | 28 | } | 399 | | if constexpr (narrow_integral) { | 400 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 401 | | if constexpr (IsDecimal128V2<FromCppT>) { | 402 | | if (params.is_strict) { | 403 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 404 | | decimal_to_string(from.value(), scale_from), | 405 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 406 | | precision_to, scale_to); | 407 | | } | 408 | | } else { | 409 | | if (params.is_strict) { | 410 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 411 | | decimal_to_string(from.value, scale_from), | 412 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 413 | | precision_to, scale_to); | 414 | | } | 415 | | } | 416 | | return false; | 417 | | } | 418 | | } | 419 | 28 | to = ToCppT(res); | 420 | 28 | } | 421 | 28 | return true; | 422 | 28 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_7DecimalIiEES3_Lb0ELb1EiQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 343 | 14 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 344 | 14 | MaxNativeType res; | 345 | | if constexpr (multiply_may_overflow) { | 346 | | if constexpr (IsDecimal128V2<FromCppT>) { | 347 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 348 | | res)) { | 349 | | if (params.is_strict) { | 350 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 351 | | decimal_to_string(from.value(), scale_from), | 352 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 353 | | precision_to, scale_to); | 354 | | } | 355 | | return false; | 356 | | } else { | 357 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 358 | | if (params.is_strict) { | 359 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 360 | | decimal_to_string(from.value(), scale_from), | 361 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 362 | | precision_to, scale_to); | 363 | | } | 364 | | return false; | 365 | | } else { | 366 | | to = ToCppT(res); | 367 | | } | 368 | | } | 369 | | } else { | 370 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 371 | | res)) { | 372 | | if (params.is_strict) { | 373 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 374 | | decimal_to_string(from.value, scale_from), | 375 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 376 | | precision_to, scale_to); | 377 | | } | 378 | | return false; | 379 | | } else { | 380 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 381 | | if (params.is_strict) { | 382 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 383 | | decimal_to_string(from.value, scale_from), | 384 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 385 | | precision_to, scale_to); | 386 | | } | 387 | | return false; | 388 | | } else { | 389 | | to = ToCppT(res); | 390 | | } | 391 | | } | 392 | | } | 393 | 14 | } else { | 394 | | if constexpr (IsDecimal128V2<FromCppT>) { | 395 | | res = from.value() * scale_multiplier; | 396 | 14 | } else { | 397 | 14 | res = from.value * scale_multiplier; | 398 | 14 | } | 399 | 14 | if constexpr (narrow_integral) { | 400 | 14 | if (UNLIKELY(res > max_result || res < -max_result)) { | 401 | | if constexpr (IsDecimal128V2<FromCppT>) { | 402 | | if (params.is_strict) { | 403 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 404 | | decimal_to_string(from.value(), scale_from), | 405 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 406 | | precision_to, scale_to); | 407 | | } | 408 | 12 | } else { | 409 | 12 | if (params.is_strict) { | 410 | 6 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 411 | 6 | decimal_to_string(from.value, scale_from), | 412 | 6 | fmt::format("decimal({}, {})", precision_from, scale_from), | 413 | 6 | precision_to, scale_to); | 414 | 6 | } | 415 | 12 | } | 416 | 12 | return false; | 417 | 12 | } | 418 | 14 | } | 419 | 2 | to = ToCppT(res); | 420 | 14 | } | 421 | 0 | return true; | 422 | 14 | } |
Unexecuted instantiation: _ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_7DecimalIiEES3_Lb1ELb0EiQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE _ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_7DecimalIiEES3_Lb1ELb1EiQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 343 | 168 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 344 | 168 | MaxNativeType res; | 345 | 168 | if constexpr (multiply_may_overflow) { | 346 | | if constexpr (IsDecimal128V2<FromCppT>) { | 347 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 348 | | res)) { | 349 | | if (params.is_strict) { | 350 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 351 | | decimal_to_string(from.value(), scale_from), | 352 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 353 | | precision_to, scale_to); | 354 | | } | 355 | | return false; | 356 | | } else { | 357 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 358 | | if (params.is_strict) { | 359 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 360 | | decimal_to_string(from.value(), scale_from), | 361 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 362 | | precision_to, scale_to); | 363 | | } | 364 | | return false; | 365 | | } else { | 366 | | to = ToCppT(res); | 367 | | } | 368 | | } | 369 | 168 | } else { | 370 | 168 | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 371 | 168 | res)) { | 372 | 32 | if (params.is_strict) { | 373 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 374 | 0 | decimal_to_string(from.value, scale_from), | 375 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 376 | 0 | precision_to, scale_to); | 377 | 0 | } | 378 | 32 | return false; | 379 | 136 | } else { | 380 | 136 | if (UNLIKELY(res > max_result || res < -max_result)) { | 381 | 64 | if (params.is_strict) { | 382 | 48 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 383 | 48 | decimal_to_string(from.value, scale_from), | 384 | 48 | fmt::format("decimal({}, {})", precision_from, scale_from), | 385 | 48 | precision_to, scale_to); | 386 | 48 | } | 387 | 64 | return false; | 388 | 72 | } else { | 389 | 72 | to = ToCppT(res); | 390 | 72 | } | 391 | 136 | } | 392 | 168 | } | 393 | | } else { | 394 | | if constexpr (IsDecimal128V2<FromCppT>) { | 395 | | res = from.value() * scale_multiplier; | 396 | | } else { | 397 | | res = from.value * scale_multiplier; | 398 | | } | 399 | | if constexpr (narrow_integral) { | 400 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 401 | | if constexpr (IsDecimal128V2<FromCppT>) { | 402 | | if (params.is_strict) { | 403 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 404 | | decimal_to_string(from.value(), scale_from), | 405 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 406 | | precision_to, scale_to); | 407 | | } | 408 | | } else { | 409 | | if (params.is_strict) { | 410 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 411 | | decimal_to_string(from.value, scale_from), | 412 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 413 | | precision_to, scale_to); | 414 | | } | 415 | | } | 416 | | return false; | 417 | | } | 418 | | } | 419 | | to = ToCppT(res); | 420 | | } | 421 | 72 | return true; | 422 | 168 | } |
Unexecuted instantiation: _ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_7DecimalIlEENS2_IiEELb0ELb0ElQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKT3_RKNS5_10NativeTypeESF_RNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_7DecimalIlEENS2_IiEELb0ELb1ElQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKT3_RKNS5_10NativeTypeESF_RNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_7DecimalIlEENS2_IiEELb1ELb0ElQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKT3_RKNS5_10NativeTypeESF_RNS_14CastParametersE _ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_7DecimalIlEENS2_IiEELb1ELb1ElQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKT3_RKNS5_10NativeTypeESF_RNS_14CastParametersE Line | Count | Source | 343 | 252 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 344 | 252 | MaxNativeType res; | 345 | 252 | if constexpr (multiply_may_overflow) { | 346 | | if constexpr (IsDecimal128V2<FromCppT>) { | 347 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 348 | | res)) { | 349 | | if (params.is_strict) { | 350 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 351 | | decimal_to_string(from.value(), scale_from), | 352 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 353 | | precision_to, scale_to); | 354 | | } | 355 | | return false; | 356 | | } else { | 357 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 358 | | if (params.is_strict) { | 359 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 360 | | decimal_to_string(from.value(), scale_from), | 361 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 362 | | precision_to, scale_to); | 363 | | } | 364 | | return false; | 365 | | } else { | 366 | | to = ToCppT(res); | 367 | | } | 368 | | } | 369 | 252 | } else { | 370 | 252 | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 371 | 252 | res)) { | 372 | 28 | if (params.is_strict) { | 373 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 374 | 0 | decimal_to_string(from.value, scale_from), | 375 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 376 | 0 | precision_to, scale_to); | 377 | 0 | } | 378 | 28 | return false; | 379 | 224 | } else { | 380 | 224 | if (UNLIKELY(res > max_result || res < -max_result)) { | 381 | 116 | if (params.is_strict) { | 382 | 72 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 383 | 72 | decimal_to_string(from.value, scale_from), | 384 | 72 | fmt::format("decimal({}, {})", precision_from, scale_from), | 385 | 72 | precision_to, scale_to); | 386 | 72 | } | 387 | 116 | return false; | 388 | 116 | } else { | 389 | 108 | to = ToCppT(res); | 390 | 108 | } | 391 | 224 | } | 392 | 252 | } | 393 | | } else { | 394 | | if constexpr (IsDecimal128V2<FromCppT>) { | 395 | | res = from.value() * scale_multiplier; | 396 | | } else { | 397 | | res = from.value * scale_multiplier; | 398 | | } | 399 | | if constexpr (narrow_integral) { | 400 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 401 | | if constexpr (IsDecimal128V2<FromCppT>) { | 402 | | if (params.is_strict) { | 403 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 404 | | decimal_to_string(from.value(), scale_from), | 405 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 406 | | precision_to, scale_to); | 407 | | } | 408 | | } else { | 409 | | if (params.is_strict) { | 410 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 411 | | decimal_to_string(from.value, scale_from), | 412 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 413 | | precision_to, scale_to); | 414 | | } | 415 | | } | 416 | | return false; | 417 | | } | 418 | | } | 419 | | to = ToCppT(res); | 420 | | } | 421 | 108 | return true; | 422 | 252 | } |
Unexecuted instantiation: _ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_12Decimal128V3ENS_7DecimalIiEELb0ELb0EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKT3_RKNS5_10NativeTypeESF_RNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_12Decimal128V3ENS_7DecimalIiEELb0ELb1EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKT3_RKNS5_10NativeTypeESF_RNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_12Decimal128V3ENS_7DecimalIiEELb1ELb0EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKT3_RKNS5_10NativeTypeESF_RNS_14CastParametersE _ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_12Decimal128V3ENS_7DecimalIiEELb1ELb1EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKT3_RKNS5_10NativeTypeESF_RNS_14CastParametersE Line | Count | Source | 343 | 252 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 344 | 252 | MaxNativeType res; | 345 | 252 | if constexpr (multiply_may_overflow) { | 346 | | if constexpr (IsDecimal128V2<FromCppT>) { | 347 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 348 | | res)) { | 349 | | if (params.is_strict) { | 350 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 351 | | decimal_to_string(from.value(), scale_from), | 352 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 353 | | precision_to, scale_to); | 354 | | } | 355 | | return false; | 356 | | } else { | 357 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 358 | | if (params.is_strict) { | 359 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 360 | | decimal_to_string(from.value(), scale_from), | 361 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 362 | | precision_to, scale_to); | 363 | | } | 364 | | return false; | 365 | | } else { | 366 | | to = ToCppT(res); | 367 | | } | 368 | | } | 369 | 252 | } else { | 370 | 252 | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 371 | 252 | res)) { | 372 | 24 | if (params.is_strict) { | 373 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 374 | 0 | decimal_to_string(from.value, scale_from), | 375 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 376 | 0 | precision_to, scale_to); | 377 | 0 | } | 378 | 24 | return false; | 379 | 228 | } else { | 380 | 228 | if (UNLIKELY(res > max_result || res < -max_result)) { | 381 | 120 | if (params.is_strict) { | 382 | 72 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 383 | 72 | decimal_to_string(from.value, scale_from), | 384 | 72 | fmt::format("decimal({}, {})", precision_from, scale_from), | 385 | 72 | precision_to, scale_to); | 386 | 72 | } | 387 | 120 | return false; | 388 | 120 | } else { | 389 | 108 | to = ToCppT(res); | 390 | 108 | } | 391 | 228 | } | 392 | 252 | } | 393 | | } else { | 394 | | if constexpr (IsDecimal128V2<FromCppT>) { | 395 | | res = from.value() * scale_multiplier; | 396 | | } else { | 397 | | res = from.value * scale_multiplier; | 398 | | } | 399 | | if constexpr (narrow_integral) { | 400 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 401 | | if constexpr (IsDecimal128V2<FromCppT>) { | 402 | | if (params.is_strict) { | 403 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 404 | | decimal_to_string(from.value(), scale_from), | 405 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 406 | | precision_to, scale_to); | 407 | | } | 408 | | } else { | 409 | | if (params.is_strict) { | 410 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 411 | | decimal_to_string(from.value, scale_from), | 412 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 413 | | precision_to, scale_to); | 414 | | } | 415 | | } | 416 | | return false; | 417 | | } | 418 | | } | 419 | | to = ToCppT(res); | 420 | | } | 421 | 108 | return true; | 422 | 252 | } |
Unexecuted instantiation: _ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_7DecimalIN4wide7integerILm256EiEEEENS2_IiEELb0ELb0ES5_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKT3_RKNS8_10NativeTypeESI_RNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_7DecimalIN4wide7integerILm256EiEEEENS2_IiEELb0ELb1ES5_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKT3_RKNS8_10NativeTypeESI_RNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_7DecimalIN4wide7integerILm256EiEEEENS2_IiEELb1ELb0ES5_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKT3_RKNS8_10NativeTypeESI_RNS_14CastParametersE _ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_7DecimalIN4wide7integerILm256EiEEEENS2_IiEELb1ELb1ES5_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKT3_RKNS8_10NativeTypeESI_RNS_14CastParametersE Line | Count | Source | 343 | 252 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 344 | 252 | MaxNativeType res; | 345 | 252 | if constexpr (multiply_may_overflow) { | 346 | | if constexpr (IsDecimal128V2<FromCppT>) { | 347 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 348 | | res)) { | 349 | | if (params.is_strict) { | 350 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 351 | | decimal_to_string(from.value(), scale_from), | 352 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 353 | | precision_to, scale_to); | 354 | | } | 355 | | return false; | 356 | | } else { | 357 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 358 | | if (params.is_strict) { | 359 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 360 | | decimal_to_string(from.value(), scale_from), | 361 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 362 | | precision_to, scale_to); | 363 | | } | 364 | | return false; | 365 | | } else { | 366 | | to = ToCppT(res); | 367 | | } | 368 | | } | 369 | 252 | } else { | 370 | 252 | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 371 | 252 | res)) { | 372 | 24 | if (params.is_strict) { | 373 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 374 | 0 | decimal_to_string(from.value, scale_from), | 375 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 376 | 0 | precision_to, scale_to); | 377 | 0 | } | 378 | 24 | return false; | 379 | 228 | } else { | 380 | 228 | if (UNLIKELY(res > max_result || res < -max_result)) { | 381 | 120 | if (params.is_strict) { | 382 | 72 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 383 | 72 | decimal_to_string(from.value, scale_from), | 384 | 72 | fmt::format("decimal({}, {})", precision_from, scale_from), | 385 | 72 | precision_to, scale_to); | 386 | 72 | } | 387 | 120 | return false; | 388 | 120 | } else { | 389 | 108 | to = ToCppT(res); | 390 | 108 | } | 391 | 228 | } | 392 | 252 | } | 393 | | } else { | 394 | | if constexpr (IsDecimal128V2<FromCppT>) { | 395 | | res = from.value() * scale_multiplier; | 396 | | } else { | 397 | | res = from.value * scale_multiplier; | 398 | | } | 399 | | if constexpr (narrow_integral) { | 400 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 401 | | if constexpr (IsDecimal128V2<FromCppT>) { | 402 | | if (params.is_strict) { | 403 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 404 | | decimal_to_string(from.value(), scale_from), | 405 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 406 | | precision_to, scale_to); | 407 | | } | 408 | | } else { | 409 | | if (params.is_strict) { | 410 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 411 | | decimal_to_string(from.value, scale_from), | 412 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 413 | | precision_to, scale_to); | 414 | | } | 415 | | } | 416 | | return false; | 417 | | } | 418 | | } | 419 | | to = ToCppT(res); | 420 | | } | 421 | 108 | return true; | 422 | 252 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_7DecimalIiEENS2_IlEELb0ELb0ElQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKT3_RKNS5_10NativeTypeESF_RNS_14CastParametersE Line | Count | Source | 343 | 224 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 344 | 224 | MaxNativeType res; | 345 | | if constexpr (multiply_may_overflow) { | 346 | | if constexpr (IsDecimal128V2<FromCppT>) { | 347 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 348 | | res)) { | 349 | | if (params.is_strict) { | 350 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 351 | | decimal_to_string(from.value(), scale_from), | 352 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 353 | | precision_to, scale_to); | 354 | | } | 355 | | return false; | 356 | | } else { | 357 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 358 | | if (params.is_strict) { | 359 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 360 | | decimal_to_string(from.value(), scale_from), | 361 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 362 | | precision_to, scale_to); | 363 | | } | 364 | | return false; | 365 | | } else { | 366 | | to = ToCppT(res); | 367 | | } | 368 | | } | 369 | | } else { | 370 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 371 | | res)) { | 372 | | if (params.is_strict) { | 373 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 374 | | decimal_to_string(from.value, scale_from), | 375 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 376 | | precision_to, scale_to); | 377 | | } | 378 | | return false; | 379 | | } else { | 380 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 381 | | if (params.is_strict) { | 382 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 383 | | decimal_to_string(from.value, scale_from), | 384 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 385 | | precision_to, scale_to); | 386 | | } | 387 | | return false; | 388 | | } else { | 389 | | to = ToCppT(res); | 390 | | } | 391 | | } | 392 | | } | 393 | 224 | } else { | 394 | | if constexpr (IsDecimal128V2<FromCppT>) { | 395 | | res = from.value() * scale_multiplier; | 396 | 224 | } else { | 397 | 224 | res = from.value * scale_multiplier; | 398 | 224 | } | 399 | | if constexpr (narrow_integral) { | 400 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 401 | | if constexpr (IsDecimal128V2<FromCppT>) { | 402 | | if (params.is_strict) { | 403 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 404 | | decimal_to_string(from.value(), scale_from), | 405 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 406 | | precision_to, scale_to); | 407 | | } | 408 | | } else { | 409 | | if (params.is_strict) { | 410 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 411 | | decimal_to_string(from.value, scale_from), | 412 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 413 | | precision_to, scale_to); | 414 | | } | 415 | | } | 416 | | return false; | 417 | | } | 418 | | } | 419 | 224 | to = ToCppT(res); | 420 | 224 | } | 421 | 224 | return true; | 422 | 224 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_7DecimalIiEENS2_IlEELb0ELb1ElQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKT3_RKNS5_10NativeTypeESF_RNS_14CastParametersE Line | Count | Source | 343 | 116 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 344 | 116 | MaxNativeType res; | 345 | | if constexpr (multiply_may_overflow) { | 346 | | if constexpr (IsDecimal128V2<FromCppT>) { | 347 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 348 | | res)) { | 349 | | if (params.is_strict) { | 350 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 351 | | decimal_to_string(from.value(), scale_from), | 352 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 353 | | precision_to, scale_to); | 354 | | } | 355 | | return false; | 356 | | } else { | 357 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 358 | | if (params.is_strict) { | 359 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 360 | | decimal_to_string(from.value(), scale_from), | 361 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 362 | | precision_to, scale_to); | 363 | | } | 364 | | return false; | 365 | | } else { | 366 | | to = ToCppT(res); | 367 | | } | 368 | | } | 369 | | } else { | 370 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 371 | | res)) { | 372 | | if (params.is_strict) { | 373 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 374 | | decimal_to_string(from.value, scale_from), | 375 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 376 | | precision_to, scale_to); | 377 | | } | 378 | | return false; | 379 | | } else { | 380 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 381 | | if (params.is_strict) { | 382 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 383 | | decimal_to_string(from.value, scale_from), | 384 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 385 | | precision_to, scale_to); | 386 | | } | 387 | | return false; | 388 | | } else { | 389 | | to = ToCppT(res); | 390 | | } | 391 | | } | 392 | | } | 393 | 116 | } else { | 394 | | if constexpr (IsDecimal128V2<FromCppT>) { | 395 | | res = from.value() * scale_multiplier; | 396 | 116 | } else { | 397 | 116 | res = from.value * scale_multiplier; | 398 | 116 | } | 399 | 116 | if constexpr (narrow_integral) { | 400 | 116 | if (UNLIKELY(res > max_result || res < -max_result)) { | 401 | | if constexpr (IsDecimal128V2<FromCppT>) { | 402 | | if (params.is_strict) { | 403 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 404 | | decimal_to_string(from.value(), scale_from), | 405 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 406 | | precision_to, scale_to); | 407 | | } | 408 | 60 | } else { | 409 | 60 | if (params.is_strict) { | 410 | 30 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 411 | 30 | decimal_to_string(from.value, scale_from), | 412 | 30 | fmt::format("decimal({}, {})", precision_from, scale_from), | 413 | 30 | precision_to, scale_to); | 414 | 30 | } | 415 | 60 | } | 416 | 60 | return false; | 417 | 60 | } | 418 | 116 | } | 419 | 56 | to = ToCppT(res); | 420 | 116 | } | 421 | 0 | return true; | 422 | 116 | } |
Unexecuted instantiation: _ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_7DecimalIiEENS2_IlEELb1ELb0ElQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKT3_RKNS5_10NativeTypeESF_RNS_14CastParametersE _ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_7DecimalIiEENS2_IlEELb1ELb1ElQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKT3_RKNS5_10NativeTypeESF_RNS_14CastParametersE Line | Count | Source | 343 | 144 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 344 | 144 | MaxNativeType res; | 345 | 144 | if constexpr (multiply_may_overflow) { | 346 | | if constexpr (IsDecimal128V2<FromCppT>) { | 347 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 348 | | res)) { | 349 | | if (params.is_strict) { | 350 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 351 | | decimal_to_string(from.value(), scale_from), | 352 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 353 | | precision_to, scale_to); | 354 | | } | 355 | | return false; | 356 | | } else { | 357 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 358 | | if (params.is_strict) { | 359 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 360 | | decimal_to_string(from.value(), scale_from), | 361 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 362 | | precision_to, scale_to); | 363 | | } | 364 | | return false; | 365 | | } else { | 366 | | to = ToCppT(res); | 367 | | } | 368 | | } | 369 | 144 | } else { | 370 | 144 | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 371 | 144 | res)) { | 372 | 22 | if (params.is_strict) { | 373 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 374 | 0 | decimal_to_string(from.value, scale_from), | 375 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 376 | 0 | precision_to, scale_to); | 377 | 0 | } | 378 | 22 | return false; | 379 | 122 | } else { | 380 | 122 | if (UNLIKELY(res > max_result || res < -max_result)) { | 381 | 62 | if (params.is_strict) { | 382 | 42 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 383 | 42 | decimal_to_string(from.value, scale_from), | 384 | 42 | fmt::format("decimal({}, {})", precision_from, scale_from), | 385 | 42 | precision_to, scale_to); | 386 | 42 | } | 387 | 62 | return false; | 388 | 62 | } else { | 389 | 60 | to = ToCppT(res); | 390 | 60 | } | 391 | 122 | } | 392 | 144 | } | 393 | | } else { | 394 | | if constexpr (IsDecimal128V2<FromCppT>) { | 395 | | res = from.value() * scale_multiplier; | 396 | | } else { | 397 | | res = from.value * scale_multiplier; | 398 | | } | 399 | | if constexpr (narrow_integral) { | 400 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 401 | | if constexpr (IsDecimal128V2<FromCppT>) { | 402 | | if (params.is_strict) { | 403 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 404 | | decimal_to_string(from.value(), scale_from), | 405 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 406 | | precision_to, scale_to); | 407 | | } | 408 | | } else { | 409 | | if (params.is_strict) { | 410 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 411 | | decimal_to_string(from.value, scale_from), | 412 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 413 | | precision_to, scale_to); | 414 | | } | 415 | | } | 416 | | return false; | 417 | | } | 418 | | } | 419 | | to = ToCppT(res); | 420 | | } | 421 | 60 | return true; | 422 | 144 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_7DecimalIlEES3_Lb0ELb0ElQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 343 | 92 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 344 | 92 | MaxNativeType res; | 345 | | if constexpr (multiply_may_overflow) { | 346 | | if constexpr (IsDecimal128V2<FromCppT>) { | 347 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 348 | | res)) { | 349 | | if (params.is_strict) { | 350 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 351 | | decimal_to_string(from.value(), scale_from), | 352 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 353 | | precision_to, scale_to); | 354 | | } | 355 | | return false; | 356 | | } else { | 357 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 358 | | if (params.is_strict) { | 359 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 360 | | decimal_to_string(from.value(), scale_from), | 361 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 362 | | precision_to, scale_to); | 363 | | } | 364 | | return false; | 365 | | } else { | 366 | | to = ToCppT(res); | 367 | | } | 368 | | } | 369 | | } else { | 370 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 371 | | res)) { | 372 | | if (params.is_strict) { | 373 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 374 | | decimal_to_string(from.value, scale_from), | 375 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 376 | | precision_to, scale_to); | 377 | | } | 378 | | return false; | 379 | | } else { | 380 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 381 | | if (params.is_strict) { | 382 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 383 | | decimal_to_string(from.value, scale_from), | 384 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 385 | | precision_to, scale_to); | 386 | | } | 387 | | return false; | 388 | | } else { | 389 | | to = ToCppT(res); | 390 | | } | 391 | | } | 392 | | } | 393 | 92 | } else { | 394 | | if constexpr (IsDecimal128V2<FromCppT>) { | 395 | | res = from.value() * scale_multiplier; | 396 | 92 | } else { | 397 | 92 | res = from.value * scale_multiplier; | 398 | 92 | } | 399 | | if constexpr (narrow_integral) { | 400 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 401 | | if constexpr (IsDecimal128V2<FromCppT>) { | 402 | | if (params.is_strict) { | 403 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 404 | | decimal_to_string(from.value(), scale_from), | 405 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 406 | | precision_to, scale_to); | 407 | | } | 408 | | } else { | 409 | | if (params.is_strict) { | 410 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 411 | | decimal_to_string(from.value, scale_from), | 412 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 413 | | precision_to, scale_to); | 414 | | } | 415 | | } | 416 | | return false; | 417 | | } | 418 | | } | 419 | 92 | to = ToCppT(res); | 420 | 92 | } | 421 | 92 | return true; | 422 | 92 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_7DecimalIlEES3_Lb0ELb1ElQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 343 | 88 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 344 | 88 | MaxNativeType res; | 345 | | if constexpr (multiply_may_overflow) { | 346 | | if constexpr (IsDecimal128V2<FromCppT>) { | 347 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 348 | | res)) { | 349 | | if (params.is_strict) { | 350 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 351 | | decimal_to_string(from.value(), scale_from), | 352 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 353 | | precision_to, scale_to); | 354 | | } | 355 | | return false; | 356 | | } else { | 357 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 358 | | if (params.is_strict) { | 359 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 360 | | decimal_to_string(from.value(), scale_from), | 361 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 362 | | precision_to, scale_to); | 363 | | } | 364 | | return false; | 365 | | } else { | 366 | | to = ToCppT(res); | 367 | | } | 368 | | } | 369 | | } else { | 370 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 371 | | res)) { | 372 | | if (params.is_strict) { | 373 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 374 | | decimal_to_string(from.value, scale_from), | 375 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 376 | | precision_to, scale_to); | 377 | | } | 378 | | return false; | 379 | | } else { | 380 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 381 | | if (params.is_strict) { | 382 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 383 | | decimal_to_string(from.value, scale_from), | 384 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 385 | | precision_to, scale_to); | 386 | | } | 387 | | return false; | 388 | | } else { | 389 | | to = ToCppT(res); | 390 | | } | 391 | | } | 392 | | } | 393 | 88 | } else { | 394 | | if constexpr (IsDecimal128V2<FromCppT>) { | 395 | | res = from.value() * scale_multiplier; | 396 | 88 | } else { | 397 | 88 | res = from.value * scale_multiplier; | 398 | 88 | } | 399 | 88 | if constexpr (narrow_integral) { | 400 | 88 | if (UNLIKELY(res > max_result || res < -max_result)) { | 401 | | if constexpr (IsDecimal128V2<FromCppT>) { | 402 | | if (params.is_strict) { | 403 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 404 | | decimal_to_string(from.value(), scale_from), | 405 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 406 | | precision_to, scale_to); | 407 | | } | 408 | 36 | } else { | 409 | 36 | if (params.is_strict) { | 410 | 18 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 411 | 18 | decimal_to_string(from.value, scale_from), | 412 | 18 | fmt::format("decimal({}, {})", precision_from, scale_from), | 413 | 18 | precision_to, scale_to); | 414 | 18 | } | 415 | 36 | } | 416 | 36 | return false; | 417 | 36 | } | 418 | 88 | } | 419 | 52 | to = ToCppT(res); | 420 | 88 | } | 421 | 0 | return true; | 422 | 88 | } |
Unexecuted instantiation: _ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_7DecimalIlEES3_Lb1ELb0ElQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE _ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_7DecimalIlEES3_Lb1ELb1ElQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 343 | 420 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 344 | 420 | MaxNativeType res; | 345 | 420 | if constexpr (multiply_may_overflow) { | 346 | | if constexpr (IsDecimal128V2<FromCppT>) { | 347 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 348 | | res)) { | 349 | | if (params.is_strict) { | 350 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 351 | | decimal_to_string(from.value(), scale_from), | 352 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 353 | | precision_to, scale_to); | 354 | | } | 355 | | return false; | 356 | | } else { | 357 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 358 | | if (params.is_strict) { | 359 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 360 | | decimal_to_string(from.value(), scale_from), | 361 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 362 | | precision_to, scale_to); | 363 | | } | 364 | | return false; | 365 | | } else { | 366 | | to = ToCppT(res); | 367 | | } | 368 | | } | 369 | 420 | } else { | 370 | 420 | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 371 | 420 | res)) { | 372 | 72 | if (params.is_strict) { | 373 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 374 | 0 | decimal_to_string(from.value, scale_from), | 375 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 376 | 0 | precision_to, scale_to); | 377 | 0 | } | 378 | 72 | return false; | 379 | 348 | } else { | 380 | 348 | if (UNLIKELY(res > max_result || res < -max_result)) { | 381 | 156 | if (params.is_strict) { | 382 | 114 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 383 | 114 | decimal_to_string(from.value, scale_from), | 384 | 114 | fmt::format("decimal({}, {})", precision_from, scale_from), | 385 | 114 | precision_to, scale_to); | 386 | 114 | } | 387 | 156 | return false; | 388 | 192 | } else { | 389 | 192 | to = ToCppT(res); | 390 | 192 | } | 391 | 348 | } | 392 | 420 | } | 393 | | } else { | 394 | | if constexpr (IsDecimal128V2<FromCppT>) { | 395 | | res = from.value() * scale_multiplier; | 396 | | } else { | 397 | | res = from.value * scale_multiplier; | 398 | | } | 399 | | if constexpr (narrow_integral) { | 400 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 401 | | if constexpr (IsDecimal128V2<FromCppT>) { | 402 | | if (params.is_strict) { | 403 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 404 | | decimal_to_string(from.value(), scale_from), | 405 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 406 | | precision_to, scale_to); | 407 | | } | 408 | | } else { | 409 | | if (params.is_strict) { | 410 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 411 | | decimal_to_string(from.value, scale_from), | 412 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 413 | | precision_to, scale_to); | 414 | | } | 415 | | } | 416 | | return false; | 417 | | } | 418 | | } | 419 | | to = ToCppT(res); | 420 | | } | 421 | 192 | return true; | 422 | 420 | } |
Unexecuted instantiation: _ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_12Decimal128V3ENS_7DecimalIlEELb0ELb0EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKT3_RKNS5_10NativeTypeESF_RNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_12Decimal128V3ENS_7DecimalIlEELb0ELb1EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKT3_RKNS5_10NativeTypeESF_RNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_12Decimal128V3ENS_7DecimalIlEELb1ELb0EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKT3_RKNS5_10NativeTypeESF_RNS_14CastParametersE _ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_12Decimal128V3ENS_7DecimalIlEELb1ELb1EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKT3_RKNS5_10NativeTypeESF_RNS_14CastParametersE Line | Count | Source | 343 | 448 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 344 | 448 | MaxNativeType res; | 345 | 448 | if constexpr (multiply_may_overflow) { | 346 | | if constexpr (IsDecimal128V2<FromCppT>) { | 347 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 348 | | res)) { | 349 | | if (params.is_strict) { | 350 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 351 | | decimal_to_string(from.value(), scale_from), | 352 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 353 | | precision_to, scale_to); | 354 | | } | 355 | | return false; | 356 | | } else { | 357 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 358 | | if (params.is_strict) { | 359 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 360 | | decimal_to_string(from.value(), scale_from), | 361 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 362 | | precision_to, scale_to); | 363 | | } | 364 | | return false; | 365 | | } else { | 366 | | to = ToCppT(res); | 367 | | } | 368 | | } | 369 | 448 | } else { | 370 | 448 | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 371 | 448 | res)) { | 372 | 40 | if (params.is_strict) { | 373 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 374 | 0 | decimal_to_string(from.value, scale_from), | 375 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 376 | 0 | precision_to, scale_to); | 377 | 0 | } | 378 | 40 | return false; | 379 | 408 | } else { | 380 | 408 | if (UNLIKELY(res > max_result || res < -max_result)) { | 381 | 200 | if (params.is_strict) { | 382 | 120 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 383 | 120 | decimal_to_string(from.value, scale_from), | 384 | 120 | fmt::format("decimal({}, {})", precision_from, scale_from), | 385 | 120 | precision_to, scale_to); | 386 | 120 | } | 387 | 200 | return false; | 388 | 208 | } else { | 389 | 208 | to = ToCppT(res); | 390 | 208 | } | 391 | 408 | } | 392 | 448 | } | 393 | | } else { | 394 | | if constexpr (IsDecimal128V2<FromCppT>) { | 395 | | res = from.value() * scale_multiplier; | 396 | | } else { | 397 | | res = from.value * scale_multiplier; | 398 | | } | 399 | | if constexpr (narrow_integral) { | 400 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 401 | | if constexpr (IsDecimal128V2<FromCppT>) { | 402 | | if (params.is_strict) { | 403 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 404 | | decimal_to_string(from.value(), scale_from), | 405 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 406 | | precision_to, scale_to); | 407 | | } | 408 | | } else { | 409 | | if (params.is_strict) { | 410 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 411 | | decimal_to_string(from.value, scale_from), | 412 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 413 | | precision_to, scale_to); | 414 | | } | 415 | | } | 416 | | return false; | 417 | | } | 418 | | } | 419 | | to = ToCppT(res); | 420 | | } | 421 | 208 | return true; | 422 | 448 | } |
Unexecuted instantiation: _ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_7DecimalIN4wide7integerILm256EiEEEENS2_IlEELb0ELb0ES5_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKT3_RKNS8_10NativeTypeESI_RNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_7DecimalIN4wide7integerILm256EiEEEENS2_IlEELb0ELb1ES5_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKT3_RKNS8_10NativeTypeESI_RNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_7DecimalIN4wide7integerILm256EiEEEENS2_IlEELb1ELb0ES5_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKT3_RKNS8_10NativeTypeESI_RNS_14CastParametersE _ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_7DecimalIN4wide7integerILm256EiEEEENS2_IlEELb1ELb1ES5_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKT3_RKNS8_10NativeTypeESI_RNS_14CastParametersE Line | Count | Source | 343 | 448 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 344 | 448 | MaxNativeType res; | 345 | 448 | if constexpr (multiply_may_overflow) { | 346 | | if constexpr (IsDecimal128V2<FromCppT>) { | 347 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 348 | | res)) { | 349 | | if (params.is_strict) { | 350 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 351 | | decimal_to_string(from.value(), scale_from), | 352 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 353 | | precision_to, scale_to); | 354 | | } | 355 | | return false; | 356 | | } else { | 357 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 358 | | if (params.is_strict) { | 359 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 360 | | decimal_to_string(from.value(), scale_from), | 361 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 362 | | precision_to, scale_to); | 363 | | } | 364 | | return false; | 365 | | } else { | 366 | | to = ToCppT(res); | 367 | | } | 368 | | } | 369 | 448 | } else { | 370 | 448 | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 371 | 448 | res)) { | 372 | 40 | if (params.is_strict) { | 373 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 374 | 0 | decimal_to_string(from.value, scale_from), | 375 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 376 | 0 | precision_to, scale_to); | 377 | 0 | } | 378 | 40 | return false; | 379 | 408 | } else { | 380 | 408 | if (UNLIKELY(res > max_result || res < -max_result)) { | 381 | 200 | if (params.is_strict) { | 382 | 120 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 383 | 120 | decimal_to_string(from.value, scale_from), | 384 | 120 | fmt::format("decimal({}, {})", precision_from, scale_from), | 385 | 120 | precision_to, scale_to); | 386 | 120 | } | 387 | 200 | return false; | 388 | 208 | } else { | 389 | 208 | to = ToCppT(res); | 390 | 208 | } | 391 | 408 | } | 392 | 448 | } | 393 | | } else { | 394 | | if constexpr (IsDecimal128V2<FromCppT>) { | 395 | | res = from.value() * scale_multiplier; | 396 | | } else { | 397 | | res = from.value * scale_multiplier; | 398 | | } | 399 | | if constexpr (narrow_integral) { | 400 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 401 | | if constexpr (IsDecimal128V2<FromCppT>) { | 402 | | if (params.is_strict) { | 403 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 404 | | decimal_to_string(from.value(), scale_from), | 405 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 406 | | precision_to, scale_to); | 407 | | } | 408 | | } else { | 409 | | if (params.is_strict) { | 410 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 411 | | decimal_to_string(from.value, scale_from), | 412 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 413 | | precision_to, scale_to); | 414 | | } | 415 | | } | 416 | | return false; | 417 | | } | 418 | | } | 419 | | to = ToCppT(res); | 420 | | } | 421 | 208 | return true; | 422 | 448 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_7DecimalIiEENS_12Decimal128V3ELb0ELb0EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKT3_RKNS5_10NativeTypeESF_RNS_14CastParametersE Line | Count | Source | 343 | 240 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 344 | 240 | MaxNativeType res; | 345 | | if constexpr (multiply_may_overflow) { | 346 | | if constexpr (IsDecimal128V2<FromCppT>) { | 347 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 348 | | res)) { | 349 | | if (params.is_strict) { | 350 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 351 | | decimal_to_string(from.value(), scale_from), | 352 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 353 | | precision_to, scale_to); | 354 | | } | 355 | | return false; | 356 | | } else { | 357 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 358 | | if (params.is_strict) { | 359 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 360 | | decimal_to_string(from.value(), scale_from), | 361 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 362 | | precision_to, scale_to); | 363 | | } | 364 | | return false; | 365 | | } else { | 366 | | to = ToCppT(res); | 367 | | } | 368 | | } | 369 | | } else { | 370 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 371 | | res)) { | 372 | | if (params.is_strict) { | 373 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 374 | | decimal_to_string(from.value, scale_from), | 375 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 376 | | precision_to, scale_to); | 377 | | } | 378 | | return false; | 379 | | } else { | 380 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 381 | | if (params.is_strict) { | 382 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 383 | | decimal_to_string(from.value, scale_from), | 384 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 385 | | precision_to, scale_to); | 386 | | } | 387 | | return false; | 388 | | } else { | 389 | | to = ToCppT(res); | 390 | | } | 391 | | } | 392 | | } | 393 | 240 | } else { | 394 | | if constexpr (IsDecimal128V2<FromCppT>) { | 395 | | res = from.value() * scale_multiplier; | 396 | 240 | } else { | 397 | 240 | res = from.value * scale_multiplier; | 398 | 240 | } | 399 | | if constexpr (narrow_integral) { | 400 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 401 | | if constexpr (IsDecimal128V2<FromCppT>) { | 402 | | if (params.is_strict) { | 403 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 404 | | decimal_to_string(from.value(), scale_from), | 405 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 406 | | precision_to, scale_to); | 407 | | } | 408 | | } else { | 409 | | if (params.is_strict) { | 410 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 411 | | decimal_to_string(from.value, scale_from), | 412 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 413 | | precision_to, scale_to); | 414 | | } | 415 | | } | 416 | | return false; | 417 | | } | 418 | | } | 419 | 240 | to = ToCppT(res); | 420 | 240 | } | 421 | 240 | return true; | 422 | 240 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_7DecimalIiEENS_12Decimal128V3ELb0ELb1EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKT3_RKNS5_10NativeTypeESF_RNS_14CastParametersE Line | Count | Source | 343 | 130 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 344 | 130 | MaxNativeType res; | 345 | | if constexpr (multiply_may_overflow) { | 346 | | if constexpr (IsDecimal128V2<FromCppT>) { | 347 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 348 | | res)) { | 349 | | if (params.is_strict) { | 350 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 351 | | decimal_to_string(from.value(), scale_from), | 352 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 353 | | precision_to, scale_to); | 354 | | } | 355 | | return false; | 356 | | } else { | 357 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 358 | | if (params.is_strict) { | 359 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 360 | | decimal_to_string(from.value(), scale_from), | 361 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 362 | | precision_to, scale_to); | 363 | | } | 364 | | return false; | 365 | | } else { | 366 | | to = ToCppT(res); | 367 | | } | 368 | | } | 369 | | } else { | 370 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 371 | | res)) { | 372 | | if (params.is_strict) { | 373 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 374 | | decimal_to_string(from.value, scale_from), | 375 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 376 | | precision_to, scale_to); | 377 | | } | 378 | | return false; | 379 | | } else { | 380 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 381 | | if (params.is_strict) { | 382 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 383 | | decimal_to_string(from.value, scale_from), | 384 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 385 | | precision_to, scale_to); | 386 | | } | 387 | | return false; | 388 | | } else { | 389 | | to = ToCppT(res); | 390 | | } | 391 | | } | 392 | | } | 393 | 130 | } else { | 394 | | if constexpr (IsDecimal128V2<FromCppT>) { | 395 | | res = from.value() * scale_multiplier; | 396 | 130 | } else { | 397 | 130 | res = from.value * scale_multiplier; | 398 | 130 | } | 399 | 130 | if constexpr (narrow_integral) { | 400 | 130 | if (UNLIKELY(res > max_result || res < -max_result)) { | 401 | | if constexpr (IsDecimal128V2<FromCppT>) { | 402 | | if (params.is_strict) { | 403 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 404 | | decimal_to_string(from.value(), scale_from), | 405 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 406 | | precision_to, scale_to); | 407 | | } | 408 | 72 | } else { | 409 | 72 | if (params.is_strict) { | 410 | 36 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 411 | 36 | decimal_to_string(from.value, scale_from), | 412 | 36 | fmt::format("decimal({}, {})", precision_from, scale_from), | 413 | 36 | precision_to, scale_to); | 414 | 36 | } | 415 | 72 | } | 416 | 72 | return false; | 417 | 72 | } | 418 | 130 | } | 419 | 58 | to = ToCppT(res); | 420 | 130 | } | 421 | 0 | return true; | 422 | 130 | } |
Unexecuted instantiation: _ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_7DecimalIiEENS_12Decimal128V3ELb1ELb0EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKT3_RKNS5_10NativeTypeESF_RNS_14CastParametersE _ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_7DecimalIiEENS_12Decimal128V3ELb1ELb1EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKT3_RKNS5_10NativeTypeESF_RNS_14CastParametersE Line | Count | Source | 343 | 130 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 344 | 130 | MaxNativeType res; | 345 | 130 | if constexpr (multiply_may_overflow) { | 346 | | if constexpr (IsDecimal128V2<FromCppT>) { | 347 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 348 | | res)) { | 349 | | if (params.is_strict) { | 350 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 351 | | decimal_to_string(from.value(), scale_from), | 352 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 353 | | precision_to, scale_to); | 354 | | } | 355 | | return false; | 356 | | } else { | 357 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 358 | | if (params.is_strict) { | 359 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 360 | | decimal_to_string(from.value(), scale_from), | 361 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 362 | | precision_to, scale_to); | 363 | | } | 364 | | return false; | 365 | | } else { | 366 | | to = ToCppT(res); | 367 | | } | 368 | | } | 369 | 130 | } else { | 370 | 130 | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 371 | 130 | res)) { | 372 | 40 | if (params.is_strict) { | 373 | 12 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 374 | 12 | decimal_to_string(from.value, scale_from), | 375 | 12 | fmt::format("decimal({}, {})", precision_from, scale_from), | 376 | 12 | precision_to, scale_to); | 377 | 12 | } | 378 | 40 | return false; | 379 | 90 | } else { | 380 | 90 | if (UNLIKELY(res > max_result || res < -max_result)) { | 381 | 32 | if (params.is_strict) { | 382 | 24 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 383 | 24 | decimal_to_string(from.value, scale_from), | 384 | 24 | fmt::format("decimal({}, {})", precision_from, scale_from), | 385 | 24 | precision_to, scale_to); | 386 | 24 | } | 387 | 32 | return false; | 388 | 58 | } else { | 389 | 58 | to = ToCppT(res); | 390 | 58 | } | 391 | 90 | } | 392 | 130 | } | 393 | | } else { | 394 | | if constexpr (IsDecimal128V2<FromCppT>) { | 395 | | res = from.value() * scale_multiplier; | 396 | | } else { | 397 | | res = from.value * scale_multiplier; | 398 | | } | 399 | | if constexpr (narrow_integral) { | 400 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 401 | | if constexpr (IsDecimal128V2<FromCppT>) { | 402 | | if (params.is_strict) { | 403 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 404 | | decimal_to_string(from.value(), scale_from), | 405 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 406 | | precision_to, scale_to); | 407 | | } | 408 | | } else { | 409 | | if (params.is_strict) { | 410 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 411 | | decimal_to_string(from.value, scale_from), | 412 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 413 | | precision_to, scale_to); | 414 | | } | 415 | | } | 416 | | return false; | 417 | | } | 418 | | } | 419 | | to = ToCppT(res); | 420 | | } | 421 | 58 | return true; | 422 | 130 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_7DecimalIlEENS_12Decimal128V3ELb0ELb0EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKT3_RKNS5_10NativeTypeESF_RNS_14CastParametersE Line | Count | Source | 343 | 352 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 344 | 352 | MaxNativeType res; | 345 | | if constexpr (multiply_may_overflow) { | 346 | | if constexpr (IsDecimal128V2<FromCppT>) { | 347 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 348 | | res)) { | 349 | | if (params.is_strict) { | 350 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 351 | | decimal_to_string(from.value(), scale_from), | 352 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 353 | | precision_to, scale_to); | 354 | | } | 355 | | return false; | 356 | | } else { | 357 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 358 | | if (params.is_strict) { | 359 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 360 | | decimal_to_string(from.value(), scale_from), | 361 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 362 | | precision_to, scale_to); | 363 | | } | 364 | | return false; | 365 | | } else { | 366 | | to = ToCppT(res); | 367 | | } | 368 | | } | 369 | | } else { | 370 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 371 | | res)) { | 372 | | if (params.is_strict) { | 373 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 374 | | decimal_to_string(from.value, scale_from), | 375 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 376 | | precision_to, scale_to); | 377 | | } | 378 | | return false; | 379 | | } else { | 380 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 381 | | if (params.is_strict) { | 382 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 383 | | decimal_to_string(from.value, scale_from), | 384 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 385 | | precision_to, scale_to); | 386 | | } | 387 | | return false; | 388 | | } else { | 389 | | to = ToCppT(res); | 390 | | } | 391 | | } | 392 | | } | 393 | 352 | } else { | 394 | | if constexpr (IsDecimal128V2<FromCppT>) { | 395 | | res = from.value() * scale_multiplier; | 396 | 352 | } else { | 397 | 352 | res = from.value * scale_multiplier; | 398 | 352 | } | 399 | | if constexpr (narrow_integral) { | 400 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 401 | | if constexpr (IsDecimal128V2<FromCppT>) { | 402 | | if (params.is_strict) { | 403 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 404 | | decimal_to_string(from.value(), scale_from), | 405 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 406 | | precision_to, scale_to); | 407 | | } | 408 | | } else { | 409 | | if (params.is_strict) { | 410 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 411 | | decimal_to_string(from.value, scale_from), | 412 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 413 | | precision_to, scale_to); | 414 | | } | 415 | | } | 416 | | return false; | 417 | | } | 418 | | } | 419 | 352 | to = ToCppT(res); | 420 | 352 | } | 421 | 352 | return true; | 422 | 352 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_7DecimalIlEENS_12Decimal128V3ELb0ELb1EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKT3_RKNS5_10NativeTypeESF_RNS_14CastParametersE Line | Count | Source | 343 | 232 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 344 | 232 | MaxNativeType res; | 345 | | if constexpr (multiply_may_overflow) { | 346 | | if constexpr (IsDecimal128V2<FromCppT>) { | 347 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 348 | | res)) { | 349 | | if (params.is_strict) { | 350 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 351 | | decimal_to_string(from.value(), scale_from), | 352 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 353 | | precision_to, scale_to); | 354 | | } | 355 | | return false; | 356 | | } else { | 357 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 358 | | if (params.is_strict) { | 359 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 360 | | decimal_to_string(from.value(), scale_from), | 361 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 362 | | precision_to, scale_to); | 363 | | } | 364 | | return false; | 365 | | } else { | 366 | | to = ToCppT(res); | 367 | | } | 368 | | } | 369 | | } else { | 370 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 371 | | res)) { | 372 | | if (params.is_strict) { | 373 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 374 | | decimal_to_string(from.value, scale_from), | 375 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 376 | | precision_to, scale_to); | 377 | | } | 378 | | return false; | 379 | | } else { | 380 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 381 | | if (params.is_strict) { | 382 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 383 | | decimal_to_string(from.value, scale_from), | 384 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 385 | | precision_to, scale_to); | 386 | | } | 387 | | return false; | 388 | | } else { | 389 | | to = ToCppT(res); | 390 | | } | 391 | | } | 392 | | } | 393 | 232 | } else { | 394 | | if constexpr (IsDecimal128V2<FromCppT>) { | 395 | | res = from.value() * scale_multiplier; | 396 | 232 | } else { | 397 | 232 | res = from.value * scale_multiplier; | 398 | 232 | } | 399 | 232 | if constexpr (narrow_integral) { | 400 | 232 | if (UNLIKELY(res > max_result || res < -max_result)) { | 401 | | if constexpr (IsDecimal128V2<FromCppT>) { | 402 | | if (params.is_strict) { | 403 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 404 | | decimal_to_string(from.value(), scale_from), | 405 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 406 | | precision_to, scale_to); | 407 | | } | 408 | 120 | } else { | 409 | 120 | if (params.is_strict) { | 410 | 60 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 411 | 60 | decimal_to_string(from.value, scale_from), | 412 | 60 | fmt::format("decimal({}, {})", precision_from, scale_from), | 413 | 60 | precision_to, scale_to); | 414 | 60 | } | 415 | 120 | } | 416 | 120 | return false; | 417 | 120 | } | 418 | 232 | } | 419 | 112 | to = ToCppT(res); | 420 | 232 | } | 421 | 0 | return true; | 422 | 232 | } |
Unexecuted instantiation: _ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_7DecimalIlEENS_12Decimal128V3ELb1ELb0EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKT3_RKNS5_10NativeTypeESF_RNS_14CastParametersE _ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_7DecimalIlEENS_12Decimal128V3ELb1ELb1EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKT3_RKNS5_10NativeTypeESF_RNS_14CastParametersE Line | Count | Source | 343 | 232 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 344 | 232 | MaxNativeType res; | 345 | 232 | if constexpr (multiply_may_overflow) { | 346 | | if constexpr (IsDecimal128V2<FromCppT>) { | 347 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 348 | | res)) { | 349 | | if (params.is_strict) { | 350 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 351 | | decimal_to_string(from.value(), scale_from), | 352 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 353 | | precision_to, scale_to); | 354 | | } | 355 | | return false; | 356 | | } else { | 357 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 358 | | if (params.is_strict) { | 359 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 360 | | decimal_to_string(from.value(), scale_from), | 361 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 362 | | precision_to, scale_to); | 363 | | } | 364 | | return false; | 365 | | } else { | 366 | | to = ToCppT(res); | 367 | | } | 368 | | } | 369 | 232 | } else { | 370 | 232 | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 371 | 232 | res)) { | 372 | 72 | if (params.is_strict) { | 373 | 24 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 374 | 24 | decimal_to_string(from.value, scale_from), | 375 | 24 | fmt::format("decimal({}, {})", precision_from, scale_from), | 376 | 24 | precision_to, scale_to); | 377 | 24 | } | 378 | 72 | return false; | 379 | 160 | } else { | 380 | 160 | if (UNLIKELY(res > max_result || res < -max_result)) { | 381 | 48 | if (params.is_strict) { | 382 | 36 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 383 | 36 | decimal_to_string(from.value, scale_from), | 384 | 36 | fmt::format("decimal({}, {})", precision_from, scale_from), | 385 | 36 | precision_to, scale_to); | 386 | 36 | } | 387 | 48 | return false; | 388 | 112 | } else { | 389 | 112 | to = ToCppT(res); | 390 | 112 | } | 391 | 160 | } | 392 | 232 | } | 393 | | } else { | 394 | | if constexpr (IsDecimal128V2<FromCppT>) { | 395 | | res = from.value() * scale_multiplier; | 396 | | } else { | 397 | | res = from.value * scale_multiplier; | 398 | | } | 399 | | if constexpr (narrow_integral) { | 400 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 401 | | if constexpr (IsDecimal128V2<FromCppT>) { | 402 | | if (params.is_strict) { | 403 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 404 | | decimal_to_string(from.value(), scale_from), | 405 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 406 | | precision_to, scale_to); | 407 | | } | 408 | | } else { | 409 | | if (params.is_strict) { | 410 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 411 | | decimal_to_string(from.value, scale_from), | 412 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 413 | | precision_to, scale_to); | 414 | | } | 415 | | } | 416 | | return false; | 417 | | } | 418 | | } | 419 | | to = ToCppT(res); | 420 | | } | 421 | 112 | return true; | 422 | 232 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_12Decimal128V3ES2_Lb0ELb0EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS4_jjRS3_jjRKT3_RKNS3_10NativeTypeESD_RNS_14CastParametersE Line | Count | Source | 343 | 92 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 344 | 92 | MaxNativeType res; | 345 | | if constexpr (multiply_may_overflow) { | 346 | | if constexpr (IsDecimal128V2<FromCppT>) { | 347 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 348 | | res)) { | 349 | | if (params.is_strict) { | 350 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 351 | | decimal_to_string(from.value(), scale_from), | 352 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 353 | | precision_to, scale_to); | 354 | | } | 355 | | return false; | 356 | | } else { | 357 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 358 | | if (params.is_strict) { | 359 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 360 | | decimal_to_string(from.value(), scale_from), | 361 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 362 | | precision_to, scale_to); | 363 | | } | 364 | | return false; | 365 | | } else { | 366 | | to = ToCppT(res); | 367 | | } | 368 | | } | 369 | | } else { | 370 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 371 | | res)) { | 372 | | if (params.is_strict) { | 373 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 374 | | decimal_to_string(from.value, scale_from), | 375 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 376 | | precision_to, scale_to); | 377 | | } | 378 | | return false; | 379 | | } else { | 380 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 381 | | if (params.is_strict) { | 382 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 383 | | decimal_to_string(from.value, scale_from), | 384 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 385 | | precision_to, scale_to); | 386 | | } | 387 | | return false; | 388 | | } else { | 389 | | to = ToCppT(res); | 390 | | } | 391 | | } | 392 | | } | 393 | 92 | } else { | 394 | | if constexpr (IsDecimal128V2<FromCppT>) { | 395 | | res = from.value() * scale_multiplier; | 396 | 92 | } else { | 397 | 92 | res = from.value * scale_multiplier; | 398 | 92 | } | 399 | | if constexpr (narrow_integral) { | 400 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 401 | | if constexpr (IsDecimal128V2<FromCppT>) { | 402 | | if (params.is_strict) { | 403 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 404 | | decimal_to_string(from.value(), scale_from), | 405 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 406 | | precision_to, scale_to); | 407 | | } | 408 | | } else { | 409 | | if (params.is_strict) { | 410 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 411 | | decimal_to_string(from.value, scale_from), | 412 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 413 | | precision_to, scale_to); | 414 | | } | 415 | | } | 416 | | return false; | 417 | | } | 418 | | } | 419 | 92 | to = ToCppT(res); | 420 | 92 | } | 421 | 92 | return true; | 422 | 92 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_12Decimal128V3ES2_Lb0ELb1EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS4_jjRS3_jjRKT3_RKNS3_10NativeTypeESD_RNS_14CastParametersE Line | Count | Source | 343 | 140 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 344 | 140 | MaxNativeType res; | 345 | | if constexpr (multiply_may_overflow) { | 346 | | if constexpr (IsDecimal128V2<FromCppT>) { | 347 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 348 | | res)) { | 349 | | if (params.is_strict) { | 350 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 351 | | decimal_to_string(from.value(), scale_from), | 352 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 353 | | precision_to, scale_to); | 354 | | } | 355 | | return false; | 356 | | } else { | 357 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 358 | | if (params.is_strict) { | 359 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 360 | | decimal_to_string(from.value(), scale_from), | 361 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 362 | | precision_to, scale_to); | 363 | | } | 364 | | return false; | 365 | | } else { | 366 | | to = ToCppT(res); | 367 | | } | 368 | | } | 369 | | } else { | 370 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 371 | | res)) { | 372 | | if (params.is_strict) { | 373 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 374 | | decimal_to_string(from.value, scale_from), | 375 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 376 | | precision_to, scale_to); | 377 | | } | 378 | | return false; | 379 | | } else { | 380 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 381 | | if (params.is_strict) { | 382 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 383 | | decimal_to_string(from.value, scale_from), | 384 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 385 | | precision_to, scale_to); | 386 | | } | 387 | | return false; | 388 | | } else { | 389 | | to = ToCppT(res); | 390 | | } | 391 | | } | 392 | | } | 393 | 140 | } else { | 394 | | if constexpr (IsDecimal128V2<FromCppT>) { | 395 | | res = from.value() * scale_multiplier; | 396 | 140 | } else { | 397 | 140 | res = from.value * scale_multiplier; | 398 | 140 | } | 399 | 140 | if constexpr (narrow_integral) { | 400 | 140 | if (UNLIKELY(res > max_result || res < -max_result)) { | 401 | | if constexpr (IsDecimal128V2<FromCppT>) { | 402 | | if (params.is_strict) { | 403 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 404 | | decimal_to_string(from.value(), scale_from), | 405 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 406 | | precision_to, scale_to); | 407 | | } | 408 | 72 | } else { | 409 | 72 | if (params.is_strict) { | 410 | 36 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 411 | 36 | decimal_to_string(from.value, scale_from), | 412 | 36 | fmt::format("decimal({}, {})", precision_from, scale_from), | 413 | 36 | precision_to, scale_to); | 414 | 36 | } | 415 | 72 | } | 416 | 72 | return false; | 417 | 72 | } | 418 | 140 | } | 419 | 68 | to = ToCppT(res); | 420 | 140 | } | 421 | 0 | return true; | 422 | 140 | } |
Unexecuted instantiation: _ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_12Decimal128V3ES2_Lb1ELb0EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS4_jjRS3_jjRKT3_RKNS3_10NativeTypeESD_RNS_14CastParametersE _ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_12Decimal128V3ES2_Lb1ELb1EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS4_jjRS3_jjRKT3_RKNS3_10NativeTypeESD_RNS_14CastParametersE Line | Count | Source | 343 | 368 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 344 | 368 | MaxNativeType res; | 345 | 368 | if constexpr (multiply_may_overflow) { | 346 | | if constexpr (IsDecimal128V2<FromCppT>) { | 347 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 348 | | res)) { | 349 | | if (params.is_strict) { | 350 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 351 | | decimal_to_string(from.value(), scale_from), | 352 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 353 | | precision_to, scale_to); | 354 | | } | 355 | | return false; | 356 | | } else { | 357 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 358 | | if (params.is_strict) { | 359 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 360 | | decimal_to_string(from.value(), scale_from), | 361 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 362 | | precision_to, scale_to); | 363 | | } | 364 | | return false; | 365 | | } else { | 366 | | to = ToCppT(res); | 367 | | } | 368 | | } | 369 | 368 | } else { | 370 | 368 | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 371 | 368 | res)) { | 372 | 96 | if (params.is_strict) { | 373 | 24 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 374 | 24 | decimal_to_string(from.value, scale_from), | 375 | 24 | fmt::format("decimal({}, {})", precision_from, scale_from), | 376 | 24 | precision_to, scale_to); | 377 | 24 | } | 378 | 96 | return false; | 379 | 272 | } else { | 380 | 272 | if (UNLIKELY(res > max_result || res < -max_result)) { | 381 | 96 | if (params.is_strict) { | 382 | 72 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 383 | 72 | decimal_to_string(from.value, scale_from), | 384 | 72 | fmt::format("decimal({}, {})", precision_from, scale_from), | 385 | 72 | precision_to, scale_to); | 386 | 72 | } | 387 | 96 | return false; | 388 | 176 | } else { | 389 | 176 | to = ToCppT(res); | 390 | 176 | } | 391 | 272 | } | 392 | 368 | } | 393 | | } else { | 394 | | if constexpr (IsDecimal128V2<FromCppT>) { | 395 | | res = from.value() * scale_multiplier; | 396 | | } else { | 397 | | res = from.value * scale_multiplier; | 398 | | } | 399 | | if constexpr (narrow_integral) { | 400 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 401 | | if constexpr (IsDecimal128V2<FromCppT>) { | 402 | | if (params.is_strict) { | 403 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 404 | | decimal_to_string(from.value(), scale_from), | 405 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 406 | | precision_to, scale_to); | 407 | | } | 408 | | } else { | 409 | | if (params.is_strict) { | 410 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 411 | | decimal_to_string(from.value, scale_from), | 412 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 413 | | precision_to, scale_to); | 414 | | } | 415 | | } | 416 | | return false; | 417 | | } | 418 | | } | 419 | | to = ToCppT(res); | 420 | | } | 421 | 176 | return true; | 422 | 368 | } |
Unexecuted instantiation: _ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_7DecimalIN4wide7integerILm256EiEEEENS_12Decimal128V3ELb0ELb0ES5_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKT3_RKNS8_10NativeTypeESI_RNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_7DecimalIN4wide7integerILm256EiEEEENS_12Decimal128V3ELb0ELb1ES5_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKT3_RKNS8_10NativeTypeESI_RNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_7DecimalIN4wide7integerILm256EiEEEENS_12Decimal128V3ELb1ELb0ES5_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKT3_RKNS8_10NativeTypeESI_RNS_14CastParametersE _ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_7DecimalIN4wide7integerILm256EiEEEENS_12Decimal128V3ELb1ELb1ES5_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKT3_RKNS8_10NativeTypeESI_RNS_14CastParametersE Line | Count | Source | 343 | 448 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 344 | 448 | MaxNativeType res; | 345 | 448 | if constexpr (multiply_may_overflow) { | 346 | | if constexpr (IsDecimal128V2<FromCppT>) { | 347 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 348 | | res)) { | 349 | | if (params.is_strict) { | 350 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 351 | | decimal_to_string(from.value(), scale_from), | 352 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 353 | | precision_to, scale_to); | 354 | | } | 355 | | return false; | 356 | | } else { | 357 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 358 | | if (params.is_strict) { | 359 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 360 | | decimal_to_string(from.value(), scale_from), | 361 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 362 | | precision_to, scale_to); | 363 | | } | 364 | | return false; | 365 | | } else { | 366 | | to = ToCppT(res); | 367 | | } | 368 | | } | 369 | 448 | } else { | 370 | 448 | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 371 | 448 | res)) { | 372 | 44 | if (params.is_strict) { | 373 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 374 | 0 | decimal_to_string(from.value, scale_from), | 375 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 376 | 0 | precision_to, scale_to); | 377 | 0 | } | 378 | 44 | return false; | 379 | 404 | } else { | 380 | 404 | if (UNLIKELY(res > max_result || res < -max_result)) { | 381 | 196 | if (params.is_strict) { | 382 | 120 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 383 | 120 | decimal_to_string(from.value, scale_from), | 384 | 120 | fmt::format("decimal({}, {})", precision_from, scale_from), | 385 | 120 | precision_to, scale_to); | 386 | 120 | } | 387 | 196 | return false; | 388 | 208 | } else { | 389 | 208 | to = ToCppT(res); | 390 | 208 | } | 391 | 404 | } | 392 | 448 | } | 393 | | } else { | 394 | | if constexpr (IsDecimal128V2<FromCppT>) { | 395 | | res = from.value() * scale_multiplier; | 396 | | } else { | 397 | | res = from.value * scale_multiplier; | 398 | | } | 399 | | if constexpr (narrow_integral) { | 400 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 401 | | if constexpr (IsDecimal128V2<FromCppT>) { | 402 | | if (params.is_strict) { | 403 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 404 | | decimal_to_string(from.value(), scale_from), | 405 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 406 | | precision_to, scale_to); | 407 | | } | 408 | | } else { | 409 | | if (params.is_strict) { | 410 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 411 | | decimal_to_string(from.value, scale_from), | 412 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 413 | | precision_to, scale_to); | 414 | | } | 415 | | } | 416 | | return false; | 417 | | } | 418 | | } | 419 | | to = ToCppT(res); | 420 | | } | 421 | 208 | return true; | 422 | 448 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_7DecimalIiEENS2_IN4wide7integerILm256EiEEEELb0ELb0ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKT3_RKNS8_10NativeTypeESI_RNS_14CastParametersE Line | Count | Source | 343 | 240 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 344 | 240 | MaxNativeType res; | 345 | | if constexpr (multiply_may_overflow) { | 346 | | if constexpr (IsDecimal128V2<FromCppT>) { | 347 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 348 | | res)) { | 349 | | if (params.is_strict) { | 350 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 351 | | decimal_to_string(from.value(), scale_from), | 352 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 353 | | precision_to, scale_to); | 354 | | } | 355 | | return false; | 356 | | } else { | 357 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 358 | | if (params.is_strict) { | 359 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 360 | | decimal_to_string(from.value(), scale_from), | 361 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 362 | | precision_to, scale_to); | 363 | | } | 364 | | return false; | 365 | | } else { | 366 | | to = ToCppT(res); | 367 | | } | 368 | | } | 369 | | } else { | 370 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 371 | | res)) { | 372 | | if (params.is_strict) { | 373 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 374 | | decimal_to_string(from.value, scale_from), | 375 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 376 | | precision_to, scale_to); | 377 | | } | 378 | | return false; | 379 | | } else { | 380 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 381 | | if (params.is_strict) { | 382 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 383 | | decimal_to_string(from.value, scale_from), | 384 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 385 | | precision_to, scale_to); | 386 | | } | 387 | | return false; | 388 | | } else { | 389 | | to = ToCppT(res); | 390 | | } | 391 | | } | 392 | | } | 393 | 240 | } else { | 394 | | if constexpr (IsDecimal128V2<FromCppT>) { | 395 | | res = from.value() * scale_multiplier; | 396 | 240 | } else { | 397 | 240 | res = from.value * scale_multiplier; | 398 | 240 | } | 399 | | if constexpr (narrow_integral) { | 400 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 401 | | if constexpr (IsDecimal128V2<FromCppT>) { | 402 | | if (params.is_strict) { | 403 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 404 | | decimal_to_string(from.value(), scale_from), | 405 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 406 | | precision_to, scale_to); | 407 | | } | 408 | | } else { | 409 | | if (params.is_strict) { | 410 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 411 | | decimal_to_string(from.value, scale_from), | 412 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 413 | | precision_to, scale_to); | 414 | | } | 415 | | } | 416 | | return false; | 417 | | } | 418 | | } | 419 | 240 | to = ToCppT(res); | 420 | 240 | } | 421 | 240 | return true; | 422 | 240 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_7DecimalIiEENS2_IN4wide7integerILm256EiEEEELb0ELb1ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKT3_RKNS8_10NativeTypeESI_RNS_14CastParametersE Line | Count | Source | 343 | 130 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 344 | 130 | MaxNativeType res; | 345 | | if constexpr (multiply_may_overflow) { | 346 | | if constexpr (IsDecimal128V2<FromCppT>) { | 347 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 348 | | res)) { | 349 | | if (params.is_strict) { | 350 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 351 | | decimal_to_string(from.value(), scale_from), | 352 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 353 | | precision_to, scale_to); | 354 | | } | 355 | | return false; | 356 | | } else { | 357 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 358 | | if (params.is_strict) { | 359 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 360 | | decimal_to_string(from.value(), scale_from), | 361 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 362 | | precision_to, scale_to); | 363 | | } | 364 | | return false; | 365 | | } else { | 366 | | to = ToCppT(res); | 367 | | } | 368 | | } | 369 | | } else { | 370 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 371 | | res)) { | 372 | | if (params.is_strict) { | 373 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 374 | | decimal_to_string(from.value, scale_from), | 375 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 376 | | precision_to, scale_to); | 377 | | } | 378 | | return false; | 379 | | } else { | 380 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 381 | | if (params.is_strict) { | 382 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 383 | | decimal_to_string(from.value, scale_from), | 384 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 385 | | precision_to, scale_to); | 386 | | } | 387 | | return false; | 388 | | } else { | 389 | | to = ToCppT(res); | 390 | | } | 391 | | } | 392 | | } | 393 | 130 | } else { | 394 | | if constexpr (IsDecimal128V2<FromCppT>) { | 395 | | res = from.value() * scale_multiplier; | 396 | 130 | } else { | 397 | 130 | res = from.value * scale_multiplier; | 398 | 130 | } | 399 | 130 | if constexpr (narrow_integral) { | 400 | 130 | if (UNLIKELY(res > max_result || res < -max_result)) { | 401 | | if constexpr (IsDecimal128V2<FromCppT>) { | 402 | | if (params.is_strict) { | 403 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 404 | | decimal_to_string(from.value(), scale_from), | 405 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 406 | | precision_to, scale_to); | 407 | | } | 408 | 72 | } else { | 409 | 72 | if (params.is_strict) { | 410 | 36 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 411 | 36 | decimal_to_string(from.value, scale_from), | 412 | 36 | fmt::format("decimal({}, {})", precision_from, scale_from), | 413 | 36 | precision_to, scale_to); | 414 | 36 | } | 415 | 72 | } | 416 | 72 | return false; | 417 | 72 | } | 418 | 130 | } | 419 | 58 | to = ToCppT(res); | 420 | 130 | } | 421 | 0 | return true; | 422 | 130 | } |
Unexecuted instantiation: _ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_7DecimalIiEENS2_IN4wide7integerILm256EiEEEELb1ELb0ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKT3_RKNS8_10NativeTypeESI_RNS_14CastParametersE _ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_7DecimalIiEENS2_IN4wide7integerILm256EiEEEELb1ELb1ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKT3_RKNS8_10NativeTypeESI_RNS_14CastParametersE Line | Count | Source | 343 | 130 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 344 | 130 | MaxNativeType res; | 345 | 130 | if constexpr (multiply_may_overflow) { | 346 | | if constexpr (IsDecimal128V2<FromCppT>) { | 347 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 348 | | res)) { | 349 | | if (params.is_strict) { | 350 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 351 | | decimal_to_string(from.value(), scale_from), | 352 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 353 | | precision_to, scale_to); | 354 | | } | 355 | | return false; | 356 | | } else { | 357 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 358 | | if (params.is_strict) { | 359 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 360 | | decimal_to_string(from.value(), scale_from), | 361 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 362 | | precision_to, scale_to); | 363 | | } | 364 | | return false; | 365 | | } else { | 366 | | to = ToCppT(res); | 367 | | } | 368 | | } | 369 | 130 | } else { | 370 | 130 | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 371 | 130 | res)) { | 372 | 24 | if (params.is_strict) { | 373 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 374 | 0 | decimal_to_string(from.value, scale_from), | 375 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 376 | 0 | precision_to, scale_to); | 377 | 0 | } | 378 | 24 | return false; | 379 | 106 | } else { | 380 | 106 | if (UNLIKELY(res > max_result || res < -max_result)) { | 381 | 48 | if (params.is_strict) { | 382 | 36 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 383 | 36 | decimal_to_string(from.value, scale_from), | 384 | 36 | fmt::format("decimal({}, {})", precision_from, scale_from), | 385 | 36 | precision_to, scale_to); | 386 | 36 | } | 387 | 48 | return false; | 388 | 58 | } else { | 389 | 58 | to = ToCppT(res); | 390 | 58 | } | 391 | 106 | } | 392 | 130 | } | 393 | | } else { | 394 | | if constexpr (IsDecimal128V2<FromCppT>) { | 395 | | res = from.value() * scale_multiplier; | 396 | | } else { | 397 | | res = from.value * scale_multiplier; | 398 | | } | 399 | | if constexpr (narrow_integral) { | 400 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 401 | | if constexpr (IsDecimal128V2<FromCppT>) { | 402 | | if (params.is_strict) { | 403 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 404 | | decimal_to_string(from.value(), scale_from), | 405 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 406 | | precision_to, scale_to); | 407 | | } | 408 | | } else { | 409 | | if (params.is_strict) { | 410 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 411 | | decimal_to_string(from.value, scale_from), | 412 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 413 | | precision_to, scale_to); | 414 | | } | 415 | | } | 416 | | return false; | 417 | | } | 418 | | } | 419 | | to = ToCppT(res); | 420 | | } | 421 | 58 | return true; | 422 | 130 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_7DecimalIlEENS2_IN4wide7integerILm256EiEEEELb0ELb0ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKT3_RKNS8_10NativeTypeESI_RNS_14CastParametersE Line | Count | Source | 343 | 368 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 344 | 368 | MaxNativeType res; | 345 | | if constexpr (multiply_may_overflow) { | 346 | | if constexpr (IsDecimal128V2<FromCppT>) { | 347 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 348 | | res)) { | 349 | | if (params.is_strict) { | 350 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 351 | | decimal_to_string(from.value(), scale_from), | 352 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 353 | | precision_to, scale_to); | 354 | | } | 355 | | return false; | 356 | | } else { | 357 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 358 | | if (params.is_strict) { | 359 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 360 | | decimal_to_string(from.value(), scale_from), | 361 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 362 | | precision_to, scale_to); | 363 | | } | 364 | | return false; | 365 | | } else { | 366 | | to = ToCppT(res); | 367 | | } | 368 | | } | 369 | | } else { | 370 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 371 | | res)) { | 372 | | if (params.is_strict) { | 373 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 374 | | decimal_to_string(from.value, scale_from), | 375 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 376 | | precision_to, scale_to); | 377 | | } | 378 | | return false; | 379 | | } else { | 380 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 381 | | if (params.is_strict) { | 382 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 383 | | decimal_to_string(from.value, scale_from), | 384 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 385 | | precision_to, scale_to); | 386 | | } | 387 | | return false; | 388 | | } else { | 389 | | to = ToCppT(res); | 390 | | } | 391 | | } | 392 | | } | 393 | 368 | } else { | 394 | | if constexpr (IsDecimal128V2<FromCppT>) { | 395 | | res = from.value() * scale_multiplier; | 396 | 368 | } else { | 397 | 368 | res = from.value * scale_multiplier; | 398 | 368 | } | 399 | | if constexpr (narrow_integral) { | 400 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 401 | | if constexpr (IsDecimal128V2<FromCppT>) { | 402 | | if (params.is_strict) { | 403 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 404 | | decimal_to_string(from.value(), scale_from), | 405 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 406 | | precision_to, scale_to); | 407 | | } | 408 | | } else { | 409 | | if (params.is_strict) { | 410 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 411 | | decimal_to_string(from.value, scale_from), | 412 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 413 | | precision_to, scale_to); | 414 | | } | 415 | | } | 416 | | return false; | 417 | | } | 418 | | } | 419 | 368 | to = ToCppT(res); | 420 | 368 | } | 421 | 368 | return true; | 422 | 368 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_7DecimalIlEENS2_IN4wide7integerILm256EiEEEELb0ELb1ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKT3_RKNS8_10NativeTypeESI_RNS_14CastParametersE Line | Count | Source | 343 | 232 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 344 | 232 | MaxNativeType res; | 345 | | if constexpr (multiply_may_overflow) { | 346 | | if constexpr (IsDecimal128V2<FromCppT>) { | 347 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 348 | | res)) { | 349 | | if (params.is_strict) { | 350 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 351 | | decimal_to_string(from.value(), scale_from), | 352 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 353 | | precision_to, scale_to); | 354 | | } | 355 | | return false; | 356 | | } else { | 357 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 358 | | if (params.is_strict) { | 359 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 360 | | decimal_to_string(from.value(), scale_from), | 361 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 362 | | precision_to, scale_to); | 363 | | } | 364 | | return false; | 365 | | } else { | 366 | | to = ToCppT(res); | 367 | | } | 368 | | } | 369 | | } else { | 370 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 371 | | res)) { | 372 | | if (params.is_strict) { | 373 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 374 | | decimal_to_string(from.value, scale_from), | 375 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 376 | | precision_to, scale_to); | 377 | | } | 378 | | return false; | 379 | | } else { | 380 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 381 | | if (params.is_strict) { | 382 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 383 | | decimal_to_string(from.value, scale_from), | 384 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 385 | | precision_to, scale_to); | 386 | | } | 387 | | return false; | 388 | | } else { | 389 | | to = ToCppT(res); | 390 | | } | 391 | | } | 392 | | } | 393 | 232 | } else { | 394 | | if constexpr (IsDecimal128V2<FromCppT>) { | 395 | | res = from.value() * scale_multiplier; | 396 | 232 | } else { | 397 | 232 | res = from.value * scale_multiplier; | 398 | 232 | } | 399 | 232 | if constexpr (narrow_integral) { | 400 | 232 | if (UNLIKELY(res > max_result || res < -max_result)) { | 401 | | if constexpr (IsDecimal128V2<FromCppT>) { | 402 | | if (params.is_strict) { | 403 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 404 | | decimal_to_string(from.value(), scale_from), | 405 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 406 | | precision_to, scale_to); | 407 | | } | 408 | 120 | } else { | 409 | 120 | if (params.is_strict) { | 410 | 60 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 411 | 60 | decimal_to_string(from.value, scale_from), | 412 | 60 | fmt::format("decimal({}, {})", precision_from, scale_from), | 413 | 60 | precision_to, scale_to); | 414 | 60 | } | 415 | 120 | } | 416 | 120 | return false; | 417 | 120 | } | 418 | 232 | } | 419 | 112 | to = ToCppT(res); | 420 | 232 | } | 421 | 0 | return true; | 422 | 232 | } |
Unexecuted instantiation: _ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_7DecimalIlEENS2_IN4wide7integerILm256EiEEEELb1ELb0ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKT3_RKNS8_10NativeTypeESI_RNS_14CastParametersE _ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_7DecimalIlEENS2_IN4wide7integerILm256EiEEEELb1ELb1ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKT3_RKNS8_10NativeTypeESI_RNS_14CastParametersE Line | Count | Source | 343 | 232 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 344 | 232 | MaxNativeType res; | 345 | 232 | if constexpr (multiply_may_overflow) { | 346 | | if constexpr (IsDecimal128V2<FromCppT>) { | 347 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 348 | | res)) { | 349 | | if (params.is_strict) { | 350 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 351 | | decimal_to_string(from.value(), scale_from), | 352 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 353 | | precision_to, scale_to); | 354 | | } | 355 | | return false; | 356 | | } else { | 357 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 358 | | if (params.is_strict) { | 359 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 360 | | decimal_to_string(from.value(), scale_from), | 361 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 362 | | precision_to, scale_to); | 363 | | } | 364 | | return false; | 365 | | } else { | 366 | | to = ToCppT(res); | 367 | | } | 368 | | } | 369 | 232 | } else { | 370 | 232 | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 371 | 232 | res)) { | 372 | 40 | if (params.is_strict) { | 373 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 374 | 0 | decimal_to_string(from.value, scale_from), | 375 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 376 | 0 | precision_to, scale_to); | 377 | 0 | } | 378 | 40 | return false; | 379 | 192 | } else { | 380 | 192 | if (UNLIKELY(res > max_result || res < -max_result)) { | 381 | 80 | if (params.is_strict) { | 382 | 60 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 383 | 60 | decimal_to_string(from.value, scale_from), | 384 | 60 | fmt::format("decimal({}, {})", precision_from, scale_from), | 385 | 60 | precision_to, scale_to); | 386 | 60 | } | 387 | 80 | return false; | 388 | 112 | } else { | 389 | 112 | to = ToCppT(res); | 390 | 112 | } | 391 | 192 | } | 392 | 232 | } | 393 | | } else { | 394 | | if constexpr (IsDecimal128V2<FromCppT>) { | 395 | | res = from.value() * scale_multiplier; | 396 | | } else { | 397 | | res = from.value * scale_multiplier; | 398 | | } | 399 | | if constexpr (narrow_integral) { | 400 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 401 | | if constexpr (IsDecimal128V2<FromCppT>) { | 402 | | if (params.is_strict) { | 403 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 404 | | decimal_to_string(from.value(), scale_from), | 405 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 406 | | precision_to, scale_to); | 407 | | } | 408 | | } else { | 409 | | if (params.is_strict) { | 410 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 411 | | decimal_to_string(from.value, scale_from), | 412 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 413 | | precision_to, scale_to); | 414 | | } | 415 | | } | 416 | | return false; | 417 | | } | 418 | | } | 419 | | to = ToCppT(res); | 420 | | } | 421 | 112 | return true; | 422 | 232 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_12Decimal128V3ENS_7DecimalIN4wide7integerILm256EiEEEELb0ELb0ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKT3_RKNS8_10NativeTypeESI_RNS_14CastParametersE Line | Count | Source | 343 | 352 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 344 | 352 | MaxNativeType res; | 345 | | if constexpr (multiply_may_overflow) { | 346 | | if constexpr (IsDecimal128V2<FromCppT>) { | 347 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 348 | | res)) { | 349 | | if (params.is_strict) { | 350 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 351 | | decimal_to_string(from.value(), scale_from), | 352 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 353 | | precision_to, scale_to); | 354 | | } | 355 | | return false; | 356 | | } else { | 357 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 358 | | if (params.is_strict) { | 359 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 360 | | decimal_to_string(from.value(), scale_from), | 361 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 362 | | precision_to, scale_to); | 363 | | } | 364 | | return false; | 365 | | } else { | 366 | | to = ToCppT(res); | 367 | | } | 368 | | } | 369 | | } else { | 370 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 371 | | res)) { | 372 | | if (params.is_strict) { | 373 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 374 | | decimal_to_string(from.value, scale_from), | 375 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 376 | | precision_to, scale_to); | 377 | | } | 378 | | return false; | 379 | | } else { | 380 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 381 | | if (params.is_strict) { | 382 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 383 | | decimal_to_string(from.value, scale_from), | 384 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 385 | | precision_to, scale_to); | 386 | | } | 387 | | return false; | 388 | | } else { | 389 | | to = ToCppT(res); | 390 | | } | 391 | | } | 392 | | } | 393 | 352 | } else { | 394 | | if constexpr (IsDecimal128V2<FromCppT>) { | 395 | | res = from.value() * scale_multiplier; | 396 | 352 | } else { | 397 | 352 | res = from.value * scale_multiplier; | 398 | 352 | } | 399 | | if constexpr (narrow_integral) { | 400 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 401 | | if constexpr (IsDecimal128V2<FromCppT>) { | 402 | | if (params.is_strict) { | 403 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 404 | | decimal_to_string(from.value(), scale_from), | 405 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 406 | | precision_to, scale_to); | 407 | | } | 408 | | } else { | 409 | | if (params.is_strict) { | 410 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 411 | | decimal_to_string(from.value, scale_from), | 412 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 413 | | precision_to, scale_to); | 414 | | } | 415 | | } | 416 | | return false; | 417 | | } | 418 | | } | 419 | 352 | to = ToCppT(res); | 420 | 352 | } | 421 | 352 | return true; | 422 | 352 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_12Decimal128V3ENS_7DecimalIN4wide7integerILm256EiEEEELb0ELb1ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKT3_RKNS8_10NativeTypeESI_RNS_14CastParametersE Line | Count | Source | 343 | 218 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 344 | 218 | MaxNativeType res; | 345 | | if constexpr (multiply_may_overflow) { | 346 | | if constexpr (IsDecimal128V2<FromCppT>) { | 347 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 348 | | res)) { | 349 | | if (params.is_strict) { | 350 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 351 | | decimal_to_string(from.value(), scale_from), | 352 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 353 | | precision_to, scale_to); | 354 | | } | 355 | | return false; | 356 | | } else { | 357 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 358 | | if (params.is_strict) { | 359 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 360 | | decimal_to_string(from.value(), scale_from), | 361 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 362 | | precision_to, scale_to); | 363 | | } | 364 | | return false; | 365 | | } else { | 366 | | to = ToCppT(res); | 367 | | } | 368 | | } | 369 | | } else { | 370 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 371 | | res)) { | 372 | | if (params.is_strict) { | 373 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 374 | | decimal_to_string(from.value, scale_from), | 375 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 376 | | precision_to, scale_to); | 377 | | } | 378 | | return false; | 379 | | } else { | 380 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 381 | | if (params.is_strict) { | 382 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 383 | | decimal_to_string(from.value, scale_from), | 384 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 385 | | precision_to, scale_to); | 386 | | } | 387 | | return false; | 388 | | } else { | 389 | | to = ToCppT(res); | 390 | | } | 391 | | } | 392 | | } | 393 | 218 | } else { | 394 | | if constexpr (IsDecimal128V2<FromCppT>) { | 395 | | res = from.value() * scale_multiplier; | 396 | 218 | } else { | 397 | 218 | res = from.value * scale_multiplier; | 398 | 218 | } | 399 | 218 | if constexpr (narrow_integral) { | 400 | 218 | if (UNLIKELY(res > max_result || res < -max_result)) { | 401 | | if constexpr (IsDecimal128V2<FromCppT>) { | 402 | | if (params.is_strict) { | 403 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 404 | | decimal_to_string(from.value(), scale_from), | 405 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 406 | | precision_to, scale_to); | 407 | | } | 408 | 108 | } else { | 409 | 108 | if (params.is_strict) { | 410 | 54 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 411 | 54 | decimal_to_string(from.value, scale_from), | 412 | 54 | fmt::format("decimal({}, {})", precision_from, scale_from), | 413 | 54 | precision_to, scale_to); | 414 | 54 | } | 415 | 108 | } | 416 | 108 | return false; | 417 | 108 | } | 418 | 218 | } | 419 | 110 | to = ToCppT(res); | 420 | 218 | } | 421 | 0 | return true; | 422 | 218 | } |
Unexecuted instantiation: _ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_12Decimal128V3ENS_7DecimalIN4wide7integerILm256EiEEEELb1ELb0ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKT3_RKNS8_10NativeTypeESI_RNS_14CastParametersE _ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_12Decimal128V3ENS_7DecimalIN4wide7integerILm256EiEEEELb1ELb1ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKT3_RKNS8_10NativeTypeESI_RNS_14CastParametersE Line | Count | Source | 343 | 246 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 344 | 246 | MaxNativeType res; | 345 | 246 | if constexpr (multiply_may_overflow) { | 346 | | if constexpr (IsDecimal128V2<FromCppT>) { | 347 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 348 | | res)) { | 349 | | if (params.is_strict) { | 350 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 351 | | decimal_to_string(from.value(), scale_from), | 352 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 353 | | precision_to, scale_to); | 354 | | } | 355 | | return false; | 356 | | } else { | 357 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 358 | | if (params.is_strict) { | 359 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 360 | | decimal_to_string(from.value(), scale_from), | 361 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 362 | | precision_to, scale_to); | 363 | | } | 364 | | return false; | 365 | | } else { | 366 | | to = ToCppT(res); | 367 | | } | 368 | | } | 369 | 246 | } else { | 370 | 246 | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 371 | 246 | res)) { | 372 | 44 | if (params.is_strict) { | 373 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 374 | 0 | decimal_to_string(from.value, scale_from), | 375 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 376 | 0 | precision_to, scale_to); | 377 | 0 | } | 378 | 44 | return false; | 379 | 202 | } else { | 380 | 202 | if (UNLIKELY(res > max_result || res < -max_result)) { | 381 | 88 | if (params.is_strict) { | 382 | 66 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 383 | 66 | decimal_to_string(from.value, scale_from), | 384 | 66 | fmt::format("decimal({}, {})", precision_from, scale_from), | 385 | 66 | precision_to, scale_to); | 386 | 66 | } | 387 | 88 | return false; | 388 | 114 | } else { | 389 | 114 | to = ToCppT(res); | 390 | 114 | } | 391 | 202 | } | 392 | 246 | } | 393 | | } else { | 394 | | if constexpr (IsDecimal128V2<FromCppT>) { | 395 | | res = from.value() * scale_multiplier; | 396 | | } else { | 397 | | res = from.value * scale_multiplier; | 398 | | } | 399 | | if constexpr (narrow_integral) { | 400 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 401 | | if constexpr (IsDecimal128V2<FromCppT>) { | 402 | | if (params.is_strict) { | 403 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 404 | | decimal_to_string(from.value(), scale_from), | 405 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 406 | | precision_to, scale_to); | 407 | | } | 408 | | } else { | 409 | | if (params.is_strict) { | 410 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 411 | | decimal_to_string(from.value, scale_from), | 412 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 413 | | precision_to, scale_to); | 414 | | } | 415 | | } | 416 | | return false; | 417 | | } | 418 | | } | 419 | | to = ToCppT(res); | 420 | | } | 421 | 114 | return true; | 422 | 246 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_7DecimalIN4wide7integerILm256EiEEEES6_Lb0ELb0ES5_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS8_jjRS7_jjRKT3_RKNS7_10NativeTypeESH_RNS_14CastParametersE Line | Count | Source | 343 | 92 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 344 | 92 | MaxNativeType res; | 345 | | if constexpr (multiply_may_overflow) { | 346 | | if constexpr (IsDecimal128V2<FromCppT>) { | 347 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 348 | | res)) { | 349 | | if (params.is_strict) { | 350 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 351 | | decimal_to_string(from.value(), scale_from), | 352 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 353 | | precision_to, scale_to); | 354 | | } | 355 | | return false; | 356 | | } else { | 357 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 358 | | if (params.is_strict) { | 359 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 360 | | decimal_to_string(from.value(), scale_from), | 361 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 362 | | precision_to, scale_to); | 363 | | } | 364 | | return false; | 365 | | } else { | 366 | | to = ToCppT(res); | 367 | | } | 368 | | } | 369 | | } else { | 370 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 371 | | res)) { | 372 | | if (params.is_strict) { | 373 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 374 | | decimal_to_string(from.value, scale_from), | 375 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 376 | | precision_to, scale_to); | 377 | | } | 378 | | return false; | 379 | | } else { | 380 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 381 | | if (params.is_strict) { | 382 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 383 | | decimal_to_string(from.value, scale_from), | 384 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 385 | | precision_to, scale_to); | 386 | | } | 387 | | return false; | 388 | | } else { | 389 | | to = ToCppT(res); | 390 | | } | 391 | | } | 392 | | } | 393 | 92 | } else { | 394 | | if constexpr (IsDecimal128V2<FromCppT>) { | 395 | | res = from.value() * scale_multiplier; | 396 | 92 | } else { | 397 | 92 | res = from.value * scale_multiplier; | 398 | 92 | } | 399 | | if constexpr (narrow_integral) { | 400 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 401 | | if constexpr (IsDecimal128V2<FromCppT>) { | 402 | | if (params.is_strict) { | 403 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 404 | | decimal_to_string(from.value(), scale_from), | 405 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 406 | | precision_to, scale_to); | 407 | | } | 408 | | } else { | 409 | | if (params.is_strict) { | 410 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 411 | | decimal_to_string(from.value, scale_from), | 412 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 413 | | precision_to, scale_to); | 414 | | } | 415 | | } | 416 | | return false; | 417 | | } | 418 | | } | 419 | 92 | to = ToCppT(res); | 420 | 92 | } | 421 | 92 | return true; | 422 | 92 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_7DecimalIN4wide7integerILm256EiEEEES6_Lb0ELb1ES5_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS8_jjRS7_jjRKT3_RKNS7_10NativeTypeESH_RNS_14CastParametersE Line | Count | Source | 343 | 88 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 344 | 88 | MaxNativeType res; | 345 | | if constexpr (multiply_may_overflow) { | 346 | | if constexpr (IsDecimal128V2<FromCppT>) { | 347 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 348 | | res)) { | 349 | | if (params.is_strict) { | 350 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 351 | | decimal_to_string(from.value(), scale_from), | 352 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 353 | | precision_to, scale_to); | 354 | | } | 355 | | return false; | 356 | | } else { | 357 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 358 | | if (params.is_strict) { | 359 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 360 | | decimal_to_string(from.value(), scale_from), | 361 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 362 | | precision_to, scale_to); | 363 | | } | 364 | | return false; | 365 | | } else { | 366 | | to = ToCppT(res); | 367 | | } | 368 | | } | 369 | | } else { | 370 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 371 | | res)) { | 372 | | if (params.is_strict) { | 373 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 374 | | decimal_to_string(from.value, scale_from), | 375 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 376 | | precision_to, scale_to); | 377 | | } | 378 | | return false; | 379 | | } else { | 380 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 381 | | if (params.is_strict) { | 382 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 383 | | decimal_to_string(from.value, scale_from), | 384 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 385 | | precision_to, scale_to); | 386 | | } | 387 | | return false; | 388 | | } else { | 389 | | to = ToCppT(res); | 390 | | } | 391 | | } | 392 | | } | 393 | 88 | } else { | 394 | | if constexpr (IsDecimal128V2<FromCppT>) { | 395 | | res = from.value() * scale_multiplier; | 396 | 88 | } else { | 397 | 88 | res = from.value * scale_multiplier; | 398 | 88 | } | 399 | 88 | if constexpr (narrow_integral) { | 400 | 88 | if (UNLIKELY(res > max_result || res < -max_result)) { | 401 | | if constexpr (IsDecimal128V2<FromCppT>) { | 402 | | if (params.is_strict) { | 403 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 404 | | decimal_to_string(from.value(), scale_from), | 405 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 406 | | precision_to, scale_to); | 407 | | } | 408 | 36 | } else { | 409 | 36 | if (params.is_strict) { | 410 | 18 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 411 | 18 | decimal_to_string(from.value, scale_from), | 412 | 18 | fmt::format("decimal({}, {})", precision_from, scale_from), | 413 | 18 | precision_to, scale_to); | 414 | 18 | } | 415 | 36 | } | 416 | 36 | return false; | 417 | 36 | } | 418 | 88 | } | 419 | 52 | to = ToCppT(res); | 420 | 88 | } | 421 | 0 | return true; | 422 | 88 | } |
Unexecuted instantiation: _ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_7DecimalIN4wide7integerILm256EiEEEES6_Lb1ELb0ES5_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS8_jjRS7_jjRKT3_RKNS7_10NativeTypeESH_RNS_14CastParametersE _ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_7DecimalIN4wide7integerILm256EiEEEES6_Lb1ELb1ES5_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS8_jjRS7_jjRKT3_RKNS7_10NativeTypeESH_RNS_14CastParametersE Line | Count | Source | 343 | 420 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 344 | 420 | MaxNativeType res; | 345 | 420 | if constexpr (multiply_may_overflow) { | 346 | | if constexpr (IsDecimal128V2<FromCppT>) { | 347 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 348 | | res)) { | 349 | | if (params.is_strict) { | 350 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 351 | | decimal_to_string(from.value(), scale_from), | 352 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 353 | | precision_to, scale_to); | 354 | | } | 355 | | return false; | 356 | | } else { | 357 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 358 | | if (params.is_strict) { | 359 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 360 | | decimal_to_string(from.value(), scale_from), | 361 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 362 | | precision_to, scale_to); | 363 | | } | 364 | | return false; | 365 | | } else { | 366 | | to = ToCppT(res); | 367 | | } | 368 | | } | 369 | 420 | } else { | 370 | 420 | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 371 | 420 | res)) { | 372 | 76 | if (params.is_strict) { | 373 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 374 | 0 | decimal_to_string(from.value, scale_from), | 375 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 376 | 0 | precision_to, scale_to); | 377 | 0 | } | 378 | 76 | return false; | 379 | 344 | } else { | 380 | 344 | if (UNLIKELY(res > max_result || res < -max_result)) { | 381 | 152 | if (params.is_strict) { | 382 | 114 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 383 | 114 | decimal_to_string(from.value, scale_from), | 384 | 114 | fmt::format("decimal({}, {})", precision_from, scale_from), | 385 | 114 | precision_to, scale_to); | 386 | 114 | } | 387 | 152 | return false; | 388 | 192 | } else { | 389 | 192 | to = ToCppT(res); | 390 | 192 | } | 391 | 344 | } | 392 | 420 | } | 393 | | } else { | 394 | | if constexpr (IsDecimal128V2<FromCppT>) { | 395 | | res = from.value() * scale_multiplier; | 396 | | } else { | 397 | | res = from.value * scale_multiplier; | 398 | | } | 399 | | if constexpr (narrow_integral) { | 400 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 401 | | if constexpr (IsDecimal128V2<FromCppT>) { | 402 | | if (params.is_strict) { | 403 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 404 | | decimal_to_string(from.value(), scale_from), | 405 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 406 | | precision_to, scale_to); | 407 | | } | 408 | | } else { | 409 | | if (params.is_strict) { | 410 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 411 | | decimal_to_string(from.value, scale_from), | 412 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 413 | | precision_to, scale_to); | 414 | | } | 415 | | } | 416 | | return false; | 417 | | } | 418 | | } | 419 | | to = ToCppT(res); | 420 | | } | 421 | 192 | return true; | 422 | 420 | } |
Unexecuted instantiation: _ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_14DecimalV2ValueENS_7DecimalIiEELb0ELb0EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKT3_RKNS5_10NativeTypeESF_RNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_14DecimalV2ValueENS_7DecimalIiEELb0ELb1EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKT3_RKNS5_10NativeTypeESF_RNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_14DecimalV2ValueENS_7DecimalIiEELb1ELb0EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKT3_RKNS5_10NativeTypeESF_RNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_14DecimalV2ValueENS_7DecimalIiEELb1ELb1EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKT3_RKNS5_10NativeTypeESF_RNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_14DecimalV2ValueENS_7DecimalIlEELb0ELb0EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKT3_RKNS5_10NativeTypeESF_RNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_14DecimalV2ValueENS_7DecimalIlEELb0ELb1EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKT3_RKNS5_10NativeTypeESF_RNS_14CastParametersE _ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_14DecimalV2ValueENS_7DecimalIlEELb1ELb0EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKT3_RKNS5_10NativeTypeESF_RNS_14CastParametersE Line | Count | Source | 343 | 30 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 344 | 30 | MaxNativeType res; | 345 | 30 | if constexpr (multiply_may_overflow) { | 346 | 30 | if constexpr (IsDecimal128V2<FromCppT>) { | 347 | 30 | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 348 | 30 | res)) { | 349 | 0 | if (params.is_strict) { | 350 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 351 | 0 | decimal_to_string(from.value(), scale_from), | 352 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 353 | 0 | precision_to, scale_to); | 354 | 0 | } | 355 | 0 | return false; | 356 | 30 | } else { | 357 | 30 | if (UNLIKELY(res > max_result || res < -max_result)) { | 358 | 0 | if (params.is_strict) { | 359 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 360 | 0 | decimal_to_string(from.value(), scale_from), | 361 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 362 | 0 | precision_to, scale_to); | 363 | 0 | } | 364 | 0 | return false; | 365 | 30 | } else { | 366 | 30 | to = ToCppT(res); | 367 | 30 | } | 368 | 30 | } | 369 | | } else { | 370 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 371 | | res)) { | 372 | | if (params.is_strict) { | 373 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 374 | | decimal_to_string(from.value, scale_from), | 375 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 376 | | precision_to, scale_to); | 377 | | } | 378 | | return false; | 379 | | } else { | 380 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 381 | | if (params.is_strict) { | 382 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 383 | | decimal_to_string(from.value, scale_from), | 384 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 385 | | precision_to, scale_to); | 386 | | } | 387 | | return false; | 388 | | } else { | 389 | | to = ToCppT(res); | 390 | | } | 391 | | } | 392 | | } | 393 | | } else { | 394 | | if constexpr (IsDecimal128V2<FromCppT>) { | 395 | | res = from.value() * scale_multiplier; | 396 | | } else { | 397 | | res = from.value * scale_multiplier; | 398 | | } | 399 | | if constexpr (narrow_integral) { | 400 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 401 | | if constexpr (IsDecimal128V2<FromCppT>) { | 402 | | if (params.is_strict) { | 403 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 404 | | decimal_to_string(from.value(), scale_from), | 405 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 406 | | precision_to, scale_to); | 407 | | } | 408 | | } else { | 409 | | if (params.is_strict) { | 410 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 411 | | decimal_to_string(from.value, scale_from), | 412 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 413 | | precision_to, scale_to); | 414 | | } | 415 | | } | 416 | | return false; | 417 | | } | 418 | | } | 419 | | to = ToCppT(res); | 420 | | } | 421 | 30 | return true; | 422 | 30 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_14DecimalV2ValueENS_7DecimalIlEELb1ELb1EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKT3_RKNS5_10NativeTypeESF_RNS_14CastParametersE Line | Count | Source | 343 | 260 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 344 | 260 | MaxNativeType res; | 345 | 260 | if constexpr (multiply_may_overflow) { | 346 | 260 | if constexpr (IsDecimal128V2<FromCppT>) { | 347 | 260 | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 348 | 260 | res)) { | 349 | 0 | if (params.is_strict) { | 350 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 351 | 0 | decimal_to_string(from.value(), scale_from), | 352 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 353 | 0 | precision_to, scale_to); | 354 | 0 | } | 355 | 0 | return false; | 356 | 260 | } else { | 357 | 260 | if (UNLIKELY(res > max_result || res < -max_result)) { | 358 | 96 | if (params.is_strict) { | 359 | 48 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 360 | 48 | decimal_to_string(from.value(), scale_from), | 361 | 48 | fmt::format("decimal({}, {})", precision_from, scale_from), | 362 | 48 | precision_to, scale_to); | 363 | 48 | } | 364 | 96 | return false; | 365 | 164 | } else { | 366 | 164 | to = ToCppT(res); | 367 | 164 | } | 368 | 260 | } | 369 | | } else { | 370 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 371 | | res)) { | 372 | | if (params.is_strict) { | 373 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 374 | | decimal_to_string(from.value, scale_from), | 375 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 376 | | precision_to, scale_to); | 377 | | } | 378 | | return false; | 379 | | } else { | 380 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 381 | | if (params.is_strict) { | 382 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 383 | | decimal_to_string(from.value, scale_from), | 384 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 385 | | precision_to, scale_to); | 386 | | } | 387 | | return false; | 388 | | } else { | 389 | | to = ToCppT(res); | 390 | | } | 391 | | } | 392 | | } | 393 | | } else { | 394 | | if constexpr (IsDecimal128V2<FromCppT>) { | 395 | | res = from.value() * scale_multiplier; | 396 | | } else { | 397 | | res = from.value * scale_multiplier; | 398 | | } | 399 | | if constexpr (narrow_integral) { | 400 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 401 | | if constexpr (IsDecimal128V2<FromCppT>) { | 402 | | if (params.is_strict) { | 403 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 404 | | decimal_to_string(from.value(), scale_from), | 405 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 406 | | precision_to, scale_to); | 407 | | } | 408 | | } else { | 409 | | if (params.is_strict) { | 410 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 411 | | decimal_to_string(from.value, scale_from), | 412 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 413 | | precision_to, scale_to); | 414 | | } | 415 | | } | 416 | | return false; | 417 | | } | 418 | | } | 419 | | to = ToCppT(res); | 420 | | } | 421 | 164 | return true; | 422 | 260 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_14DecimalV2ValueENS_12Decimal128V3ELb0ELb0EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 343 | 22 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 344 | 22 | MaxNativeType res; | 345 | | if constexpr (multiply_may_overflow) { | 346 | | if constexpr (IsDecimal128V2<FromCppT>) { | 347 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 348 | | res)) { | 349 | | if (params.is_strict) { | 350 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 351 | | decimal_to_string(from.value(), scale_from), | 352 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 353 | | precision_to, scale_to); | 354 | | } | 355 | | return false; | 356 | | } else { | 357 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 358 | | if (params.is_strict) { | 359 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 360 | | decimal_to_string(from.value(), scale_from), | 361 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 362 | | precision_to, scale_to); | 363 | | } | 364 | | return false; | 365 | | } else { | 366 | | to = ToCppT(res); | 367 | | } | 368 | | } | 369 | | } else { | 370 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 371 | | res)) { | 372 | | if (params.is_strict) { | 373 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 374 | | decimal_to_string(from.value, scale_from), | 375 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 376 | | precision_to, scale_to); | 377 | | } | 378 | | return false; | 379 | | } else { | 380 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 381 | | if (params.is_strict) { | 382 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 383 | | decimal_to_string(from.value, scale_from), | 384 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 385 | | precision_to, scale_to); | 386 | | } | 387 | | return false; | 388 | | } else { | 389 | | to = ToCppT(res); | 390 | | } | 391 | | } | 392 | | } | 393 | 22 | } else { | 394 | 22 | if constexpr (IsDecimal128V2<FromCppT>) { | 395 | 22 | res = from.value() * scale_multiplier; | 396 | | } else { | 397 | | res = from.value * scale_multiplier; | 398 | | } | 399 | | if constexpr (narrow_integral) { | 400 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 401 | | if constexpr (IsDecimal128V2<FromCppT>) { | 402 | | if (params.is_strict) { | 403 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 404 | | decimal_to_string(from.value(), scale_from), | 405 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 406 | | precision_to, scale_to); | 407 | | } | 408 | | } else { | 409 | | if (params.is_strict) { | 410 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 411 | | decimal_to_string(from.value, scale_from), | 412 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 413 | | precision_to, scale_to); | 414 | | } | 415 | | } | 416 | | return false; | 417 | | } | 418 | | } | 419 | 22 | to = ToCppT(res); | 420 | 22 | } | 421 | 22 | return true; | 422 | 22 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_14DecimalV2ValueENS_12Decimal128V3ELb0ELb1EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 343 | 190 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 344 | 190 | MaxNativeType res; | 345 | | if constexpr (multiply_may_overflow) { | 346 | | if constexpr (IsDecimal128V2<FromCppT>) { | 347 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 348 | | res)) { | 349 | | if (params.is_strict) { | 350 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 351 | | decimal_to_string(from.value(), scale_from), | 352 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 353 | | precision_to, scale_to); | 354 | | } | 355 | | return false; | 356 | | } else { | 357 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 358 | | if (params.is_strict) { | 359 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 360 | | decimal_to_string(from.value(), scale_from), | 361 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 362 | | precision_to, scale_to); | 363 | | } | 364 | | return false; | 365 | | } else { | 366 | | to = ToCppT(res); | 367 | | } | 368 | | } | 369 | | } else { | 370 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 371 | | res)) { | 372 | | if (params.is_strict) { | 373 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 374 | | decimal_to_string(from.value, scale_from), | 375 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 376 | | precision_to, scale_to); | 377 | | } | 378 | | return false; | 379 | | } else { | 380 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 381 | | if (params.is_strict) { | 382 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 383 | | decimal_to_string(from.value, scale_from), | 384 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 385 | | precision_to, scale_to); | 386 | | } | 387 | | return false; | 388 | | } else { | 389 | | to = ToCppT(res); | 390 | | } | 391 | | } | 392 | | } | 393 | 190 | } else { | 394 | 190 | if constexpr (IsDecimal128V2<FromCppT>) { | 395 | 190 | res = from.value() * scale_multiplier; | 396 | | } else { | 397 | | res = from.value * scale_multiplier; | 398 | | } | 399 | 190 | if constexpr (narrow_integral) { | 400 | 190 | if (UNLIKELY(res > max_result || res < -max_result)) { | 401 | 60 | if constexpr (IsDecimal128V2<FromCppT>) { | 402 | 60 | if (params.is_strict) { | 403 | 30 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 404 | 30 | decimal_to_string(from.value(), scale_from), | 405 | 30 | fmt::format("decimal({}, {})", precision_from, scale_from), | 406 | 30 | precision_to, scale_to); | 407 | 30 | } | 408 | | } else { | 409 | | if (params.is_strict) { | 410 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 411 | | decimal_to_string(from.value, scale_from), | 412 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 413 | | precision_to, scale_to); | 414 | | } | 415 | | } | 416 | 60 | return false; | 417 | 60 | } | 418 | 190 | } | 419 | 130 | to = ToCppT(res); | 420 | 190 | } | 421 | 0 | return true; | 422 | 190 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_14DecimalV2ValueENS_12Decimal128V3ELb1ELb0EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 343 | 22 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 344 | 22 | MaxNativeType res; | 345 | 22 | if constexpr (multiply_may_overflow) { | 346 | 22 | if constexpr (IsDecimal128V2<FromCppT>) { | 347 | 22 | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 348 | 22 | res)) { | 349 | 0 | if (params.is_strict) { | 350 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 351 | 0 | decimal_to_string(from.value(), scale_from), | 352 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 353 | 0 | precision_to, scale_to); | 354 | 0 | } | 355 | 0 | return false; | 356 | 22 | } else { | 357 | 22 | if (UNLIKELY(res > max_result || res < -max_result)) { | 358 | 0 | if (params.is_strict) { | 359 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 360 | 0 | decimal_to_string(from.value(), scale_from), | 361 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 362 | 0 | precision_to, scale_to); | 363 | 0 | } | 364 | 0 | return false; | 365 | 22 | } else { | 366 | 22 | to = ToCppT(res); | 367 | 22 | } | 368 | 22 | } | 369 | | } else { | 370 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 371 | | res)) { | 372 | | if (params.is_strict) { | 373 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 374 | | decimal_to_string(from.value, scale_from), | 375 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 376 | | precision_to, scale_to); | 377 | | } | 378 | | return false; | 379 | | } else { | 380 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 381 | | if (params.is_strict) { | 382 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 383 | | decimal_to_string(from.value, scale_from), | 384 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 385 | | precision_to, scale_to); | 386 | | } | 387 | | return false; | 388 | | } else { | 389 | | to = ToCppT(res); | 390 | | } | 391 | | } | 392 | | } | 393 | | } else { | 394 | | if constexpr (IsDecimal128V2<FromCppT>) { | 395 | | res = from.value() * scale_multiplier; | 396 | | } else { | 397 | | res = from.value * scale_multiplier; | 398 | | } | 399 | | if constexpr (narrow_integral) { | 400 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 401 | | if constexpr (IsDecimal128V2<FromCppT>) { | 402 | | if (params.is_strict) { | 403 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 404 | | decimal_to_string(from.value(), scale_from), | 405 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 406 | | precision_to, scale_to); | 407 | | } | 408 | | } else { | 409 | | if (params.is_strict) { | 410 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 411 | | decimal_to_string(from.value, scale_from), | 412 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 413 | | precision_to, scale_to); | 414 | | } | 415 | | } | 416 | | return false; | 417 | | } | 418 | | } | 419 | | to = ToCppT(res); | 420 | | } | 421 | 22 | return true; | 422 | 22 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_14DecimalV2ValueENS_12Decimal128V3ELb1ELb1EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 343 | 190 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 344 | 190 | MaxNativeType res; | 345 | 190 | if constexpr (multiply_may_overflow) { | 346 | 190 | if constexpr (IsDecimal128V2<FromCppT>) { | 347 | 190 | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 348 | 190 | res)) { | 349 | 36 | if (params.is_strict) { | 350 | 12 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 351 | 12 | decimal_to_string(from.value(), scale_from), | 352 | 12 | fmt::format("decimal({}, {})", precision_from, scale_from), | 353 | 12 | precision_to, scale_to); | 354 | 12 | } | 355 | 36 | return false; | 356 | 154 | } else { | 357 | 154 | if (UNLIKELY(res > max_result || res < -max_result)) { | 358 | 24 | if (params.is_strict) { | 359 | 18 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 360 | 18 | decimal_to_string(from.value(), scale_from), | 361 | 18 | fmt::format("decimal({}, {})", precision_from, scale_from), | 362 | 18 | precision_to, scale_to); | 363 | 18 | } | 364 | 24 | return false; | 365 | 130 | } else { | 366 | 130 | to = ToCppT(res); | 367 | 130 | } | 368 | 154 | } | 369 | | } else { | 370 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 371 | | res)) { | 372 | | if (params.is_strict) { | 373 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 374 | | decimal_to_string(from.value, scale_from), | 375 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 376 | | precision_to, scale_to); | 377 | | } | 378 | | return false; | 379 | | } else { | 380 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 381 | | if (params.is_strict) { | 382 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 383 | | decimal_to_string(from.value, scale_from), | 384 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 385 | | precision_to, scale_to); | 386 | | } | 387 | | return false; | 388 | | } else { | 389 | | to = ToCppT(res); | 390 | | } | 391 | | } | 392 | | } | 393 | | } else { | 394 | | if constexpr (IsDecimal128V2<FromCppT>) { | 395 | | res = from.value() * scale_multiplier; | 396 | | } else { | 397 | | res = from.value * scale_multiplier; | 398 | | } | 399 | | if constexpr (narrow_integral) { | 400 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 401 | | if constexpr (IsDecimal128V2<FromCppT>) { | 402 | | if (params.is_strict) { | 403 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 404 | | decimal_to_string(from.value(), scale_from), | 405 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 406 | | precision_to, scale_to); | 407 | | } | 408 | | } else { | 409 | | if (params.is_strict) { | 410 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 411 | | decimal_to_string(from.value, scale_from), | 412 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 413 | | precision_to, scale_to); | 414 | | } | 415 | | } | 416 | | return false; | 417 | | } | 418 | | } | 419 | | to = ToCppT(res); | 420 | | } | 421 | 130 | return true; | 422 | 190 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_14DecimalV2ValueENS_7DecimalIN4wide7integerILm256EiEEEELb0ELb0ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKT3_RKNS8_10NativeTypeESI_RNS_14CastParametersE Line | Count | Source | 343 | 22 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 344 | 22 | MaxNativeType res; | 345 | | if constexpr (multiply_may_overflow) { | 346 | | if constexpr (IsDecimal128V2<FromCppT>) { | 347 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 348 | | res)) { | 349 | | if (params.is_strict) { | 350 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 351 | | decimal_to_string(from.value(), scale_from), | 352 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 353 | | precision_to, scale_to); | 354 | | } | 355 | | return false; | 356 | | } else { | 357 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 358 | | if (params.is_strict) { | 359 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 360 | | decimal_to_string(from.value(), scale_from), | 361 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 362 | | precision_to, scale_to); | 363 | | } | 364 | | return false; | 365 | | } else { | 366 | | to = ToCppT(res); | 367 | | } | 368 | | } | 369 | | } else { | 370 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 371 | | res)) { | 372 | | if (params.is_strict) { | 373 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 374 | | decimal_to_string(from.value, scale_from), | 375 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 376 | | precision_to, scale_to); | 377 | | } | 378 | | return false; | 379 | | } else { | 380 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 381 | | if (params.is_strict) { | 382 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 383 | | decimal_to_string(from.value, scale_from), | 384 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 385 | | precision_to, scale_to); | 386 | | } | 387 | | return false; | 388 | | } else { | 389 | | to = ToCppT(res); | 390 | | } | 391 | | } | 392 | | } | 393 | 22 | } else { | 394 | 22 | if constexpr (IsDecimal128V2<FromCppT>) { | 395 | 22 | res = from.value() * scale_multiplier; | 396 | | } else { | 397 | | res = from.value * scale_multiplier; | 398 | | } | 399 | | if constexpr (narrow_integral) { | 400 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 401 | | if constexpr (IsDecimal128V2<FromCppT>) { | 402 | | if (params.is_strict) { | 403 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 404 | | decimal_to_string(from.value(), scale_from), | 405 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 406 | | precision_to, scale_to); | 407 | | } | 408 | | } else { | 409 | | if (params.is_strict) { | 410 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 411 | | decimal_to_string(from.value, scale_from), | 412 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 413 | | precision_to, scale_to); | 414 | | } | 415 | | } | 416 | | return false; | 417 | | } | 418 | | } | 419 | 22 | to = ToCppT(res); | 420 | 22 | } | 421 | 22 | return true; | 422 | 22 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_14DecimalV2ValueENS_7DecimalIN4wide7integerILm256EiEEEELb0ELb1ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKT3_RKNS8_10NativeTypeESI_RNS_14CastParametersE Line | Count | Source | 343 | 190 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 344 | 190 | MaxNativeType res; | 345 | | if constexpr (multiply_may_overflow) { | 346 | | if constexpr (IsDecimal128V2<FromCppT>) { | 347 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 348 | | res)) { | 349 | | if (params.is_strict) { | 350 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 351 | | decimal_to_string(from.value(), scale_from), | 352 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 353 | | precision_to, scale_to); | 354 | | } | 355 | | return false; | 356 | | } else { | 357 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 358 | | if (params.is_strict) { | 359 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 360 | | decimal_to_string(from.value(), scale_from), | 361 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 362 | | precision_to, scale_to); | 363 | | } | 364 | | return false; | 365 | | } else { | 366 | | to = ToCppT(res); | 367 | | } | 368 | | } | 369 | | } else { | 370 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 371 | | res)) { | 372 | | if (params.is_strict) { | 373 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 374 | | decimal_to_string(from.value, scale_from), | 375 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 376 | | precision_to, scale_to); | 377 | | } | 378 | | return false; | 379 | | } else { | 380 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 381 | | if (params.is_strict) { | 382 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 383 | | decimal_to_string(from.value, scale_from), | 384 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 385 | | precision_to, scale_to); | 386 | | } | 387 | | return false; | 388 | | } else { | 389 | | to = ToCppT(res); | 390 | | } | 391 | | } | 392 | | } | 393 | 190 | } else { | 394 | 190 | if constexpr (IsDecimal128V2<FromCppT>) { | 395 | 190 | res = from.value() * scale_multiplier; | 396 | | } else { | 397 | | res = from.value * scale_multiplier; | 398 | | } | 399 | 190 | if constexpr (narrow_integral) { | 400 | 190 | if (UNLIKELY(res > max_result || res < -max_result)) { | 401 | 60 | if constexpr (IsDecimal128V2<FromCppT>) { | 402 | 60 | if (params.is_strict) { | 403 | 30 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 404 | 30 | decimal_to_string(from.value(), scale_from), | 405 | 30 | fmt::format("decimal({}, {})", precision_from, scale_from), | 406 | 30 | precision_to, scale_to); | 407 | 30 | } | 408 | | } else { | 409 | | if (params.is_strict) { | 410 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 411 | | decimal_to_string(from.value, scale_from), | 412 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 413 | | precision_to, scale_to); | 414 | | } | 415 | | } | 416 | 60 | return false; | 417 | 60 | } | 418 | 190 | } | 419 | 130 | to = ToCppT(res); | 420 | 190 | } | 421 | 0 | return true; | 422 | 190 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_14DecimalV2ValueENS_7DecimalIN4wide7integerILm256EiEEEELb1ELb0ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKT3_RKNS8_10NativeTypeESI_RNS_14CastParametersE Line | Count | Source | 343 | 22 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 344 | 22 | MaxNativeType res; | 345 | 22 | if constexpr (multiply_may_overflow) { | 346 | 22 | if constexpr (IsDecimal128V2<FromCppT>) { | 347 | 22 | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 348 | 22 | res)) { | 349 | 0 | if (params.is_strict) { | 350 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 351 | 0 | decimal_to_string(from.value(), scale_from), | 352 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 353 | 0 | precision_to, scale_to); | 354 | 0 | } | 355 | 0 | return false; | 356 | 22 | } else { | 357 | 22 | if (UNLIKELY(res > max_result || res < -max_result)) { | 358 | 0 | if (params.is_strict) { | 359 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 360 | 0 | decimal_to_string(from.value(), scale_from), | 361 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 362 | 0 | precision_to, scale_to); | 363 | 0 | } | 364 | 0 | return false; | 365 | 22 | } else { | 366 | 22 | to = ToCppT(res); | 367 | 22 | } | 368 | 22 | } | 369 | | } else { | 370 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 371 | | res)) { | 372 | | if (params.is_strict) { | 373 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 374 | | decimal_to_string(from.value, scale_from), | 375 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 376 | | precision_to, scale_to); | 377 | | } | 378 | | return false; | 379 | | } else { | 380 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 381 | | if (params.is_strict) { | 382 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 383 | | decimal_to_string(from.value, scale_from), | 384 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 385 | | precision_to, scale_to); | 386 | | } | 387 | | return false; | 388 | | } else { | 389 | | to = ToCppT(res); | 390 | | } | 391 | | } | 392 | | } | 393 | | } else { | 394 | | if constexpr (IsDecimal128V2<FromCppT>) { | 395 | | res = from.value() * scale_multiplier; | 396 | | } else { | 397 | | res = from.value * scale_multiplier; | 398 | | } | 399 | | if constexpr (narrow_integral) { | 400 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 401 | | if constexpr (IsDecimal128V2<FromCppT>) { | 402 | | if (params.is_strict) { | 403 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 404 | | decimal_to_string(from.value(), scale_from), | 405 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 406 | | precision_to, scale_to); | 407 | | } | 408 | | } else { | 409 | | if (params.is_strict) { | 410 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 411 | | decimal_to_string(from.value, scale_from), | 412 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 413 | | precision_to, scale_to); | 414 | | } | 415 | | } | 416 | | return false; | 417 | | } | 418 | | } | 419 | | to = ToCppT(res); | 420 | | } | 421 | 22 | return true; | 422 | 22 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_14DecimalV2ValueENS_7DecimalIN4wide7integerILm256EiEEEELb1ELb1ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKT3_RKNS8_10NativeTypeESI_RNS_14CastParametersE Line | Count | Source | 343 | 190 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 344 | 190 | MaxNativeType res; | 345 | 190 | if constexpr (multiply_may_overflow) { | 346 | 190 | if constexpr (IsDecimal128V2<FromCppT>) { | 347 | 190 | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 348 | 190 | res)) { | 349 | 20 | if (params.is_strict) { | 350 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 351 | 0 | decimal_to_string(from.value(), scale_from), | 352 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 353 | 0 | precision_to, scale_to); | 354 | 0 | } | 355 | 20 | return false; | 356 | 170 | } else { | 357 | 170 | if (UNLIKELY(res > max_result || res < -max_result)) { | 358 | 40 | if (params.is_strict) { | 359 | 30 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 360 | 30 | decimal_to_string(from.value(), scale_from), | 361 | 30 | fmt::format("decimal({}, {})", precision_from, scale_from), | 362 | 30 | precision_to, scale_to); | 363 | 30 | } | 364 | 40 | return false; | 365 | 130 | } else { | 366 | 130 | to = ToCppT(res); | 367 | 130 | } | 368 | 170 | } | 369 | | } else { | 370 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 371 | | res)) { | 372 | | if (params.is_strict) { | 373 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 374 | | decimal_to_string(from.value, scale_from), | 375 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 376 | | precision_to, scale_to); | 377 | | } | 378 | | return false; | 379 | | } else { | 380 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 381 | | if (params.is_strict) { | 382 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 383 | | decimal_to_string(from.value, scale_from), | 384 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 385 | | precision_to, scale_to); | 386 | | } | 387 | | return false; | 388 | | } else { | 389 | | to = ToCppT(res); | 390 | | } | 391 | | } | 392 | | } | 393 | | } else { | 394 | | if constexpr (IsDecimal128V2<FromCppT>) { | 395 | | res = from.value() * scale_multiplier; | 396 | | } else { | 397 | | res = from.value * scale_multiplier; | 398 | | } | 399 | | if constexpr (narrow_integral) { | 400 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 401 | | if constexpr (IsDecimal128V2<FromCppT>) { | 402 | | if (params.is_strict) { | 403 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 404 | | decimal_to_string(from.value(), scale_from), | 405 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 406 | | precision_to, scale_to); | 407 | | } | 408 | | } else { | 409 | | if (params.is_strict) { | 410 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 411 | | decimal_to_string(from.value, scale_from), | 412 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 413 | | precision_to, scale_to); | 414 | | } | 415 | | } | 416 | | return false; | 417 | | } | 418 | | } | 419 | | to = ToCppT(res); | 420 | | } | 421 | 130 | return true; | 422 | 190 | } |
|
423 | | |
424 | | template <typename FromCppT, typename ToCppT, typename ScaleT, bool narrow_integral> |
425 | | requires(IsDecimalNumber<ToCppT> && IsDecimalNumber<FromCppT>) |
426 | | static inline bool _from_decimal_same_scale(const FromCppT& from, const UInt32 precision_from, |
427 | | const UInt32 scale_from, ToCppT& to, |
428 | | UInt32 precision_to, UInt32 scale_to, |
429 | | const typename ToCppT::NativeType& min_result, |
430 | | const typename ToCppT::NativeType& max_result, |
431 | 3.73k | CastParameters& params) { |
432 | 3.73k | if constexpr (IsDecimal128V2<FromCppT>) { |
433 | 212 | if constexpr (narrow_integral) { |
434 | 190 | if (UNLIKELY(from.value() > max_result || from.value() < -max_result)) { |
435 | 60 | if (params.is_strict) { |
436 | 30 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( |
437 | 30 | decimal_to_string(from.value(), scale_from), |
438 | 30 | fmt::format("decimal({}, {})", precision_from, scale_from), |
439 | 30 | precision_to, scale_to); |
440 | 30 | } |
441 | 60 | return false; |
442 | 60 | } |
443 | 190 | } |
444 | 130 | to = ToCppT(from.value()); |
445 | 3.52k | } else { |
446 | 3.52k | if constexpr (narrow_integral) { |
447 | 2.11k | if (UNLIKELY(from.value > max_result || from.value < -max_result)) { |
448 | 708 | if (params.is_strict) { |
449 | 354 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( |
450 | 354 | decimal_to_string(from.value, scale_from), |
451 | 354 | fmt::format("decimal({}, {})", precision_from, scale_from), |
452 | 354 | precision_to, scale_to); |
453 | 354 | } |
454 | 708 | return false; |
455 | 708 | } |
456 | 2.11k | } |
457 | 1.40k | to = ToCppT(from.value); |
458 | 3.52k | } |
459 | 0 | return true; |
460 | 3.73k | } _ZN5doris13CastToDecimal24_from_decimal_same_scaleINS_7DecimalIiEES3_iLb0EQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKNS4_10NativeTypeESB_RNS_14CastParametersE Line | Count | Source | 431 | 16 | CastParameters& params) { | 432 | | if constexpr (IsDecimal128V2<FromCppT>) { | 433 | | if constexpr (narrow_integral) { | 434 | | if (UNLIKELY(from.value() > max_result || from.value() < -max_result)) { | 435 | | if (params.is_strict) { | 436 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 437 | | decimal_to_string(from.value(), scale_from), | 438 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 439 | | precision_to, scale_to); | 440 | | } | 441 | | return false; | 442 | | } | 443 | | } | 444 | | to = ToCppT(from.value()); | 445 | 16 | } else { | 446 | | if constexpr (narrow_integral) { | 447 | | if (UNLIKELY(from.value > max_result || from.value < -max_result)) { | 448 | | if (params.is_strict) { | 449 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 450 | | decimal_to_string(from.value, scale_from), | 451 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 452 | | precision_to, scale_to); | 453 | | } | 454 | | return false; | 455 | | } | 456 | | } | 457 | 16 | to = ToCppT(from.value); | 458 | 16 | } | 459 | 16 | return true; | 460 | 16 | } |
_ZN5doris13CastToDecimal24_from_decimal_same_scaleINS_7DecimalIiEES3_iLb1EQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKNS4_10NativeTypeESB_RNS_14CastParametersE Line | Count | Source | 431 | 38 | CastParameters& params) { | 432 | | if constexpr (IsDecimal128V2<FromCppT>) { | 433 | | if constexpr (narrow_integral) { | 434 | | if (UNLIKELY(from.value() > max_result || from.value() < -max_result)) { | 435 | | if (params.is_strict) { | 436 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 437 | | decimal_to_string(from.value(), scale_from), | 438 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 439 | | precision_to, scale_to); | 440 | | } | 441 | | return false; | 442 | | } | 443 | | } | 444 | | to = ToCppT(from.value()); | 445 | 38 | } else { | 446 | 38 | if constexpr (narrow_integral) { | 447 | 38 | if (UNLIKELY(from.value > max_result || from.value < -max_result)) { | 448 | 24 | if (params.is_strict) { | 449 | 12 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 450 | 12 | decimal_to_string(from.value, scale_from), | 451 | 12 | fmt::format("decimal({}, {})", precision_from, scale_from), | 452 | 12 | precision_to, scale_to); | 453 | 12 | } | 454 | 24 | return false; | 455 | 24 | } | 456 | 38 | } | 457 | 14 | to = ToCppT(from.value); | 458 | 38 | } | 459 | 0 | return true; | 460 | 38 | } |
Unexecuted instantiation: _ZN5doris13CastToDecimal24_from_decimal_same_scaleINS_7DecimalIlEENS2_IiEElLb0EQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RNS_14CastParametersE _ZN5doris13CastToDecimal24_from_decimal_same_scaleINS_7DecimalIlEENS2_IiEElLb1EQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RNS_14CastParametersE Line | Count | Source | 431 | 272 | CastParameters& params) { | 432 | | if constexpr (IsDecimal128V2<FromCppT>) { | 433 | | if constexpr (narrow_integral) { | 434 | | if (UNLIKELY(from.value() > max_result || from.value() < -max_result)) { | 435 | | if (params.is_strict) { | 436 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 437 | | decimal_to_string(from.value(), scale_from), | 438 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 439 | | precision_to, scale_to); | 440 | | } | 441 | | return false; | 442 | | } | 443 | | } | 444 | | to = ToCppT(from.value()); | 445 | 272 | } else { | 446 | 272 | if constexpr (narrow_integral) { | 447 | 272 | if (UNLIKELY(from.value > max_result || from.value < -max_result)) { | 448 | 108 | if (params.is_strict) { | 449 | 54 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 450 | 54 | decimal_to_string(from.value, scale_from), | 451 | 54 | fmt::format("decimal({}, {})", precision_from, scale_from), | 452 | 54 | precision_to, scale_to); | 453 | 54 | } | 454 | 108 | return false; | 455 | 108 | } | 456 | 272 | } | 457 | 164 | to = ToCppT(from.value); | 458 | 272 | } | 459 | 0 | return true; | 460 | 272 | } |
Unexecuted instantiation: _ZN5doris13CastToDecimal24_from_decimal_same_scaleINS_12Decimal128V3ENS_7DecimalIiEEnLb0EQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RNS_14CastParametersE _ZN5doris13CastToDecimal24_from_decimal_same_scaleINS_12Decimal128V3ENS_7DecimalIiEEnLb1EQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RNS_14CastParametersE Line | Count | Source | 431 | 244 | CastParameters& params) { | 432 | | if constexpr (IsDecimal128V2<FromCppT>) { | 433 | | if constexpr (narrow_integral) { | 434 | | if (UNLIKELY(from.value() > max_result || from.value() < -max_result)) { | 435 | | if (params.is_strict) { | 436 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 437 | | decimal_to_string(from.value(), scale_from), | 438 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 439 | | precision_to, scale_to); | 440 | | } | 441 | | return false; | 442 | | } | 443 | | } | 444 | | to = ToCppT(from.value()); | 445 | 244 | } else { | 446 | 244 | if constexpr (narrow_integral) { | 447 | 244 | if (UNLIKELY(from.value > max_result || from.value < -max_result)) { | 448 | 96 | if (params.is_strict) { | 449 | 48 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 450 | 48 | decimal_to_string(from.value, scale_from), | 451 | 48 | fmt::format("decimal({}, {})", precision_from, scale_from), | 452 | 48 | precision_to, scale_to); | 453 | 48 | } | 454 | 96 | return false; | 455 | 96 | } | 456 | 244 | } | 457 | 148 | to = ToCppT(from.value); | 458 | 244 | } | 459 | 0 | return true; | 460 | 244 | } |
Unexecuted instantiation: _ZN5doris13CastToDecimal24_from_decimal_same_scaleINS_7DecimalIN4wide7integerILm256EiEEEENS2_IiEES5_Lb0EQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKNS8_10NativeTypeESF_RNS_14CastParametersE _ZN5doris13CastToDecimal24_from_decimal_same_scaleINS_7DecimalIN4wide7integerILm256EiEEEENS2_IiEES5_Lb1EQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKNS8_10NativeTypeESF_RNS_14CastParametersE Line | Count | Source | 431 | 244 | CastParameters& params) { | 432 | | if constexpr (IsDecimal128V2<FromCppT>) { | 433 | | if constexpr (narrow_integral) { | 434 | | if (UNLIKELY(from.value() > max_result || from.value() < -max_result)) { | 435 | | if (params.is_strict) { | 436 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 437 | | decimal_to_string(from.value(), scale_from), | 438 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 439 | | precision_to, scale_to); | 440 | | } | 441 | | return false; | 442 | | } | 443 | | } | 444 | | to = ToCppT(from.value()); | 445 | 244 | } else { | 446 | 244 | if constexpr (narrow_integral) { | 447 | 244 | if (UNLIKELY(from.value > max_result || from.value < -max_result)) { | 448 | 96 | if (params.is_strict) { | 449 | 48 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 450 | 48 | decimal_to_string(from.value, scale_from), | 451 | 48 | fmt::format("decimal({}, {})", precision_from, scale_from), | 452 | 48 | precision_to, scale_to); | 453 | 48 | } | 454 | 96 | return false; | 455 | 96 | } | 456 | 244 | } | 457 | 148 | to = ToCppT(from.value); | 458 | 244 | } | 459 | 0 | return true; | 460 | 244 | } |
_ZN5doris13CastToDecimal24_from_decimal_same_scaleINS_7DecimalIiEENS2_IlEElLb0EQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RNS_14CastParametersE Line | Count | Source | 431 | 164 | CastParameters& params) { | 432 | | if constexpr (IsDecimal128V2<FromCppT>) { | 433 | | if constexpr (narrow_integral) { | 434 | | if (UNLIKELY(from.value() > max_result || from.value() < -max_result)) { | 435 | | if (params.is_strict) { | 436 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 437 | | decimal_to_string(from.value(), scale_from), | 438 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 439 | | precision_to, scale_to); | 440 | | } | 441 | | return false; | 442 | | } | 443 | | } | 444 | | to = ToCppT(from.value()); | 445 | 164 | } else { | 446 | | if constexpr (narrow_integral) { | 447 | | if (UNLIKELY(from.value > max_result || from.value < -max_result)) { | 448 | | if (params.is_strict) { | 449 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 450 | | decimal_to_string(from.value, scale_from), | 451 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 452 | | precision_to, scale_to); | 453 | | } | 454 | | return false; | 455 | | } | 456 | | } | 457 | 164 | to = ToCppT(from.value); | 458 | 164 | } | 459 | 164 | return true; | 460 | 164 | } |
Unexecuted instantiation: _ZN5doris13CastToDecimal24_from_decimal_same_scaleINS_7DecimalIiEENS2_IlEElLb1EQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RNS_14CastParametersE _ZN5doris13CastToDecimal24_from_decimal_same_scaleINS_7DecimalIlEES3_lLb0EQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKNS4_10NativeTypeESB_RNS_14CastParametersE Line | Count | Source | 431 | 60 | CastParameters& params) { | 432 | | if constexpr (IsDecimal128V2<FromCppT>) { | 433 | | if constexpr (narrow_integral) { | 434 | | if (UNLIKELY(from.value() > max_result || from.value() < -max_result)) { | 435 | | if (params.is_strict) { | 436 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 437 | | decimal_to_string(from.value(), scale_from), | 438 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 439 | | precision_to, scale_to); | 440 | | } | 441 | | return false; | 442 | | } | 443 | | } | 444 | | to = ToCppT(from.value()); | 445 | 60 | } else { | 446 | | if constexpr (narrow_integral) { | 447 | | if (UNLIKELY(from.value > max_result || from.value < -max_result)) { | 448 | | if (params.is_strict) { | 449 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 450 | | decimal_to_string(from.value, scale_from), | 451 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 452 | | precision_to, scale_to); | 453 | | } | 454 | | return false; | 455 | | } | 456 | | } | 457 | 60 | to = ToCppT(from.value); | 458 | 60 | } | 459 | 60 | return true; | 460 | 60 | } |
_ZN5doris13CastToDecimal24_from_decimal_same_scaleINS_7DecimalIlEES3_lLb1EQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKNS4_10NativeTypeESB_RNS_14CastParametersE Line | Count | Source | 431 | 84 | CastParameters& params) { | 432 | | if constexpr (IsDecimal128V2<FromCppT>) { | 433 | | if constexpr (narrow_integral) { | 434 | | if (UNLIKELY(from.value() > max_result || from.value() < -max_result)) { | 435 | | if (params.is_strict) { | 436 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 437 | | decimal_to_string(from.value(), scale_from), | 438 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 439 | | precision_to, scale_to); | 440 | | } | 441 | | return false; | 442 | | } | 443 | | } | 444 | | to = ToCppT(from.value()); | 445 | 84 | } else { | 446 | 84 | if constexpr (narrow_integral) { | 447 | 84 | if (UNLIKELY(from.value > max_result || from.value < -max_result)) { | 448 | 24 | if (params.is_strict) { | 449 | 12 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 450 | 12 | decimal_to_string(from.value, scale_from), | 451 | 12 | fmt::format("decimal({}, {})", precision_from, scale_from), | 452 | 12 | precision_to, scale_to); | 453 | 12 | } | 454 | 24 | return false; | 455 | 24 | } | 456 | 84 | } | 457 | 60 | to = ToCppT(from.value); | 458 | 84 | } | 459 | 0 | return true; | 460 | 84 | } |
Unexecuted instantiation: _ZN5doris13CastToDecimal24_from_decimal_same_scaleINS_12Decimal128V3ENS_7DecimalIlEEnLb0EQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RNS_14CastParametersE _ZN5doris13CastToDecimal24_from_decimal_same_scaleINS_12Decimal128V3ENS_7DecimalIlEEnLb1EQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RNS_14CastParametersE Line | Count | Source | 431 | 364 | CastParameters& params) { | 432 | | if constexpr (IsDecimal128V2<FromCppT>) { | 433 | | if constexpr (narrow_integral) { | 434 | | if (UNLIKELY(from.value() > max_result || from.value() < -max_result)) { | 435 | | if (params.is_strict) { | 436 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 437 | | decimal_to_string(from.value(), scale_from), | 438 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 439 | | precision_to, scale_to); | 440 | | } | 441 | | return false; | 442 | | } | 443 | | } | 444 | | to = ToCppT(from.value()); | 445 | 364 | } else { | 446 | 364 | if constexpr (narrow_integral) { | 447 | 364 | if (UNLIKELY(from.value > max_result || from.value < -max_result)) { | 448 | 108 | if (params.is_strict) { | 449 | 54 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 450 | 54 | decimal_to_string(from.value, scale_from), | 451 | 54 | fmt::format("decimal({}, {})", precision_from, scale_from), | 452 | 54 | precision_to, scale_to); | 453 | 54 | } | 454 | 108 | return false; | 455 | 108 | } | 456 | 364 | } | 457 | 256 | to = ToCppT(from.value); | 458 | 364 | } | 459 | 0 | return true; | 460 | 364 | } |
Unexecuted instantiation: _ZN5doris13CastToDecimal24_from_decimal_same_scaleINS_7DecimalIN4wide7integerILm256EiEEEENS2_IlEES5_Lb0EQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKNS8_10NativeTypeESF_RNS_14CastParametersE _ZN5doris13CastToDecimal24_from_decimal_same_scaleINS_7DecimalIN4wide7integerILm256EiEEEENS2_IlEES5_Lb1EQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKNS8_10NativeTypeESF_RNS_14CastParametersE Line | Count | Source | 431 | 336 | CastParameters& params) { | 432 | | if constexpr (IsDecimal128V2<FromCppT>) { | 433 | | if constexpr (narrow_integral) { | 434 | | if (UNLIKELY(from.value() > max_result || from.value() < -max_result)) { | 435 | | if (params.is_strict) { | 436 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 437 | | decimal_to_string(from.value(), scale_from), | 438 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 439 | | precision_to, scale_to); | 440 | | } | 441 | | return false; | 442 | | } | 443 | | } | 444 | | to = ToCppT(from.value()); | 445 | 336 | } else { | 446 | 336 | if constexpr (narrow_integral) { | 447 | 336 | if (UNLIKELY(from.value > max_result || from.value < -max_result)) { | 448 | 96 | if (params.is_strict) { | 449 | 48 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 450 | 48 | decimal_to_string(from.value, scale_from), | 451 | 48 | fmt::format("decimal({}, {})", precision_from, scale_from), | 452 | 48 | precision_to, scale_to); | 453 | 48 | } | 454 | 96 | return false; | 455 | 96 | } | 456 | 336 | } | 457 | 240 | to = ToCppT(from.value); | 458 | 336 | } | 459 | 0 | return true; | 460 | 336 | } |
_ZN5doris13CastToDecimal24_from_decimal_same_scaleINS_7DecimalIiEENS_12Decimal128V3EnLb0EQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RNS_14CastParametersE Line | Count | Source | 431 | 148 | CastParameters& params) { | 432 | | if constexpr (IsDecimal128V2<FromCppT>) { | 433 | | if constexpr (narrow_integral) { | 434 | | if (UNLIKELY(from.value() > max_result || from.value() < -max_result)) { | 435 | | if (params.is_strict) { | 436 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 437 | | decimal_to_string(from.value(), scale_from), | 438 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 439 | | precision_to, scale_to); | 440 | | } | 441 | | return false; | 442 | | } | 443 | | } | 444 | | to = ToCppT(from.value()); | 445 | 148 | } else { | 446 | | if constexpr (narrow_integral) { | 447 | | if (UNLIKELY(from.value > max_result || from.value < -max_result)) { | 448 | | if (params.is_strict) { | 449 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 450 | | decimal_to_string(from.value, scale_from), | 451 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 452 | | precision_to, scale_to); | 453 | | } | 454 | | return false; | 455 | | } | 456 | | } | 457 | 148 | to = ToCppT(from.value); | 458 | 148 | } | 459 | 148 | return true; | 460 | 148 | } |
Unexecuted instantiation: _ZN5doris13CastToDecimal24_from_decimal_same_scaleINS_7DecimalIiEENS_12Decimal128V3EnLb1EQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RNS_14CastParametersE _ZN5doris13CastToDecimal24_from_decimal_same_scaleINS_7DecimalIlEENS_12Decimal128V3EnLb0EQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RNS_14CastParametersE Line | Count | Source | 431 | 256 | CastParameters& params) { | 432 | | if constexpr (IsDecimal128V2<FromCppT>) { | 433 | | if constexpr (narrow_integral) { | 434 | | if (UNLIKELY(from.value() > max_result || from.value() < -max_result)) { | 435 | | if (params.is_strict) { | 436 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 437 | | decimal_to_string(from.value(), scale_from), | 438 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 439 | | precision_to, scale_to); | 440 | | } | 441 | | return false; | 442 | | } | 443 | | } | 444 | | to = ToCppT(from.value()); | 445 | 256 | } else { | 446 | | if constexpr (narrow_integral) { | 447 | | if (UNLIKELY(from.value > max_result || from.value < -max_result)) { | 448 | | if (params.is_strict) { | 449 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 450 | | decimal_to_string(from.value, scale_from), | 451 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 452 | | precision_to, scale_to); | 453 | | } | 454 | | return false; | 455 | | } | 456 | | } | 457 | 256 | to = ToCppT(from.value); | 458 | 256 | } | 459 | 256 | return true; | 460 | 256 | } |
Unexecuted instantiation: _ZN5doris13CastToDecimal24_from_decimal_same_scaleINS_7DecimalIlEENS_12Decimal128V3EnLb1EQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RNS_14CastParametersE _ZN5doris13CastToDecimal24_from_decimal_same_scaleINS_12Decimal128V3ES2_nLb0EQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS4_jjRS3_jjRKNS3_10NativeTypeESA_RNS_14CastParametersE Line | Count | Source | 431 | 62 | CastParameters& params) { | 432 | | if constexpr (IsDecimal128V2<FromCppT>) { | 433 | | if constexpr (narrow_integral) { | 434 | | if (UNLIKELY(from.value() > max_result || from.value() < -max_result)) { | 435 | | if (params.is_strict) { | 436 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 437 | | decimal_to_string(from.value(), scale_from), | 438 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 439 | | precision_to, scale_to); | 440 | | } | 441 | | return false; | 442 | | } | 443 | | } | 444 | | to = ToCppT(from.value()); | 445 | 62 | } else { | 446 | | if constexpr (narrow_integral) { | 447 | | if (UNLIKELY(from.value > max_result || from.value < -max_result)) { | 448 | | if (params.is_strict) { | 449 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 450 | | decimal_to_string(from.value, scale_from), | 451 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 452 | | precision_to, scale_to); | 453 | | } | 454 | | return false; | 455 | | } | 456 | | } | 457 | 62 | to = ToCppT(from.value); | 458 | 62 | } | 459 | 62 | return true; | 460 | 62 | } |
_ZN5doris13CastToDecimal24_from_decimal_same_scaleINS_12Decimal128V3ES2_nLb1EQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS4_jjRS3_jjRKNS3_10NativeTypeESA_RNS_14CastParametersE Line | Count | Source | 431 | 84 | CastParameters& params) { | 432 | | if constexpr (IsDecimal128V2<FromCppT>) { | 433 | | if constexpr (narrow_integral) { | 434 | | if (UNLIKELY(from.value() > max_result || from.value() < -max_result)) { | 435 | | if (params.is_strict) { | 436 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 437 | | decimal_to_string(from.value(), scale_from), | 438 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 439 | | precision_to, scale_to); | 440 | | } | 441 | | return false; | 442 | | } | 443 | | } | 444 | | to = ToCppT(from.value()); | 445 | 84 | } else { | 446 | 84 | if constexpr (narrow_integral) { | 447 | 84 | if (UNLIKELY(from.value > max_result || from.value < -max_result)) { | 448 | 24 | if (params.is_strict) { | 449 | 12 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 450 | 12 | decimal_to_string(from.value, scale_from), | 451 | 12 | fmt::format("decimal({}, {})", precision_from, scale_from), | 452 | 12 | precision_to, scale_to); | 453 | 12 | } | 454 | 24 | return false; | 455 | 24 | } | 456 | 84 | } | 457 | 60 | to = ToCppT(from.value); | 458 | 84 | } | 459 | 0 | return true; | 460 | 84 | } |
Unexecuted instantiation: _ZN5doris13CastToDecimal24_from_decimal_same_scaleINS_7DecimalIN4wide7integerILm256EiEEEENS_12Decimal128V3ES5_Lb0EQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKNS8_10NativeTypeESF_RNS_14CastParametersE _ZN5doris13CastToDecimal24_from_decimal_same_scaleINS_7DecimalIN4wide7integerILm256EiEEEENS_12Decimal128V3ES5_Lb1EQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKNS8_10NativeTypeESF_RNS_14CastParametersE Line | Count | Source | 431 | 364 | CastParameters& params) { | 432 | | if constexpr (IsDecimal128V2<FromCppT>) { | 433 | | if constexpr (narrow_integral) { | 434 | | if (UNLIKELY(from.value() > max_result || from.value() < -max_result)) { | 435 | | if (params.is_strict) { | 436 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 437 | | decimal_to_string(from.value(), scale_from), | 438 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 439 | | precision_to, scale_to); | 440 | | } | 441 | | return false; | 442 | | } | 443 | | } | 444 | | to = ToCppT(from.value()); | 445 | 364 | } else { | 446 | 364 | if constexpr (narrow_integral) { | 447 | 364 | if (UNLIKELY(from.value > max_result || from.value < -max_result)) { | 448 | 108 | if (params.is_strict) { | 449 | 54 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 450 | 54 | decimal_to_string(from.value, scale_from), | 451 | 54 | fmt::format("decimal({}, {})", precision_from, scale_from), | 452 | 54 | precision_to, scale_to); | 453 | 54 | } | 454 | 108 | return false; | 455 | 108 | } | 456 | 364 | } | 457 | 256 | to = ToCppT(from.value); | 458 | 364 | } | 459 | 0 | return true; | 460 | 364 | } |
_ZN5doris13CastToDecimal24_from_decimal_same_scaleINS_7DecimalIiEENS2_IN4wide7integerILm256EiEEEES6_Lb0EQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKNS8_10NativeTypeESF_RNS_14CastParametersE Line | Count | Source | 431 | 148 | CastParameters& params) { | 432 | | if constexpr (IsDecimal128V2<FromCppT>) { | 433 | | if constexpr (narrow_integral) { | 434 | | if (UNLIKELY(from.value() > max_result || from.value() < -max_result)) { | 435 | | if (params.is_strict) { | 436 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 437 | | decimal_to_string(from.value(), scale_from), | 438 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 439 | | precision_to, scale_to); | 440 | | } | 441 | | return false; | 442 | | } | 443 | | } | 444 | | to = ToCppT(from.value()); | 445 | 148 | } else { | 446 | | if constexpr (narrow_integral) { | 447 | | if (UNLIKELY(from.value > max_result || from.value < -max_result)) { | 448 | | if (params.is_strict) { | 449 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 450 | | decimal_to_string(from.value, scale_from), | 451 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 452 | | precision_to, scale_to); | 453 | | } | 454 | | return false; | 455 | | } | 456 | | } | 457 | 148 | to = ToCppT(from.value); | 458 | 148 | } | 459 | 148 | return true; | 460 | 148 | } |
Unexecuted instantiation: _ZN5doris13CastToDecimal24_from_decimal_same_scaleINS_7DecimalIiEENS2_IN4wide7integerILm256EiEEEES6_Lb1EQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKNS8_10NativeTypeESF_RNS_14CastParametersE _ZN5doris13CastToDecimal24_from_decimal_same_scaleINS_7DecimalIlEENS2_IN4wide7integerILm256EiEEEES6_Lb0EQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKNS8_10NativeTypeESF_RNS_14CastParametersE Line | Count | Source | 431 | 240 | CastParameters& params) { | 432 | | if constexpr (IsDecimal128V2<FromCppT>) { | 433 | | if constexpr (narrow_integral) { | 434 | | if (UNLIKELY(from.value() > max_result || from.value() < -max_result)) { | 435 | | if (params.is_strict) { | 436 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 437 | | decimal_to_string(from.value(), scale_from), | 438 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 439 | | precision_to, scale_to); | 440 | | } | 441 | | return false; | 442 | | } | 443 | | } | 444 | | to = ToCppT(from.value()); | 445 | 240 | } else { | 446 | | if constexpr (narrow_integral) { | 447 | | if (UNLIKELY(from.value > max_result || from.value < -max_result)) { | 448 | | if (params.is_strict) { | 449 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 450 | | decimal_to_string(from.value, scale_from), | 451 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 452 | | precision_to, scale_to); | 453 | | } | 454 | | return false; | 455 | | } | 456 | | } | 457 | 240 | to = ToCppT(from.value); | 458 | 240 | } | 459 | 240 | return true; | 460 | 240 | } |
Unexecuted instantiation: _ZN5doris13CastToDecimal24_from_decimal_same_scaleINS_7DecimalIlEENS2_IN4wide7integerILm256EiEEEES6_Lb1EQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKNS8_10NativeTypeESF_RNS_14CastParametersE _ZN5doris13CastToDecimal24_from_decimal_same_scaleINS_12Decimal128V3ENS_7DecimalIN4wide7integerILm256EiEEEES6_Lb0EQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKNS8_10NativeTypeESF_RNS_14CastParametersE Line | Count | Source | 431 | 256 | CastParameters& params) { | 432 | | if constexpr (IsDecimal128V2<FromCppT>) { | 433 | | if constexpr (narrow_integral) { | 434 | | if (UNLIKELY(from.value() > max_result || from.value() < -max_result)) { | 435 | | if (params.is_strict) { | 436 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 437 | | decimal_to_string(from.value(), scale_from), | 438 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 439 | | precision_to, scale_to); | 440 | | } | 441 | | return false; | 442 | | } | 443 | | } | 444 | | to = ToCppT(from.value()); | 445 | 256 | } else { | 446 | | if constexpr (narrow_integral) { | 447 | | if (UNLIKELY(from.value > max_result || from.value < -max_result)) { | 448 | | if (params.is_strict) { | 449 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 450 | | decimal_to_string(from.value, scale_from), | 451 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 452 | | precision_to, scale_to); | 453 | | } | 454 | | return false; | 455 | | } | 456 | | } | 457 | 256 | to = ToCppT(from.value); | 458 | 256 | } | 459 | 256 | return true; | 460 | 256 | } |
Unexecuted instantiation: _ZN5doris13CastToDecimal24_from_decimal_same_scaleINS_12Decimal128V3ENS_7DecimalIN4wide7integerILm256EiEEEES6_Lb1EQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKNS8_10NativeTypeESF_RNS_14CastParametersE _ZN5doris13CastToDecimal24_from_decimal_same_scaleINS_7DecimalIN4wide7integerILm256EiEEEES6_S5_Lb0EQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS8_jjRS7_jjRKNS7_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 431 | 60 | CastParameters& params) { | 432 | | if constexpr (IsDecimal128V2<FromCppT>) { | 433 | | if constexpr (narrow_integral) { | 434 | | if (UNLIKELY(from.value() > max_result || from.value() < -max_result)) { | 435 | | if (params.is_strict) { | 436 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 437 | | decimal_to_string(from.value(), scale_from), | 438 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 439 | | precision_to, scale_to); | 440 | | } | 441 | | return false; | 442 | | } | 443 | | } | 444 | | to = ToCppT(from.value()); | 445 | 60 | } else { | 446 | | if constexpr (narrow_integral) { | 447 | | if (UNLIKELY(from.value > max_result || from.value < -max_result)) { | 448 | | if (params.is_strict) { | 449 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 450 | | decimal_to_string(from.value, scale_from), | 451 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 452 | | precision_to, scale_to); | 453 | | } | 454 | | return false; | 455 | | } | 456 | | } | 457 | 60 | to = ToCppT(from.value); | 458 | 60 | } | 459 | 60 | return true; | 460 | 60 | } |
_ZN5doris13CastToDecimal24_from_decimal_same_scaleINS_7DecimalIN4wide7integerILm256EiEEEES6_S5_Lb1EQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS8_jjRS7_jjRKNS7_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 431 | 84 | CastParameters& params) { | 432 | | if constexpr (IsDecimal128V2<FromCppT>) { | 433 | | if constexpr (narrow_integral) { | 434 | | if (UNLIKELY(from.value() > max_result || from.value() < -max_result)) { | 435 | | if (params.is_strict) { | 436 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 437 | | decimal_to_string(from.value(), scale_from), | 438 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 439 | | precision_to, scale_to); | 440 | | } | 441 | | return false; | 442 | | } | 443 | | } | 444 | | to = ToCppT(from.value()); | 445 | 84 | } else { | 446 | 84 | if constexpr (narrow_integral) { | 447 | 84 | if (UNLIKELY(from.value > max_result || from.value < -max_result)) { | 448 | 24 | if (params.is_strict) { | 449 | 12 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 450 | 12 | decimal_to_string(from.value, scale_from), | 451 | 12 | fmt::format("decimal({}, {})", precision_from, scale_from), | 452 | 12 | precision_to, scale_to); | 453 | 12 | } | 454 | 24 | return false; | 455 | 24 | } | 456 | 84 | } | 457 | 60 | to = ToCppT(from.value); | 458 | 84 | } | 459 | 0 | return true; | 460 | 84 | } |
_ZN5doris13CastToDecimal24_from_decimal_same_scaleINS_14DecimalV2ValueENS_7DecimalIiEEnLb0EQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RNS_14CastParametersE Line | Count | Source | 431 | 8 | CastParameters& params) { | 432 | 8 | if constexpr (IsDecimal128V2<FromCppT>) { | 433 | | if constexpr (narrow_integral) { | 434 | | if (UNLIKELY(from.value() > max_result || from.value() < -max_result)) { | 435 | | if (params.is_strict) { | 436 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 437 | | decimal_to_string(from.value(), scale_from), | 438 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 439 | | precision_to, scale_to); | 440 | | } | 441 | | return false; | 442 | | } | 443 | | } | 444 | 8 | to = ToCppT(from.value()); | 445 | | } else { | 446 | | if constexpr (narrow_integral) { | 447 | | if (UNLIKELY(from.value > max_result || from.value < -max_result)) { | 448 | | if (params.is_strict) { | 449 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 450 | | decimal_to_string(from.value, scale_from), | 451 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 452 | | precision_to, scale_to); | 453 | | } | 454 | | return false; | 455 | | } | 456 | | } | 457 | | to = ToCppT(from.value); | 458 | | } | 459 | 8 | return true; | 460 | 8 | } |
_ZN5doris13CastToDecimal24_from_decimal_same_scaleINS_14DecimalV2ValueENS_7DecimalIiEEnLb1EQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RNS_14CastParametersE Line | Count | Source | 431 | 70 | CastParameters& params) { | 432 | 70 | if constexpr (IsDecimal128V2<FromCppT>) { | 433 | 70 | if constexpr (narrow_integral) { | 434 | 70 | if (UNLIKELY(from.value() > max_result || from.value() < -max_result)) { | 435 | 36 | if (params.is_strict) { | 436 | 18 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 437 | 18 | decimal_to_string(from.value(), scale_from), | 438 | 18 | fmt::format("decimal({}, {})", precision_from, scale_from), | 439 | 18 | precision_to, scale_to); | 440 | 18 | } | 441 | 36 | return false; | 442 | 36 | } | 443 | 70 | } | 444 | 34 | to = ToCppT(from.value()); | 445 | | } else { | 446 | | if constexpr (narrow_integral) { | 447 | | if (UNLIKELY(from.value > max_result || from.value < -max_result)) { | 448 | | if (params.is_strict) { | 449 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 450 | | decimal_to_string(from.value, scale_from), | 451 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 452 | | precision_to, scale_to); | 453 | | } | 454 | | return false; | 455 | | } | 456 | | } | 457 | | to = ToCppT(from.value); | 458 | | } | 459 | 0 | return true; | 460 | 70 | } |
_ZN5doris13CastToDecimal24_from_decimal_same_scaleINS_14DecimalV2ValueENS_7DecimalIlEEnLb0EQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RNS_14CastParametersE Line | Count | Source | 431 | 14 | CastParameters& params) { | 432 | 14 | if constexpr (IsDecimal128V2<FromCppT>) { | 433 | | if constexpr (narrow_integral) { | 434 | | if (UNLIKELY(from.value() > max_result || from.value() < -max_result)) { | 435 | | if (params.is_strict) { | 436 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 437 | | decimal_to_string(from.value(), scale_from), | 438 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 439 | | precision_to, scale_to); | 440 | | } | 441 | | return false; | 442 | | } | 443 | | } | 444 | 14 | to = ToCppT(from.value()); | 445 | | } else { | 446 | | if constexpr (narrow_integral) { | 447 | | if (UNLIKELY(from.value > max_result || from.value < -max_result)) { | 448 | | if (params.is_strict) { | 449 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 450 | | decimal_to_string(from.value, scale_from), | 451 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 452 | | precision_to, scale_to); | 453 | | } | 454 | | return false; | 455 | | } | 456 | | } | 457 | | to = ToCppT(from.value); | 458 | | } | 459 | 14 | return true; | 460 | 14 | } |
_ZN5doris13CastToDecimal24_from_decimal_same_scaleINS_14DecimalV2ValueENS_7DecimalIlEEnLb1EQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RNS_14CastParametersE Line | Count | Source | 431 | 120 | CastParameters& params) { | 432 | 120 | if constexpr (IsDecimal128V2<FromCppT>) { | 433 | 120 | if constexpr (narrow_integral) { | 434 | 120 | if (UNLIKELY(from.value() > max_result || from.value() < -max_result)) { | 435 | 24 | if (params.is_strict) { | 436 | 12 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 437 | 12 | decimal_to_string(from.value(), scale_from), | 438 | 12 | fmt::format("decimal({}, {})", precision_from, scale_from), | 439 | 12 | precision_to, scale_to); | 440 | 12 | } | 441 | 24 | return false; | 442 | 24 | } | 443 | 120 | } | 444 | 96 | to = ToCppT(from.value()); | 445 | | } else { | 446 | | if constexpr (narrow_integral) { | 447 | | if (UNLIKELY(from.value > max_result || from.value < -max_result)) { | 448 | | if (params.is_strict) { | 449 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 450 | | decimal_to_string(from.value, scale_from), | 451 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 452 | | precision_to, scale_to); | 453 | | } | 454 | | return false; | 455 | | } | 456 | | } | 457 | | to = ToCppT(from.value); | 458 | | } | 459 | 0 | return true; | 460 | 120 | } |
Unexecuted instantiation: _ZN5doris13CastToDecimal24_from_decimal_same_scaleINS_14DecimalV2ValueENS_12Decimal128V3EnLb0EQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKNS4_10NativeTypeESB_RNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal24_from_decimal_same_scaleINS_14DecimalV2ValueENS_12Decimal128V3EnLb1EQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKNS4_10NativeTypeESB_RNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal24_from_decimal_same_scaleINS_14DecimalV2ValueENS_7DecimalIN4wide7integerILm256EiEEEES6_Lb0EQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKNS8_10NativeTypeESF_RNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal24_from_decimal_same_scaleINS_14DecimalV2ValueENS_7DecimalIN4wide7integerILm256EiEEEES6_Lb1EQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKNS8_10NativeTypeESF_RNS_14CastParametersE |
461 | | |
462 | | template < |
463 | | typename FromCppT, typename ToCppT, bool multiply_may_overflow, bool narrow_integral, |
464 | | typename MaxNativeType = std::conditional_t< |
465 | | (sizeof(FromCppT) == sizeof(ToCppT)) && |
466 | | (std::is_same_v<ToCppT, Decimal128V3> || |
467 | | std::is_same_v<FromCppT, Decimal128V3>), |
468 | | Decimal128V3::NativeType, |
469 | | std::conditional_t<(sizeof(FromCppT) > sizeof(ToCppT)), |
470 | | typename FromCppT::NativeType, typename ToCppT::NativeType>>> |
471 | | requires(IsDecimalNumber<ToCppT> && IsDecimalNumber<FromCppT>) |
472 | | static inline bool _from_decimal_bigger_scale(const FromCppT& from, const UInt32 precision_from, |
473 | | const UInt32 scale_from, ToCppT& to, |
474 | | UInt32 precision_to, UInt32 scale_to, |
475 | | const MaxNativeType& scale_multiplier, |
476 | | const typename ToCppT::NativeType& min_result, |
477 | | const typename ToCppT::NativeType& max_result, |
478 | 16.7k | CastParameters& params) { |
479 | 16.7k | MaxNativeType res; |
480 | 16.7k | if (from >= FromCppT(0)) { |
481 | 16.7k | if constexpr (narrow_integral) { |
482 | 6.66k | if constexpr (IsDecimal128V2<FromCppT>) { |
483 | 1.67k | res = (from.value() + scale_multiplier / 2) / scale_multiplier; |
484 | 1.67k | if (UNLIKELY(res > max_result)) { |
485 | 488 | if (params.is_strict) { |
486 | 244 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( |
487 | 244 | decimal_to_string(from.value(), scale_from), |
488 | 244 | fmt::format("decimal({}, {})", precision_from, scale_from), |
489 | 244 | precision_to, scale_to); |
490 | 244 | } |
491 | 488 | return false; |
492 | 488 | } |
493 | 4.98k | } else { |
494 | 4.98k | res = (from.value + scale_multiplier / 2) / scale_multiplier; |
495 | 4.98k | if (UNLIKELY(res > max_result)) { |
496 | 2.07k | if (params.is_strict) { |
497 | 1.03k | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( |
498 | 1.03k | decimal_to_string(from.value, scale_from), |
499 | 1.03k | fmt::format("decimal({}, {})", precision_from, scale_from), |
500 | 1.03k | precision_to, scale_to); |
501 | 1.03k | } |
502 | 2.07k | return false; |
503 | 2.07k | } |
504 | 4.98k | } |
505 | 4.09k | to = ToCppT(res); |
506 | 10.1k | } else { |
507 | 10.1k | if constexpr (IsDecimal128V2<FromCppT>) { |
508 | 1.86k | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); |
509 | 8.24k | } else { |
510 | 8.24k | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); |
511 | 8.24k | } |
512 | 10.1k | } |
513 | 16.7k | } else { |
514 | 0 | if constexpr (narrow_integral) { |
515 | 0 | if constexpr (IsDecimal128V2<FromCppT>) { |
516 | 0 | res = (from.value() - scale_multiplier / 2) / scale_multiplier; |
517 | 0 | if (UNLIKELY(res < -max_result)) { |
518 | 0 | if (params.is_strict) { |
519 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( |
520 | 0 | decimal_to_string(from.value(), scale_from), |
521 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), |
522 | 0 | precision_to, scale_to); |
523 | 0 | } |
524 | 0 | return false; |
525 | 0 | } |
526 | 0 | } else { |
527 | 0 | res = (from.value - scale_multiplier / 2) / scale_multiplier; |
528 | 0 | if (UNLIKELY(res < -max_result)) { |
529 | 0 | if (params.is_strict) { |
530 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( |
531 | 0 | decimal_to_string(from.value, scale_from), |
532 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), |
533 | 0 | precision_to, scale_to); |
534 | 0 | } |
535 | 0 | return false; |
536 | 0 | } |
537 | 0 | } |
538 | 0 | to = ToCppT(res); |
539 | 0 | } else { |
540 | 0 | if constexpr (IsDecimal128V2<FromCppT>) { |
541 | 0 | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); |
542 | 0 | } else { |
543 | 0 | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); |
544 | 0 | } |
545 | 0 | } |
546 | 0 | } |
547 | 0 | return true; |
548 | 16.7k | } _ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_7DecimalIiEES3_Lb0ELb0EiQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 478 | 224 | CastParameters& params) { | 479 | 224 | MaxNativeType res; | 480 | 224 | if (from >= FromCppT(0)) { | 481 | | if constexpr (narrow_integral) { | 482 | | if constexpr (IsDecimal128V2<FromCppT>) { | 483 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 484 | | if (UNLIKELY(res > max_result)) { | 485 | | if (params.is_strict) { | 486 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 487 | | decimal_to_string(from.value(), scale_from), | 488 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 489 | | precision_to, scale_to); | 490 | | } | 491 | | return false; | 492 | | } | 493 | | } else { | 494 | | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 495 | | if (UNLIKELY(res > max_result)) { | 496 | | if (params.is_strict) { | 497 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 498 | | decimal_to_string(from.value, scale_from), | 499 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 500 | | precision_to, scale_to); | 501 | | } | 502 | | return false; | 503 | | } | 504 | | } | 505 | | to = ToCppT(res); | 506 | 224 | } else { | 507 | | if constexpr (IsDecimal128V2<FromCppT>) { | 508 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 509 | 224 | } else { | 510 | 224 | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 511 | 224 | } | 512 | 224 | } | 513 | 224 | } else { | 514 | | if constexpr (narrow_integral) { | 515 | | if constexpr (IsDecimal128V2<FromCppT>) { | 516 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 517 | | if (UNLIKELY(res < -max_result)) { | 518 | | if (params.is_strict) { | 519 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 520 | | decimal_to_string(from.value(), scale_from), | 521 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 522 | | precision_to, scale_to); | 523 | | } | 524 | | return false; | 525 | | } | 526 | | } else { | 527 | | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 528 | | if (UNLIKELY(res < -max_result)) { | 529 | | if (params.is_strict) { | 530 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 531 | | decimal_to_string(from.value, scale_from), | 532 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 533 | | precision_to, scale_to); | 534 | | } | 535 | | return false; | 536 | | } | 537 | | } | 538 | | to = ToCppT(res); | 539 | 0 | } else { | 540 | | if constexpr (IsDecimal128V2<FromCppT>) { | 541 | | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 542 | 0 | } else { | 543 | 0 | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 544 | 0 | } | 545 | 0 | } | 546 | 0 | } | 547 | 224 | return true; | 548 | 224 | } |
_ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_7DecimalIiEES3_Lb0ELb1EiQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 478 | 164 | CastParameters& params) { | 479 | 164 | MaxNativeType res; | 480 | 164 | if (from >= FromCppT(0)) { | 481 | 164 | if constexpr (narrow_integral) { | 482 | | if constexpr (IsDecimal128V2<FromCppT>) { | 483 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 484 | | if (UNLIKELY(res > max_result)) { | 485 | | if (params.is_strict) { | 486 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 487 | | decimal_to_string(from.value(), scale_from), | 488 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 489 | | precision_to, scale_to); | 490 | | } | 491 | | return false; | 492 | | } | 493 | 164 | } else { | 494 | 164 | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 495 | 164 | if (UNLIKELY(res > max_result)) { | 496 | 80 | if (params.is_strict) { | 497 | 40 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 498 | 40 | decimal_to_string(from.value, scale_from), | 499 | 40 | fmt::format("decimal({}, {})", precision_from, scale_from), | 500 | 40 | precision_to, scale_to); | 501 | 40 | } | 502 | 80 | return false; | 503 | 80 | } | 504 | 164 | } | 505 | 84 | to = ToCppT(res); | 506 | | } else { | 507 | | if constexpr (IsDecimal128V2<FromCppT>) { | 508 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 509 | | } else { | 510 | | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 511 | | } | 512 | | } | 513 | 164 | } else { | 514 | 0 | if constexpr (narrow_integral) { | 515 | | if constexpr (IsDecimal128V2<FromCppT>) { | 516 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 517 | | if (UNLIKELY(res < -max_result)) { | 518 | | if (params.is_strict) { | 519 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 520 | | decimal_to_string(from.value(), scale_from), | 521 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 522 | | precision_to, scale_to); | 523 | | } | 524 | | return false; | 525 | | } | 526 | 0 | } else { | 527 | 0 | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 528 | 0 | if (UNLIKELY(res < -max_result)) { | 529 | 0 | if (params.is_strict) { | 530 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 531 | 0 | decimal_to_string(from.value, scale_from), | 532 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 533 | 0 | precision_to, scale_to); | 534 | 0 | } | 535 | 0 | return false; | 536 | 0 | } | 537 | 0 | } | 538 | 0 | to = ToCppT(res); | 539 | | } else { | 540 | | if constexpr (IsDecimal128V2<FromCppT>) { | 541 | | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 542 | | } else { | 543 | | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 544 | | } | 545 | | } | 546 | 0 | } | 547 | 0 | return true; | 548 | 164 | } |
Unexecuted instantiation: _ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_7DecimalIiEES3_Lb1ELb0EiQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_7DecimalIiEES3_Lb1ELb1EiQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE _ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_7DecimalIlEENS2_IiEELb0ELb0ElQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKT3_RKNS5_10NativeTypeESF_RNS_14CastParametersE Line | Count | Source | 478 | 320 | CastParameters& params) { | 479 | 320 | MaxNativeType res; | 480 | 320 | if (from >= FromCppT(0)) { | 481 | | if constexpr (narrow_integral) { | 482 | | if constexpr (IsDecimal128V2<FromCppT>) { | 483 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 484 | | if (UNLIKELY(res > max_result)) { | 485 | | if (params.is_strict) { | 486 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 487 | | decimal_to_string(from.value(), scale_from), | 488 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 489 | | precision_to, scale_to); | 490 | | } | 491 | | return false; | 492 | | } | 493 | | } else { | 494 | | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 495 | | if (UNLIKELY(res > max_result)) { | 496 | | if (params.is_strict) { | 497 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 498 | | decimal_to_string(from.value, scale_from), | 499 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 500 | | precision_to, scale_to); | 501 | | } | 502 | | return false; | 503 | | } | 504 | | } | 505 | | to = ToCppT(res); | 506 | 320 | } else { | 507 | | if constexpr (IsDecimal128V2<FromCppT>) { | 508 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 509 | 320 | } else { | 510 | 320 | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 511 | 320 | } | 512 | 320 | } | 513 | 320 | } else { | 514 | | if constexpr (narrow_integral) { | 515 | | if constexpr (IsDecimal128V2<FromCppT>) { | 516 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 517 | | if (UNLIKELY(res < -max_result)) { | 518 | | if (params.is_strict) { | 519 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 520 | | decimal_to_string(from.value(), scale_from), | 521 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 522 | | precision_to, scale_to); | 523 | | } | 524 | | return false; | 525 | | } | 526 | | } else { | 527 | | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 528 | | if (UNLIKELY(res < -max_result)) { | 529 | | if (params.is_strict) { | 530 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 531 | | decimal_to_string(from.value, scale_from), | 532 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 533 | | precision_to, scale_to); | 534 | | } | 535 | | return false; | 536 | | } | 537 | | } | 538 | | to = ToCppT(res); | 539 | 0 | } else { | 540 | | if constexpr (IsDecimal128V2<FromCppT>) { | 541 | | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 542 | 0 | } else { | 543 | 0 | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 544 | 0 | } | 545 | 0 | } | 546 | 0 | } | 547 | 320 | return true; | 548 | 320 | } |
_ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_7DecimalIlEENS2_IiEELb0ELb1ElQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKT3_RKNS5_10NativeTypeESF_RNS_14CastParametersE Line | Count | Source | 478 | 646 | CastParameters& params) { | 479 | 646 | MaxNativeType res; | 480 | 646 | if (from >= FromCppT(0)) { | 481 | 646 | if constexpr (narrow_integral) { | 482 | | if constexpr (IsDecimal128V2<FromCppT>) { | 483 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 484 | | if (UNLIKELY(res > max_result)) { | 485 | | if (params.is_strict) { | 486 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 487 | | decimal_to_string(from.value(), scale_from), | 488 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 489 | | precision_to, scale_to); | 490 | | } | 491 | | return false; | 492 | | } | 493 | 646 | } else { | 494 | 646 | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 495 | 646 | if (UNLIKELY(res > max_result)) { | 496 | 266 | if (params.is_strict) { | 497 | 132 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 498 | 132 | decimal_to_string(from.value, scale_from), | 499 | 132 | fmt::format("decimal({}, {})", precision_from, scale_from), | 500 | 132 | precision_to, scale_to); | 501 | 132 | } | 502 | 266 | return false; | 503 | 266 | } | 504 | 646 | } | 505 | 380 | to = ToCppT(res); | 506 | | } else { | 507 | | if constexpr (IsDecimal128V2<FromCppT>) { | 508 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 509 | | } else { | 510 | | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 511 | | } | 512 | | } | 513 | 646 | } else { | 514 | 0 | if constexpr (narrow_integral) { | 515 | | if constexpr (IsDecimal128V2<FromCppT>) { | 516 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 517 | | if (UNLIKELY(res < -max_result)) { | 518 | | if (params.is_strict) { | 519 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 520 | | decimal_to_string(from.value(), scale_from), | 521 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 522 | | precision_to, scale_to); | 523 | | } | 524 | | return false; | 525 | | } | 526 | 0 | } else { | 527 | 0 | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 528 | 0 | if (UNLIKELY(res < -max_result)) { | 529 | 0 | if (params.is_strict) { | 530 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 531 | 0 | decimal_to_string(from.value, scale_from), | 532 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 533 | 0 | precision_to, scale_to); | 534 | 0 | } | 535 | 0 | return false; | 536 | 0 | } | 537 | 0 | } | 538 | 0 | to = ToCppT(res); | 539 | | } else { | 540 | | if constexpr (IsDecimal128V2<FromCppT>) { | 541 | | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 542 | | } else { | 543 | | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 544 | | } | 545 | | } | 546 | 0 | } | 547 | 0 | return true; | 548 | 646 | } |
Unexecuted instantiation: _ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_7DecimalIlEENS2_IiEELb1ELb0ElQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKT3_RKNS5_10NativeTypeESF_RNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_7DecimalIlEENS2_IiEELb1ELb1ElQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKT3_RKNS5_10NativeTypeESF_RNS_14CastParametersE _ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_12Decimal128V3ENS_7DecimalIiEELb0ELb0EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKT3_RKNS5_10NativeTypeESF_RNS_14CastParametersE Line | Count | Source | 478 | 320 | CastParameters& params) { | 479 | 320 | MaxNativeType res; | 480 | 320 | if (from >= FromCppT(0)) { | 481 | | if constexpr (narrow_integral) { | 482 | | if constexpr (IsDecimal128V2<FromCppT>) { | 483 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 484 | | if (UNLIKELY(res > max_result)) { | 485 | | if (params.is_strict) { | 486 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 487 | | decimal_to_string(from.value(), scale_from), | 488 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 489 | | precision_to, scale_to); | 490 | | } | 491 | | return false; | 492 | | } | 493 | | } else { | 494 | | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 495 | | if (UNLIKELY(res > max_result)) { | 496 | | if (params.is_strict) { | 497 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 498 | | decimal_to_string(from.value, scale_from), | 499 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 500 | | precision_to, scale_to); | 501 | | } | 502 | | return false; | 503 | | } | 504 | | } | 505 | | to = ToCppT(res); | 506 | 320 | } else { | 507 | | if constexpr (IsDecimal128V2<FromCppT>) { | 508 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 509 | 320 | } else { | 510 | 320 | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 511 | 320 | } | 512 | 320 | } | 513 | 320 | } else { | 514 | | if constexpr (narrow_integral) { | 515 | | if constexpr (IsDecimal128V2<FromCppT>) { | 516 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 517 | | if (UNLIKELY(res < -max_result)) { | 518 | | if (params.is_strict) { | 519 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 520 | | decimal_to_string(from.value(), scale_from), | 521 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 522 | | precision_to, scale_to); | 523 | | } | 524 | | return false; | 525 | | } | 526 | | } else { | 527 | | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 528 | | if (UNLIKELY(res < -max_result)) { | 529 | | if (params.is_strict) { | 530 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 531 | | decimal_to_string(from.value, scale_from), | 532 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 533 | | precision_to, scale_to); | 534 | | } | 535 | | return false; | 536 | | } | 537 | | } | 538 | | to = ToCppT(res); | 539 | 0 | } else { | 540 | | if constexpr (IsDecimal128V2<FromCppT>) { | 541 | | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 542 | 0 | } else { | 543 | 0 | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 544 | 0 | } | 545 | 0 | } | 546 | 0 | } | 547 | 320 | return true; | 548 | 320 | } |
_ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_12Decimal128V3ENS_7DecimalIiEELb0ELb1EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKT3_RKNS5_10NativeTypeESF_RNS_14CastParametersE Line | Count | Source | 478 | 714 | CastParameters& params) { | 479 | 714 | MaxNativeType res; | 480 | 714 | if (from >= FromCppT(0)) { | 481 | 714 | if constexpr (narrow_integral) { | 482 | | if constexpr (IsDecimal128V2<FromCppT>) { | 483 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 484 | | if (UNLIKELY(res > max_result)) { | 485 | | if (params.is_strict) { | 486 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 487 | | decimal_to_string(from.value(), scale_from), | 488 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 489 | | precision_to, scale_to); | 490 | | } | 491 | | return false; | 492 | | } | 493 | 714 | } else { | 494 | 714 | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 495 | 714 | if (UNLIKELY(res > max_result)) { | 496 | 322 | if (params.is_strict) { | 497 | 160 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 498 | 160 | decimal_to_string(from.value, scale_from), | 499 | 160 | fmt::format("decimal({}, {})", precision_from, scale_from), | 500 | 160 | precision_to, scale_to); | 501 | 160 | } | 502 | 322 | return false; | 503 | 322 | } | 504 | 714 | } | 505 | 392 | to = ToCppT(res); | 506 | | } else { | 507 | | if constexpr (IsDecimal128V2<FromCppT>) { | 508 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 509 | | } else { | 510 | | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 511 | | } | 512 | | } | 513 | 714 | } else { | 514 | 0 | if constexpr (narrow_integral) { | 515 | | if constexpr (IsDecimal128V2<FromCppT>) { | 516 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 517 | | if (UNLIKELY(res < -max_result)) { | 518 | | if (params.is_strict) { | 519 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 520 | | decimal_to_string(from.value(), scale_from), | 521 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 522 | | precision_to, scale_to); | 523 | | } | 524 | | return false; | 525 | | } | 526 | 0 | } else { | 527 | 0 | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 528 | 0 | if (UNLIKELY(res < -max_result)) { | 529 | 0 | if (params.is_strict) { | 530 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 531 | 0 | decimal_to_string(from.value, scale_from), | 532 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 533 | 0 | precision_to, scale_to); | 534 | 0 | } | 535 | 0 | return false; | 536 | 0 | } | 537 | 0 | } | 538 | 0 | to = ToCppT(res); | 539 | | } else { | 540 | | if constexpr (IsDecimal128V2<FromCppT>) { | 541 | | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 542 | | } else { | 543 | | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 544 | | } | 545 | | } | 546 | 0 | } | 547 | 0 | return true; | 548 | 714 | } |
Unexecuted instantiation: _ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_12Decimal128V3ENS_7DecimalIiEELb1ELb0EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKT3_RKNS5_10NativeTypeESF_RNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_12Decimal128V3ENS_7DecimalIiEELb1ELb1EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKT3_RKNS5_10NativeTypeESF_RNS_14CastParametersE _ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_7DecimalIN4wide7integerILm256EiEEEENS2_IiEELb0ELb0ES5_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKT3_RKNS8_10NativeTypeESI_RNS_14CastParametersE Line | Count | Source | 478 | 320 | CastParameters& params) { | 479 | 320 | MaxNativeType res; | 480 | 320 | if (from >= FromCppT(0)) { | 481 | | if constexpr (narrow_integral) { | 482 | | if constexpr (IsDecimal128V2<FromCppT>) { | 483 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 484 | | if (UNLIKELY(res > max_result)) { | 485 | | if (params.is_strict) { | 486 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 487 | | decimal_to_string(from.value(), scale_from), | 488 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 489 | | precision_to, scale_to); | 490 | | } | 491 | | return false; | 492 | | } | 493 | | } else { | 494 | | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 495 | | if (UNLIKELY(res > max_result)) { | 496 | | if (params.is_strict) { | 497 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 498 | | decimal_to_string(from.value, scale_from), | 499 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 500 | | precision_to, scale_to); | 501 | | } | 502 | | return false; | 503 | | } | 504 | | } | 505 | | to = ToCppT(res); | 506 | 320 | } else { | 507 | | if constexpr (IsDecimal128V2<FromCppT>) { | 508 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 509 | 320 | } else { | 510 | 320 | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 511 | 320 | } | 512 | 320 | } | 513 | 320 | } else { | 514 | | if constexpr (narrow_integral) { | 515 | | if constexpr (IsDecimal128V2<FromCppT>) { | 516 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 517 | | if (UNLIKELY(res < -max_result)) { | 518 | | if (params.is_strict) { | 519 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 520 | | decimal_to_string(from.value(), scale_from), | 521 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 522 | | precision_to, scale_to); | 523 | | } | 524 | | return false; | 525 | | } | 526 | | } else { | 527 | | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 528 | | if (UNLIKELY(res < -max_result)) { | 529 | | if (params.is_strict) { | 530 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 531 | | decimal_to_string(from.value, scale_from), | 532 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 533 | | precision_to, scale_to); | 534 | | } | 535 | | return false; | 536 | | } | 537 | | } | 538 | | to = ToCppT(res); | 539 | 0 | } else { | 540 | | if constexpr (IsDecimal128V2<FromCppT>) { | 541 | | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 542 | 0 | } else { | 543 | 0 | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 544 | 0 | } | 545 | 0 | } | 546 | 0 | } | 547 | 320 | return true; | 548 | 320 | } |
_ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_7DecimalIN4wide7integerILm256EiEEEENS2_IiEELb0ELb1ES5_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKT3_RKNS8_10NativeTypeESI_RNS_14CastParametersE Line | Count | Source | 478 | 714 | CastParameters& params) { | 479 | 714 | MaxNativeType res; | 480 | 714 | if (from >= FromCppT(0)) { | 481 | 714 | if constexpr (narrow_integral) { | 482 | | if constexpr (IsDecimal128V2<FromCppT>) { | 483 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 484 | | if (UNLIKELY(res > max_result)) { | 485 | | if (params.is_strict) { | 486 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 487 | | decimal_to_string(from.value(), scale_from), | 488 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 489 | | precision_to, scale_to); | 490 | | } | 491 | | return false; | 492 | | } | 493 | 714 | } else { | 494 | 714 | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 495 | 714 | if (UNLIKELY(res > max_result)) { | 496 | 322 | if (params.is_strict) { | 497 | 160 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 498 | 160 | decimal_to_string(from.value, scale_from), | 499 | 160 | fmt::format("decimal({}, {})", precision_from, scale_from), | 500 | 160 | precision_to, scale_to); | 501 | 160 | } | 502 | 322 | return false; | 503 | 322 | } | 504 | 714 | } | 505 | 392 | to = ToCppT(res); | 506 | | } else { | 507 | | if constexpr (IsDecimal128V2<FromCppT>) { | 508 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 509 | | } else { | 510 | | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 511 | | } | 512 | | } | 513 | 714 | } else { | 514 | 0 | if constexpr (narrow_integral) { | 515 | | if constexpr (IsDecimal128V2<FromCppT>) { | 516 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 517 | | if (UNLIKELY(res < -max_result)) { | 518 | | if (params.is_strict) { | 519 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 520 | | decimal_to_string(from.value(), scale_from), | 521 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 522 | | precision_to, scale_to); | 523 | | } | 524 | | return false; | 525 | | } | 526 | 0 | } else { | 527 | 0 | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 528 | 0 | if (UNLIKELY(res < -max_result)) { | 529 | 0 | if (params.is_strict) { | 530 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 531 | 0 | decimal_to_string(from.value, scale_from), | 532 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 533 | 0 | precision_to, scale_to); | 534 | 0 | } | 535 | 0 | return false; | 536 | 0 | } | 537 | 0 | } | 538 | 0 | to = ToCppT(res); | 539 | | } else { | 540 | | if constexpr (IsDecimal128V2<FromCppT>) { | 541 | | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 542 | | } else { | 543 | | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 544 | | } | 545 | | } | 546 | 0 | } | 547 | 0 | return true; | 548 | 714 | } |
Unexecuted instantiation: _ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_7DecimalIN4wide7integerILm256EiEEEENS2_IiEELb1ELb0ES5_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKT3_RKNS8_10NativeTypeESI_RNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_7DecimalIN4wide7integerILm256EiEEEENS2_IiEELb1ELb1ES5_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKT3_RKNS8_10NativeTypeESI_RNS_14CastParametersE _ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_7DecimalIiEENS2_IlEELb0ELb0ElQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKT3_RKNS5_10NativeTypeESF_RNS_14CastParametersE Line | Count | Source | 478 | 368 | CastParameters& params) { | 479 | 368 | MaxNativeType res; | 480 | 368 | if (from >= FromCppT(0)) { | 481 | | if constexpr (narrow_integral) { | 482 | | if constexpr (IsDecimal128V2<FromCppT>) { | 483 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 484 | | if (UNLIKELY(res > max_result)) { | 485 | | if (params.is_strict) { | 486 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 487 | | decimal_to_string(from.value(), scale_from), | 488 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 489 | | precision_to, scale_to); | 490 | | } | 491 | | return false; | 492 | | } | 493 | | } else { | 494 | | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 495 | | if (UNLIKELY(res > max_result)) { | 496 | | if (params.is_strict) { | 497 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 498 | | decimal_to_string(from.value, scale_from), | 499 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 500 | | precision_to, scale_to); | 501 | | } | 502 | | return false; | 503 | | } | 504 | | } | 505 | | to = ToCppT(res); | 506 | 368 | } else { | 507 | | if constexpr (IsDecimal128V2<FromCppT>) { | 508 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 509 | 368 | } else { | 510 | 368 | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 511 | 368 | } | 512 | 368 | } | 513 | 368 | } else { | 514 | | if constexpr (narrow_integral) { | 515 | | if constexpr (IsDecimal128V2<FromCppT>) { | 516 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 517 | | if (UNLIKELY(res < -max_result)) { | 518 | | if (params.is_strict) { | 519 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 520 | | decimal_to_string(from.value(), scale_from), | 521 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 522 | | precision_to, scale_to); | 523 | | } | 524 | | return false; | 525 | | } | 526 | | } else { | 527 | | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 528 | | if (UNLIKELY(res < -max_result)) { | 529 | | if (params.is_strict) { | 530 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 531 | | decimal_to_string(from.value, scale_from), | 532 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 533 | | precision_to, scale_to); | 534 | | } | 535 | | return false; | 536 | | } | 537 | | } | 538 | | to = ToCppT(res); | 539 | 0 | } else { | 540 | | if constexpr (IsDecimal128V2<FromCppT>) { | 541 | | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 542 | 0 | } else { | 543 | 0 | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 544 | 0 | } | 545 | 0 | } | 546 | 0 | } | 547 | 368 | return true; | 548 | 368 | } |
Unexecuted instantiation: _ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_7DecimalIiEENS2_IlEELb0ELb1ElQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKT3_RKNS5_10NativeTypeESF_RNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_7DecimalIiEENS2_IlEELb1ELb0ElQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKT3_RKNS5_10NativeTypeESF_RNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_7DecimalIiEENS2_IlEELb1ELb1ElQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKT3_RKNS5_10NativeTypeESF_RNS_14CastParametersE _ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_7DecimalIlEES3_Lb0ELb0ElQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 478 | 704 | CastParameters& params) { | 479 | 704 | MaxNativeType res; | 480 | 704 | if (from >= FromCppT(0)) { | 481 | | if constexpr (narrow_integral) { | 482 | | if constexpr (IsDecimal128V2<FromCppT>) { | 483 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 484 | | if (UNLIKELY(res > max_result)) { | 485 | | if (params.is_strict) { | 486 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 487 | | decimal_to_string(from.value(), scale_from), | 488 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 489 | | precision_to, scale_to); | 490 | | } | 491 | | return false; | 492 | | } | 493 | | } else { | 494 | | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 495 | | if (UNLIKELY(res > max_result)) { | 496 | | if (params.is_strict) { | 497 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 498 | | decimal_to_string(from.value, scale_from), | 499 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 500 | | precision_to, scale_to); | 501 | | } | 502 | | return false; | 503 | | } | 504 | | } | 505 | | to = ToCppT(res); | 506 | 704 | } else { | 507 | | if constexpr (IsDecimal128V2<FromCppT>) { | 508 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 509 | 704 | } else { | 510 | 704 | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 511 | 704 | } | 512 | 704 | } | 513 | 704 | } else { | 514 | | if constexpr (narrow_integral) { | 515 | | if constexpr (IsDecimal128V2<FromCppT>) { | 516 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 517 | | if (UNLIKELY(res < -max_result)) { | 518 | | if (params.is_strict) { | 519 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 520 | | decimal_to_string(from.value(), scale_from), | 521 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 522 | | precision_to, scale_to); | 523 | | } | 524 | | return false; | 525 | | } | 526 | | } else { | 527 | | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 528 | | if (UNLIKELY(res < -max_result)) { | 529 | | if (params.is_strict) { | 530 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 531 | | decimal_to_string(from.value, scale_from), | 532 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 533 | | precision_to, scale_to); | 534 | | } | 535 | | return false; | 536 | | } | 537 | | } | 538 | | to = ToCppT(res); | 539 | 0 | } else { | 540 | | if constexpr (IsDecimal128V2<FromCppT>) { | 541 | | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 542 | 0 | } else { | 543 | 0 | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 544 | 0 | } | 545 | 0 | } | 546 | 0 | } | 547 | 704 | return true; | 548 | 704 | } |
_ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_7DecimalIlEES3_Lb0ELb1ElQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 478 | 192 | CastParameters& params) { | 479 | 192 | MaxNativeType res; | 480 | 192 | if (from >= FromCppT(0)) { | 481 | 192 | if constexpr (narrow_integral) { | 482 | | if constexpr (IsDecimal128V2<FromCppT>) { | 483 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 484 | | if (UNLIKELY(res > max_result)) { | 485 | | if (params.is_strict) { | 486 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 487 | | decimal_to_string(from.value(), scale_from), | 488 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 489 | | precision_to, scale_to); | 490 | | } | 491 | | return false; | 492 | | } | 493 | 192 | } else { | 494 | 192 | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 495 | 192 | if (UNLIKELY(res > max_result)) { | 496 | 80 | if (params.is_strict) { | 497 | 40 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 498 | 40 | decimal_to_string(from.value, scale_from), | 499 | 40 | fmt::format("decimal({}, {})", precision_from, scale_from), | 500 | 40 | precision_to, scale_to); | 501 | 40 | } | 502 | 80 | return false; | 503 | 80 | } | 504 | 192 | } | 505 | 112 | to = ToCppT(res); | 506 | | } else { | 507 | | if constexpr (IsDecimal128V2<FromCppT>) { | 508 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 509 | | } else { | 510 | | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 511 | | } | 512 | | } | 513 | 192 | } else { | 514 | 0 | if constexpr (narrow_integral) { | 515 | | if constexpr (IsDecimal128V2<FromCppT>) { | 516 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 517 | | if (UNLIKELY(res < -max_result)) { | 518 | | if (params.is_strict) { | 519 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 520 | | decimal_to_string(from.value(), scale_from), | 521 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 522 | | precision_to, scale_to); | 523 | | } | 524 | | return false; | 525 | | } | 526 | 0 | } else { | 527 | 0 | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 528 | 0 | if (UNLIKELY(res < -max_result)) { | 529 | 0 | if (params.is_strict) { | 530 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 531 | 0 | decimal_to_string(from.value, scale_from), | 532 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 533 | 0 | precision_to, scale_to); | 534 | 0 | } | 535 | 0 | return false; | 536 | 0 | } | 537 | 0 | } | 538 | 0 | to = ToCppT(res); | 539 | | } else { | 540 | | if constexpr (IsDecimal128V2<FromCppT>) { | 541 | | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 542 | | } else { | 543 | | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 544 | | } | 545 | | } | 546 | 0 | } | 547 | 0 | return true; | 548 | 192 | } |
Unexecuted instantiation: _ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_7DecimalIlEES3_Lb1ELb0ElQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_7DecimalIlEES3_Lb1ELb1ElQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE _ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_12Decimal128V3ENS_7DecimalIlEELb0ELb0EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKT3_RKNS5_10NativeTypeESF_RNS_14CastParametersE Line | Count | Source | 478 | 576 | CastParameters& params) { | 479 | 576 | MaxNativeType res; | 480 | 576 | if (from >= FromCppT(0)) { | 481 | | if constexpr (narrow_integral) { | 482 | | if constexpr (IsDecimal128V2<FromCppT>) { | 483 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 484 | | if (UNLIKELY(res > max_result)) { | 485 | | if (params.is_strict) { | 486 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 487 | | decimal_to_string(from.value(), scale_from), | 488 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 489 | | precision_to, scale_to); | 490 | | } | 491 | | return false; | 492 | | } | 493 | | } else { | 494 | | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 495 | | if (UNLIKELY(res > max_result)) { | 496 | | if (params.is_strict) { | 497 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 498 | | decimal_to_string(from.value, scale_from), | 499 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 500 | | precision_to, scale_to); | 501 | | } | 502 | | return false; | 503 | | } | 504 | | } | 505 | | to = ToCppT(res); | 506 | 576 | } else { | 507 | | if constexpr (IsDecimal128V2<FromCppT>) { | 508 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 509 | 576 | } else { | 510 | 576 | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 511 | 576 | } | 512 | 576 | } | 513 | 576 | } else { | 514 | | if constexpr (narrow_integral) { | 515 | | if constexpr (IsDecimal128V2<FromCppT>) { | 516 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 517 | | if (UNLIKELY(res < -max_result)) { | 518 | | if (params.is_strict) { | 519 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 520 | | decimal_to_string(from.value(), scale_from), | 521 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 522 | | precision_to, scale_to); | 523 | | } | 524 | | return false; | 525 | | } | 526 | | } else { | 527 | | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 528 | | if (UNLIKELY(res < -max_result)) { | 529 | | if (params.is_strict) { | 530 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 531 | | decimal_to_string(from.value, scale_from), | 532 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 533 | | precision_to, scale_to); | 534 | | } | 535 | | return false; | 536 | | } | 537 | | } | 538 | | to = ToCppT(res); | 539 | 0 | } else { | 540 | | if constexpr (IsDecimal128V2<FromCppT>) { | 541 | | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 542 | 0 | } else { | 543 | 0 | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 544 | 0 | } | 545 | 0 | } | 546 | 0 | } | 547 | 576 | return true; | 548 | 576 | } |
_ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_12Decimal128V3ENS_7DecimalIlEELb0ELb1EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKT3_RKNS5_10NativeTypeESF_RNS_14CastParametersE Line | Count | Source | 478 | 700 | CastParameters& params) { | 479 | 700 | MaxNativeType res; | 480 | 700 | if (from >= FromCppT(0)) { | 481 | 700 | if constexpr (narrow_integral) { | 482 | | if constexpr (IsDecimal128V2<FromCppT>) { | 483 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 484 | | if (UNLIKELY(res > max_result)) { | 485 | | if (params.is_strict) { | 486 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 487 | | decimal_to_string(from.value(), scale_from), | 488 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 489 | | precision_to, scale_to); | 490 | | } | 491 | | return false; | 492 | | } | 493 | 700 | } else { | 494 | 700 | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 495 | 700 | if (UNLIKELY(res > max_result)) { | 496 | 264 | if (params.is_strict) { | 497 | 132 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 498 | 132 | decimal_to_string(from.value, scale_from), | 499 | 132 | fmt::format("decimal({}, {})", precision_from, scale_from), | 500 | 132 | precision_to, scale_to); | 501 | 132 | } | 502 | 264 | return false; | 503 | 264 | } | 504 | 700 | } | 505 | 436 | to = ToCppT(res); | 506 | | } else { | 507 | | if constexpr (IsDecimal128V2<FromCppT>) { | 508 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 509 | | } else { | 510 | | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 511 | | } | 512 | | } | 513 | 700 | } else { | 514 | 0 | if constexpr (narrow_integral) { | 515 | | if constexpr (IsDecimal128V2<FromCppT>) { | 516 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 517 | | if (UNLIKELY(res < -max_result)) { | 518 | | if (params.is_strict) { | 519 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 520 | | decimal_to_string(from.value(), scale_from), | 521 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 522 | | precision_to, scale_to); | 523 | | } | 524 | | return false; | 525 | | } | 526 | 0 | } else { | 527 | 0 | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 528 | 0 | if (UNLIKELY(res < -max_result)) { | 529 | 0 | if (params.is_strict) { | 530 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 531 | 0 | decimal_to_string(from.value, scale_from), | 532 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 533 | 0 | precision_to, scale_to); | 534 | 0 | } | 535 | 0 | return false; | 536 | 0 | } | 537 | 0 | } | 538 | 0 | to = ToCppT(res); | 539 | | } else { | 540 | | if constexpr (IsDecimal128V2<FromCppT>) { | 541 | | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 542 | | } else { | 543 | | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 544 | | } | 545 | | } | 546 | 0 | } | 547 | 0 | return true; | 548 | 700 | } |
Unexecuted instantiation: _ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_12Decimal128V3ENS_7DecimalIlEELb1ELb0EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKT3_RKNS5_10NativeTypeESF_RNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_12Decimal128V3ENS_7DecimalIlEELb1ELb1EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKT3_RKNS5_10NativeTypeESF_RNS_14CastParametersE _ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_7DecimalIN4wide7integerILm256EiEEEENS2_IlEELb0ELb0ES5_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKT3_RKNS8_10NativeTypeESI_RNS_14CastParametersE Line | Count | Source | 478 | 576 | CastParameters& params) { | 479 | 576 | MaxNativeType res; | 480 | 576 | if (from >= FromCppT(0)) { | 481 | | if constexpr (narrow_integral) { | 482 | | if constexpr (IsDecimal128V2<FromCppT>) { | 483 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 484 | | if (UNLIKELY(res > max_result)) { | 485 | | if (params.is_strict) { | 486 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 487 | | decimal_to_string(from.value(), scale_from), | 488 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 489 | | precision_to, scale_to); | 490 | | } | 491 | | return false; | 492 | | } | 493 | | } else { | 494 | | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 495 | | if (UNLIKELY(res > max_result)) { | 496 | | if (params.is_strict) { | 497 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 498 | | decimal_to_string(from.value, scale_from), | 499 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 500 | | precision_to, scale_to); | 501 | | } | 502 | | return false; | 503 | | } | 504 | | } | 505 | | to = ToCppT(res); | 506 | 576 | } else { | 507 | | if constexpr (IsDecimal128V2<FromCppT>) { | 508 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 509 | 576 | } else { | 510 | 576 | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 511 | 576 | } | 512 | 576 | } | 513 | 576 | } else { | 514 | | if constexpr (narrow_integral) { | 515 | | if constexpr (IsDecimal128V2<FromCppT>) { | 516 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 517 | | if (UNLIKELY(res < -max_result)) { | 518 | | if (params.is_strict) { | 519 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 520 | | decimal_to_string(from.value(), scale_from), | 521 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 522 | | precision_to, scale_to); | 523 | | } | 524 | | return false; | 525 | | } | 526 | | } else { | 527 | | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 528 | | if (UNLIKELY(res < -max_result)) { | 529 | | if (params.is_strict) { | 530 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 531 | | decimal_to_string(from.value, scale_from), | 532 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 533 | | precision_to, scale_to); | 534 | | } | 535 | | return false; | 536 | | } | 537 | | } | 538 | | to = ToCppT(res); | 539 | 0 | } else { | 540 | | if constexpr (IsDecimal128V2<FromCppT>) { | 541 | | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 542 | 0 | } else { | 543 | 0 | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 544 | 0 | } | 545 | 0 | } | 546 | 0 | } | 547 | 576 | return true; | 548 | 576 | } |
_ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_7DecimalIN4wide7integerILm256EiEEEENS2_IlEELb0ELb1ES5_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKT3_RKNS8_10NativeTypeESI_RNS_14CastParametersE Line | Count | Source | 478 | 768 | CastParameters& params) { | 479 | 768 | MaxNativeType res; | 480 | 768 | if (from >= FromCppT(0)) { | 481 | 768 | if constexpr (narrow_integral) { | 482 | | if constexpr (IsDecimal128V2<FromCppT>) { | 483 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 484 | | if (UNLIKELY(res > max_result)) { | 485 | | if (params.is_strict) { | 486 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 487 | | decimal_to_string(from.value(), scale_from), | 488 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 489 | | precision_to, scale_to); | 490 | | } | 491 | | return false; | 492 | | } | 493 | 768 | } else { | 494 | 768 | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 495 | 768 | if (UNLIKELY(res > max_result)) { | 496 | 320 | if (params.is_strict) { | 497 | 160 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 498 | 160 | decimal_to_string(from.value, scale_from), | 499 | 160 | fmt::format("decimal({}, {})", precision_from, scale_from), | 500 | 160 | precision_to, scale_to); | 501 | 160 | } | 502 | 320 | return false; | 503 | 320 | } | 504 | 768 | } | 505 | 448 | to = ToCppT(res); | 506 | | } else { | 507 | | if constexpr (IsDecimal128V2<FromCppT>) { | 508 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 509 | | } else { | 510 | | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 511 | | } | 512 | | } | 513 | 768 | } else { | 514 | 0 | if constexpr (narrow_integral) { | 515 | | if constexpr (IsDecimal128V2<FromCppT>) { | 516 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 517 | | if (UNLIKELY(res < -max_result)) { | 518 | | if (params.is_strict) { | 519 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 520 | | decimal_to_string(from.value(), scale_from), | 521 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 522 | | precision_to, scale_to); | 523 | | } | 524 | | return false; | 525 | | } | 526 | 0 | } else { | 527 | 0 | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 528 | 0 | if (UNLIKELY(res < -max_result)) { | 529 | 0 | if (params.is_strict) { | 530 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 531 | 0 | decimal_to_string(from.value, scale_from), | 532 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 533 | 0 | precision_to, scale_to); | 534 | 0 | } | 535 | 0 | return false; | 536 | 0 | } | 537 | 0 | } | 538 | 0 | to = ToCppT(res); | 539 | | } else { | 540 | | if constexpr (IsDecimal128V2<FromCppT>) { | 541 | | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 542 | | } else { | 543 | | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 544 | | } | 545 | | } | 546 | 0 | } | 547 | 0 | return true; | 548 | 768 | } |
Unexecuted instantiation: _ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_7DecimalIN4wide7integerILm256EiEEEENS2_IlEELb1ELb0ES5_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKT3_RKNS8_10NativeTypeESI_RNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_7DecimalIN4wide7integerILm256EiEEEENS2_IlEELb1ELb1ES5_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKT3_RKNS8_10NativeTypeESI_RNS_14CastParametersE _ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_7DecimalIiEENS_12Decimal128V3ELb0ELb0EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKT3_RKNS5_10NativeTypeESF_RNS_14CastParametersE Line | Count | Source | 478 | 368 | CastParameters& params) { | 479 | 368 | MaxNativeType res; | 480 | 368 | if (from >= FromCppT(0)) { | 481 | | if constexpr (narrow_integral) { | 482 | | if constexpr (IsDecimal128V2<FromCppT>) { | 483 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 484 | | if (UNLIKELY(res > max_result)) { | 485 | | if (params.is_strict) { | 486 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 487 | | decimal_to_string(from.value(), scale_from), | 488 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 489 | | precision_to, scale_to); | 490 | | } | 491 | | return false; | 492 | | } | 493 | | } else { | 494 | | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 495 | | if (UNLIKELY(res > max_result)) { | 496 | | if (params.is_strict) { | 497 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 498 | | decimal_to_string(from.value, scale_from), | 499 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 500 | | precision_to, scale_to); | 501 | | } | 502 | | return false; | 503 | | } | 504 | | } | 505 | | to = ToCppT(res); | 506 | 368 | } else { | 507 | | if constexpr (IsDecimal128V2<FromCppT>) { | 508 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 509 | 368 | } else { | 510 | 368 | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 511 | 368 | } | 512 | 368 | } | 513 | 368 | } else { | 514 | | if constexpr (narrow_integral) { | 515 | | if constexpr (IsDecimal128V2<FromCppT>) { | 516 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 517 | | if (UNLIKELY(res < -max_result)) { | 518 | | if (params.is_strict) { | 519 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 520 | | decimal_to_string(from.value(), scale_from), | 521 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 522 | | precision_to, scale_to); | 523 | | } | 524 | | return false; | 525 | | } | 526 | | } else { | 527 | | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 528 | | if (UNLIKELY(res < -max_result)) { | 529 | | if (params.is_strict) { | 530 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 531 | | decimal_to_string(from.value, scale_from), | 532 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 533 | | precision_to, scale_to); | 534 | | } | 535 | | return false; | 536 | | } | 537 | | } | 538 | | to = ToCppT(res); | 539 | 0 | } else { | 540 | | if constexpr (IsDecimal128V2<FromCppT>) { | 541 | | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 542 | 0 | } else { | 543 | 0 | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 544 | 0 | } | 545 | 0 | } | 546 | 0 | } | 547 | 368 | return true; | 548 | 368 | } |
Unexecuted instantiation: _ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_7DecimalIiEENS_12Decimal128V3ELb0ELb1EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKT3_RKNS5_10NativeTypeESF_RNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_7DecimalIiEENS_12Decimal128V3ELb1ELb0EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKT3_RKNS5_10NativeTypeESF_RNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_7DecimalIiEENS_12Decimal128V3ELb1ELb1EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKT3_RKNS5_10NativeTypeESF_RNS_14CastParametersE _ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_7DecimalIlEENS_12Decimal128V3ELb0ELb0EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKT3_RKNS5_10NativeTypeESF_RNS_14CastParametersE Line | Count | Source | 478 | 704 | CastParameters& params) { | 479 | 704 | MaxNativeType res; | 480 | 704 | if (from >= FromCppT(0)) { | 481 | | if constexpr (narrow_integral) { | 482 | | if constexpr (IsDecimal128V2<FromCppT>) { | 483 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 484 | | if (UNLIKELY(res > max_result)) { | 485 | | if (params.is_strict) { | 486 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 487 | | decimal_to_string(from.value(), scale_from), | 488 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 489 | | precision_to, scale_to); | 490 | | } | 491 | | return false; | 492 | | } | 493 | | } else { | 494 | | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 495 | | if (UNLIKELY(res > max_result)) { | 496 | | if (params.is_strict) { | 497 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 498 | | decimal_to_string(from.value, scale_from), | 499 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 500 | | precision_to, scale_to); | 501 | | } | 502 | | return false; | 503 | | } | 504 | | } | 505 | | to = ToCppT(res); | 506 | 704 | } else { | 507 | | if constexpr (IsDecimal128V2<FromCppT>) { | 508 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 509 | 704 | } else { | 510 | 704 | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 511 | 704 | } | 512 | 704 | } | 513 | 704 | } else { | 514 | | if constexpr (narrow_integral) { | 515 | | if constexpr (IsDecimal128V2<FromCppT>) { | 516 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 517 | | if (UNLIKELY(res < -max_result)) { | 518 | | if (params.is_strict) { | 519 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 520 | | decimal_to_string(from.value(), scale_from), | 521 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 522 | | precision_to, scale_to); | 523 | | } | 524 | | return false; | 525 | | } | 526 | | } else { | 527 | | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 528 | | if (UNLIKELY(res < -max_result)) { | 529 | | if (params.is_strict) { | 530 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 531 | | decimal_to_string(from.value, scale_from), | 532 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 533 | | precision_to, scale_to); | 534 | | } | 535 | | return false; | 536 | | } | 537 | | } | 538 | | to = ToCppT(res); | 539 | 0 | } else { | 540 | | if constexpr (IsDecimal128V2<FromCppT>) { | 541 | | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 542 | 0 | } else { | 543 | 0 | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 544 | 0 | } | 545 | 0 | } | 546 | 0 | } | 547 | 704 | return true; | 548 | 704 | } |
Unexecuted instantiation: _ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_7DecimalIlEENS_12Decimal128V3ELb0ELb1EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKT3_RKNS5_10NativeTypeESF_RNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_7DecimalIlEENS_12Decimal128V3ELb1ELb0EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKT3_RKNS5_10NativeTypeESF_RNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_7DecimalIlEENS_12Decimal128V3ELb1ELb1EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKT3_RKNS5_10NativeTypeESF_RNS_14CastParametersE _ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_12Decimal128V3ES2_Lb0ELb0EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS4_jjRS3_jjRKT3_RKNS3_10NativeTypeESD_RNS_14CastParametersE Line | Count | Source | 478 | 704 | CastParameters& params) { | 479 | 704 | MaxNativeType res; | 480 | 704 | if (from >= FromCppT(0)) { | 481 | | if constexpr (narrow_integral) { | 482 | | if constexpr (IsDecimal128V2<FromCppT>) { | 483 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 484 | | if (UNLIKELY(res > max_result)) { | 485 | | if (params.is_strict) { | 486 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 487 | | decimal_to_string(from.value(), scale_from), | 488 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 489 | | precision_to, scale_to); | 490 | | } | 491 | | return false; | 492 | | } | 493 | | } else { | 494 | | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 495 | | if (UNLIKELY(res > max_result)) { | 496 | | if (params.is_strict) { | 497 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 498 | | decimal_to_string(from.value, scale_from), | 499 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 500 | | precision_to, scale_to); | 501 | | } | 502 | | return false; | 503 | | } | 504 | | } | 505 | | to = ToCppT(res); | 506 | 704 | } else { | 507 | | if constexpr (IsDecimal128V2<FromCppT>) { | 508 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 509 | 704 | } else { | 510 | 704 | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 511 | 704 | } | 512 | 704 | } | 513 | 704 | } else { | 514 | | if constexpr (narrow_integral) { | 515 | | if constexpr (IsDecimal128V2<FromCppT>) { | 516 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 517 | | if (UNLIKELY(res < -max_result)) { | 518 | | if (params.is_strict) { | 519 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 520 | | decimal_to_string(from.value(), scale_from), | 521 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 522 | | precision_to, scale_to); | 523 | | } | 524 | | return false; | 525 | | } | 526 | | } else { | 527 | | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 528 | | if (UNLIKELY(res < -max_result)) { | 529 | | if (params.is_strict) { | 530 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 531 | | decimal_to_string(from.value, scale_from), | 532 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 533 | | precision_to, scale_to); | 534 | | } | 535 | | return false; | 536 | | } | 537 | | } | 538 | | to = ToCppT(res); | 539 | 0 | } else { | 540 | | if constexpr (IsDecimal128V2<FromCppT>) { | 541 | | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 542 | 0 | } else { | 543 | 0 | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 544 | 0 | } | 545 | 0 | } | 546 | 0 | } | 547 | 704 | return true; | 548 | 704 | } |
_ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_12Decimal128V3ES2_Lb0ELb1EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS4_jjRS3_jjRKT3_RKNS3_10NativeTypeESD_RNS_14CastParametersE Line | Count | Source | 478 | 192 | CastParameters& params) { | 479 | 192 | MaxNativeType res; | 480 | 192 | if (from >= FromCppT(0)) { | 481 | 192 | if constexpr (narrow_integral) { | 482 | | if constexpr (IsDecimal128V2<FromCppT>) { | 483 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 484 | | if (UNLIKELY(res > max_result)) { | 485 | | if (params.is_strict) { | 486 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 487 | | decimal_to_string(from.value(), scale_from), | 488 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 489 | | precision_to, scale_to); | 490 | | } | 491 | | return false; | 492 | | } | 493 | 192 | } else { | 494 | 192 | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 495 | 192 | if (UNLIKELY(res > max_result)) { | 496 | 80 | if (params.is_strict) { | 497 | 40 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 498 | 40 | decimal_to_string(from.value, scale_from), | 499 | 40 | fmt::format("decimal({}, {})", precision_from, scale_from), | 500 | 40 | precision_to, scale_to); | 501 | 40 | } | 502 | 80 | return false; | 503 | 80 | } | 504 | 192 | } | 505 | 112 | to = ToCppT(res); | 506 | | } else { | 507 | | if constexpr (IsDecimal128V2<FromCppT>) { | 508 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 509 | | } else { | 510 | | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 511 | | } | 512 | | } | 513 | 192 | } else { | 514 | 0 | if constexpr (narrow_integral) { | 515 | | if constexpr (IsDecimal128V2<FromCppT>) { | 516 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 517 | | if (UNLIKELY(res < -max_result)) { | 518 | | if (params.is_strict) { | 519 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 520 | | decimal_to_string(from.value(), scale_from), | 521 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 522 | | precision_to, scale_to); | 523 | | } | 524 | | return false; | 525 | | } | 526 | 0 | } else { | 527 | 0 | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 528 | 0 | if (UNLIKELY(res < -max_result)) { | 529 | 0 | if (params.is_strict) { | 530 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 531 | 0 | decimal_to_string(from.value, scale_from), | 532 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 533 | 0 | precision_to, scale_to); | 534 | 0 | } | 535 | 0 | return false; | 536 | 0 | } | 537 | 0 | } | 538 | 0 | to = ToCppT(res); | 539 | | } else { | 540 | | if constexpr (IsDecimal128V2<FromCppT>) { | 541 | | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 542 | | } else { | 543 | | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 544 | | } | 545 | | } | 546 | 0 | } | 547 | 0 | return true; | 548 | 192 | } |
Unexecuted instantiation: _ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_12Decimal128V3ES2_Lb1ELb0EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS4_jjRS3_jjRKT3_RKNS3_10NativeTypeESD_RNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_12Decimal128V3ES2_Lb1ELb1EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS4_jjRS3_jjRKT3_RKNS3_10NativeTypeESD_RNS_14CastParametersE _ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_7DecimalIN4wide7integerILm256EiEEEENS_12Decimal128V3ELb0ELb0ES5_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKT3_RKNS8_10NativeTypeESI_RNS_14CastParametersE Line | Count | Source | 478 | 576 | CastParameters& params) { | 479 | 576 | MaxNativeType res; | 480 | 576 | if (from >= FromCppT(0)) { | 481 | | if constexpr (narrow_integral) { | 482 | | if constexpr (IsDecimal128V2<FromCppT>) { | 483 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 484 | | if (UNLIKELY(res > max_result)) { | 485 | | if (params.is_strict) { | 486 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 487 | | decimal_to_string(from.value(), scale_from), | 488 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 489 | | precision_to, scale_to); | 490 | | } | 491 | | return false; | 492 | | } | 493 | | } else { | 494 | | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 495 | | if (UNLIKELY(res > max_result)) { | 496 | | if (params.is_strict) { | 497 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 498 | | decimal_to_string(from.value, scale_from), | 499 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 500 | | precision_to, scale_to); | 501 | | } | 502 | | return false; | 503 | | } | 504 | | } | 505 | | to = ToCppT(res); | 506 | 576 | } else { | 507 | | if constexpr (IsDecimal128V2<FromCppT>) { | 508 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 509 | 576 | } else { | 510 | 576 | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 511 | 576 | } | 512 | 576 | } | 513 | 576 | } else { | 514 | | if constexpr (narrow_integral) { | 515 | | if constexpr (IsDecimal128V2<FromCppT>) { | 516 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 517 | | if (UNLIKELY(res < -max_result)) { | 518 | | if (params.is_strict) { | 519 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 520 | | decimal_to_string(from.value(), scale_from), | 521 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 522 | | precision_to, scale_to); | 523 | | } | 524 | | return false; | 525 | | } | 526 | | } else { | 527 | | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 528 | | if (UNLIKELY(res < -max_result)) { | 529 | | if (params.is_strict) { | 530 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 531 | | decimal_to_string(from.value, scale_from), | 532 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 533 | | precision_to, scale_to); | 534 | | } | 535 | | return false; | 536 | | } | 537 | | } | 538 | | to = ToCppT(res); | 539 | 0 | } else { | 540 | | if constexpr (IsDecimal128V2<FromCppT>) { | 541 | | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 542 | 0 | } else { | 543 | 0 | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 544 | 0 | } | 545 | 0 | } | 546 | 0 | } | 547 | 576 | return true; | 548 | 576 | } |
_ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_7DecimalIN4wide7integerILm256EiEEEENS_12Decimal128V3ELb0ELb1ES5_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKT3_RKNS8_10NativeTypeESI_RNS_14CastParametersE Line | Count | Source | 478 | 700 | CastParameters& params) { | 479 | 700 | MaxNativeType res; | 480 | 700 | if (from >= FromCppT(0)) { | 481 | 700 | if constexpr (narrow_integral) { | 482 | | if constexpr (IsDecimal128V2<FromCppT>) { | 483 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 484 | | if (UNLIKELY(res > max_result)) { | 485 | | if (params.is_strict) { | 486 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 487 | | decimal_to_string(from.value(), scale_from), | 488 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 489 | | precision_to, scale_to); | 490 | | } | 491 | | return false; | 492 | | } | 493 | 700 | } else { | 494 | 700 | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 495 | 700 | if (UNLIKELY(res > max_result)) { | 496 | 264 | if (params.is_strict) { | 497 | 132 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 498 | 132 | decimal_to_string(from.value, scale_from), | 499 | 132 | fmt::format("decimal({}, {})", precision_from, scale_from), | 500 | 132 | precision_to, scale_to); | 501 | 132 | } | 502 | 264 | return false; | 503 | 264 | } | 504 | 700 | } | 505 | 436 | to = ToCppT(res); | 506 | | } else { | 507 | | if constexpr (IsDecimal128V2<FromCppT>) { | 508 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 509 | | } else { | 510 | | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 511 | | } | 512 | | } | 513 | 700 | } else { | 514 | 0 | if constexpr (narrow_integral) { | 515 | | if constexpr (IsDecimal128V2<FromCppT>) { | 516 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 517 | | if (UNLIKELY(res < -max_result)) { | 518 | | if (params.is_strict) { | 519 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 520 | | decimal_to_string(from.value(), scale_from), | 521 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 522 | | precision_to, scale_to); | 523 | | } | 524 | | return false; | 525 | | } | 526 | 0 | } else { | 527 | 0 | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 528 | 0 | if (UNLIKELY(res < -max_result)) { | 529 | 0 | if (params.is_strict) { | 530 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 531 | 0 | decimal_to_string(from.value, scale_from), | 532 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 533 | 0 | precision_to, scale_to); | 534 | 0 | } | 535 | 0 | return false; | 536 | 0 | } | 537 | 0 | } | 538 | 0 | to = ToCppT(res); | 539 | | } else { | 540 | | if constexpr (IsDecimal128V2<FromCppT>) { | 541 | | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 542 | | } else { | 543 | | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 544 | | } | 545 | | } | 546 | 0 | } | 547 | 0 | return true; | 548 | 700 | } |
Unexecuted instantiation: _ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_7DecimalIN4wide7integerILm256EiEEEENS_12Decimal128V3ELb1ELb0ES5_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKT3_RKNS8_10NativeTypeESI_RNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_7DecimalIN4wide7integerILm256EiEEEENS_12Decimal128V3ELb1ELb1ES5_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKT3_RKNS8_10NativeTypeESI_RNS_14CastParametersE _ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_7DecimalIiEENS2_IN4wide7integerILm256EiEEEELb0ELb0ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKT3_RKNS8_10NativeTypeESI_RNS_14CastParametersE Line | Count | Source | 478 | 368 | CastParameters& params) { | 479 | 368 | MaxNativeType res; | 480 | 368 | if (from >= FromCppT(0)) { | 481 | | if constexpr (narrow_integral) { | 482 | | if constexpr (IsDecimal128V2<FromCppT>) { | 483 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 484 | | if (UNLIKELY(res > max_result)) { | 485 | | if (params.is_strict) { | 486 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 487 | | decimal_to_string(from.value(), scale_from), | 488 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 489 | | precision_to, scale_to); | 490 | | } | 491 | | return false; | 492 | | } | 493 | | } else { | 494 | | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 495 | | if (UNLIKELY(res > max_result)) { | 496 | | if (params.is_strict) { | 497 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 498 | | decimal_to_string(from.value, scale_from), | 499 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 500 | | precision_to, scale_to); | 501 | | } | 502 | | return false; | 503 | | } | 504 | | } | 505 | | to = ToCppT(res); | 506 | 368 | } else { | 507 | | if constexpr (IsDecimal128V2<FromCppT>) { | 508 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 509 | 368 | } else { | 510 | 368 | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 511 | 368 | } | 512 | 368 | } | 513 | 368 | } else { | 514 | | if constexpr (narrow_integral) { | 515 | | if constexpr (IsDecimal128V2<FromCppT>) { | 516 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 517 | | if (UNLIKELY(res < -max_result)) { | 518 | | if (params.is_strict) { | 519 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 520 | | decimal_to_string(from.value(), scale_from), | 521 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 522 | | precision_to, scale_to); | 523 | | } | 524 | | return false; | 525 | | } | 526 | | } else { | 527 | | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 528 | | if (UNLIKELY(res < -max_result)) { | 529 | | if (params.is_strict) { | 530 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 531 | | decimal_to_string(from.value, scale_from), | 532 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 533 | | precision_to, scale_to); | 534 | | } | 535 | | return false; | 536 | | } | 537 | | } | 538 | | to = ToCppT(res); | 539 | 0 | } else { | 540 | | if constexpr (IsDecimal128V2<FromCppT>) { | 541 | | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 542 | 0 | } else { | 543 | 0 | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 544 | 0 | } | 545 | 0 | } | 546 | 0 | } | 547 | 368 | return true; | 548 | 368 | } |
Unexecuted instantiation: _ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_7DecimalIiEENS2_IN4wide7integerILm256EiEEEELb0ELb1ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKT3_RKNS8_10NativeTypeESI_RNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_7DecimalIiEENS2_IN4wide7integerILm256EiEEEELb1ELb0ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKT3_RKNS8_10NativeTypeESI_RNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_7DecimalIiEENS2_IN4wide7integerILm256EiEEEELb1ELb1ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKT3_RKNS8_10NativeTypeESI_RNS_14CastParametersE _ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_7DecimalIlEENS2_IN4wide7integerILm256EiEEEELb0ELb0ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKT3_RKNS8_10NativeTypeESI_RNS_14CastParametersE Line | Count | Source | 478 | 704 | CastParameters& params) { | 479 | 704 | MaxNativeType res; | 480 | 704 | if (from >= FromCppT(0)) { | 481 | | if constexpr (narrow_integral) { | 482 | | if constexpr (IsDecimal128V2<FromCppT>) { | 483 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 484 | | if (UNLIKELY(res > max_result)) { | 485 | | if (params.is_strict) { | 486 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 487 | | decimal_to_string(from.value(), scale_from), | 488 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 489 | | precision_to, scale_to); | 490 | | } | 491 | | return false; | 492 | | } | 493 | | } else { | 494 | | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 495 | | if (UNLIKELY(res > max_result)) { | 496 | | if (params.is_strict) { | 497 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 498 | | decimal_to_string(from.value, scale_from), | 499 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 500 | | precision_to, scale_to); | 501 | | } | 502 | | return false; | 503 | | } | 504 | | } | 505 | | to = ToCppT(res); | 506 | 704 | } else { | 507 | | if constexpr (IsDecimal128V2<FromCppT>) { | 508 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 509 | 704 | } else { | 510 | 704 | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 511 | 704 | } | 512 | 704 | } | 513 | 704 | } else { | 514 | | if constexpr (narrow_integral) { | 515 | | if constexpr (IsDecimal128V2<FromCppT>) { | 516 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 517 | | if (UNLIKELY(res < -max_result)) { | 518 | | if (params.is_strict) { | 519 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 520 | | decimal_to_string(from.value(), scale_from), | 521 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 522 | | precision_to, scale_to); | 523 | | } | 524 | | return false; | 525 | | } | 526 | | } else { | 527 | | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 528 | | if (UNLIKELY(res < -max_result)) { | 529 | | if (params.is_strict) { | 530 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 531 | | decimal_to_string(from.value, scale_from), | 532 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 533 | | precision_to, scale_to); | 534 | | } | 535 | | return false; | 536 | | } | 537 | | } | 538 | | to = ToCppT(res); | 539 | 0 | } else { | 540 | | if constexpr (IsDecimal128V2<FromCppT>) { | 541 | | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 542 | 0 | } else { | 543 | 0 | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 544 | 0 | } | 545 | 0 | } | 546 | 0 | } | 547 | 704 | return true; | 548 | 704 | } |
Unexecuted instantiation: _ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_7DecimalIlEENS2_IN4wide7integerILm256EiEEEELb0ELb1ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKT3_RKNS8_10NativeTypeESI_RNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_7DecimalIlEENS2_IN4wide7integerILm256EiEEEELb1ELb0ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKT3_RKNS8_10NativeTypeESI_RNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_7DecimalIlEENS2_IN4wide7integerILm256EiEEEELb1ELb1ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKT3_RKNS8_10NativeTypeESI_RNS_14CastParametersE _ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_12Decimal128V3ENS_7DecimalIN4wide7integerILm256EiEEEELb0ELb0ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKT3_RKNS8_10NativeTypeESI_RNS_14CastParametersE Line | Count | Source | 478 | 704 | CastParameters& params) { | 479 | 704 | MaxNativeType res; | 480 | 704 | if (from >= FromCppT(0)) { | 481 | | if constexpr (narrow_integral) { | 482 | | if constexpr (IsDecimal128V2<FromCppT>) { | 483 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 484 | | if (UNLIKELY(res > max_result)) { | 485 | | if (params.is_strict) { | 486 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 487 | | decimal_to_string(from.value(), scale_from), | 488 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 489 | | precision_to, scale_to); | 490 | | } | 491 | | return false; | 492 | | } | 493 | | } else { | 494 | | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 495 | | if (UNLIKELY(res > max_result)) { | 496 | | if (params.is_strict) { | 497 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 498 | | decimal_to_string(from.value, scale_from), | 499 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 500 | | precision_to, scale_to); | 501 | | } | 502 | | return false; | 503 | | } | 504 | | } | 505 | | to = ToCppT(res); | 506 | 704 | } else { | 507 | | if constexpr (IsDecimal128V2<FromCppT>) { | 508 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 509 | 704 | } else { | 510 | 704 | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 511 | 704 | } | 512 | 704 | } | 513 | 704 | } else { | 514 | | if constexpr (narrow_integral) { | 515 | | if constexpr (IsDecimal128V2<FromCppT>) { | 516 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 517 | | if (UNLIKELY(res < -max_result)) { | 518 | | if (params.is_strict) { | 519 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 520 | | decimal_to_string(from.value(), scale_from), | 521 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 522 | | precision_to, scale_to); | 523 | | } | 524 | | return false; | 525 | | } | 526 | | } else { | 527 | | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 528 | | if (UNLIKELY(res < -max_result)) { | 529 | | if (params.is_strict) { | 530 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 531 | | decimal_to_string(from.value, scale_from), | 532 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 533 | | precision_to, scale_to); | 534 | | } | 535 | | return false; | 536 | | } | 537 | | } | 538 | | to = ToCppT(res); | 539 | 0 | } else { | 540 | | if constexpr (IsDecimal128V2<FromCppT>) { | 541 | | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 542 | 0 | } else { | 543 | 0 | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 544 | 0 | } | 545 | 0 | } | 546 | 0 | } | 547 | 704 | return true; | 548 | 704 | } |
Unexecuted instantiation: _ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_12Decimal128V3ENS_7DecimalIN4wide7integerILm256EiEEEELb0ELb1ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKT3_RKNS8_10NativeTypeESI_RNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_12Decimal128V3ENS_7DecimalIN4wide7integerILm256EiEEEELb1ELb0ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKT3_RKNS8_10NativeTypeESI_RNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_12Decimal128V3ENS_7DecimalIN4wide7integerILm256EiEEEELb1ELb1ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKT3_RKNS8_10NativeTypeESI_RNS_14CastParametersE _ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_7DecimalIN4wide7integerILm256EiEEEES6_Lb0ELb0ES5_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS8_jjRS7_jjRKT3_RKNS7_10NativeTypeESH_RNS_14CastParametersE Line | Count | Source | 478 | 704 | CastParameters& params) { | 479 | 704 | MaxNativeType res; | 480 | 704 | if (from >= FromCppT(0)) { | 481 | | if constexpr (narrow_integral) { | 482 | | if constexpr (IsDecimal128V2<FromCppT>) { | 483 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 484 | | if (UNLIKELY(res > max_result)) { | 485 | | if (params.is_strict) { | 486 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 487 | | decimal_to_string(from.value(), scale_from), | 488 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 489 | | precision_to, scale_to); | 490 | | } | 491 | | return false; | 492 | | } | 493 | | } else { | 494 | | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 495 | | if (UNLIKELY(res > max_result)) { | 496 | | if (params.is_strict) { | 497 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 498 | | decimal_to_string(from.value, scale_from), | 499 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 500 | | precision_to, scale_to); | 501 | | } | 502 | | return false; | 503 | | } | 504 | | } | 505 | | to = ToCppT(res); | 506 | 704 | } else { | 507 | | if constexpr (IsDecimal128V2<FromCppT>) { | 508 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 509 | 704 | } else { | 510 | 704 | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 511 | 704 | } | 512 | 704 | } | 513 | 704 | } else { | 514 | | if constexpr (narrow_integral) { | 515 | | if constexpr (IsDecimal128V2<FromCppT>) { | 516 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 517 | | if (UNLIKELY(res < -max_result)) { | 518 | | if (params.is_strict) { | 519 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 520 | | decimal_to_string(from.value(), scale_from), | 521 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 522 | | precision_to, scale_to); | 523 | | } | 524 | | return false; | 525 | | } | 526 | | } else { | 527 | | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 528 | | if (UNLIKELY(res < -max_result)) { | 529 | | if (params.is_strict) { | 530 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 531 | | decimal_to_string(from.value, scale_from), | 532 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 533 | | precision_to, scale_to); | 534 | | } | 535 | | return false; | 536 | | } | 537 | | } | 538 | | to = ToCppT(res); | 539 | 0 | } else { | 540 | | if constexpr (IsDecimal128V2<FromCppT>) { | 541 | | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 542 | 0 | } else { | 543 | 0 | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 544 | 0 | } | 545 | 0 | } | 546 | 0 | } | 547 | 704 | return true; | 548 | 704 | } |
_ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_7DecimalIN4wide7integerILm256EiEEEES6_Lb0ELb1ES5_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS8_jjRS7_jjRKT3_RKNS7_10NativeTypeESH_RNS_14CastParametersE Line | Count | Source | 478 | 192 | CastParameters& params) { | 479 | 192 | MaxNativeType res; | 480 | 192 | if (from >= FromCppT(0)) { | 481 | 192 | if constexpr (narrow_integral) { | 482 | | if constexpr (IsDecimal128V2<FromCppT>) { | 483 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 484 | | if (UNLIKELY(res > max_result)) { | 485 | | if (params.is_strict) { | 486 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 487 | | decimal_to_string(from.value(), scale_from), | 488 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 489 | | precision_to, scale_to); | 490 | | } | 491 | | return false; | 492 | | } | 493 | 192 | } else { | 494 | 192 | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 495 | 192 | if (UNLIKELY(res > max_result)) { | 496 | 80 | if (params.is_strict) { | 497 | 40 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 498 | 40 | decimal_to_string(from.value, scale_from), | 499 | 40 | fmt::format("decimal({}, {})", precision_from, scale_from), | 500 | 40 | precision_to, scale_to); | 501 | 40 | } | 502 | 80 | return false; | 503 | 80 | } | 504 | 192 | } | 505 | 112 | to = ToCppT(res); | 506 | | } else { | 507 | | if constexpr (IsDecimal128V2<FromCppT>) { | 508 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 509 | | } else { | 510 | | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 511 | | } | 512 | | } | 513 | 192 | } else { | 514 | 0 | if constexpr (narrow_integral) { | 515 | | if constexpr (IsDecimal128V2<FromCppT>) { | 516 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 517 | | if (UNLIKELY(res < -max_result)) { | 518 | | if (params.is_strict) { | 519 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 520 | | decimal_to_string(from.value(), scale_from), | 521 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 522 | | precision_to, scale_to); | 523 | | } | 524 | | return false; | 525 | | } | 526 | 0 | } else { | 527 | 0 | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 528 | 0 | if (UNLIKELY(res < -max_result)) { | 529 | 0 | if (params.is_strict) { | 530 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 531 | 0 | decimal_to_string(from.value, scale_from), | 532 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 533 | 0 | precision_to, scale_to); | 534 | 0 | } | 535 | 0 | return false; | 536 | 0 | } | 537 | 0 | } | 538 | 0 | to = ToCppT(res); | 539 | | } else { | 540 | | if constexpr (IsDecimal128V2<FromCppT>) { | 541 | | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 542 | | } else { | 543 | | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 544 | | } | 545 | | } | 546 | 0 | } | 547 | 0 | return true; | 548 | 192 | } |
Unexecuted instantiation: _ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_7DecimalIN4wide7integerILm256EiEEEES6_Lb1ELb0ES5_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS8_jjRS7_jjRKT3_RKNS7_10NativeTypeESH_RNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_7DecimalIN4wide7integerILm256EiEEEES6_Lb1ELb1ES5_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS8_jjRS7_jjRKT3_RKNS7_10NativeTypeESH_RNS_14CastParametersE _ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_14DecimalV2ValueENS_7DecimalIiEELb0ELb0EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKT3_RKNS5_10NativeTypeESF_RNS_14CastParametersE Line | Count | Source | 478 | 64 | CastParameters& params) { | 479 | 64 | MaxNativeType res; | 480 | 64 | if (from >= FromCppT(0)) { | 481 | | if constexpr (narrow_integral) { | 482 | | if constexpr (IsDecimal128V2<FromCppT>) { | 483 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 484 | | if (UNLIKELY(res > max_result)) { | 485 | | if (params.is_strict) { | 486 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 487 | | decimal_to_string(from.value(), scale_from), | 488 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 489 | | precision_to, scale_to); | 490 | | } | 491 | | return false; | 492 | | } | 493 | | } else { | 494 | | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 495 | | if (UNLIKELY(res > max_result)) { | 496 | | if (params.is_strict) { | 497 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 498 | | decimal_to_string(from.value, scale_from), | 499 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 500 | | precision_to, scale_to); | 501 | | } | 502 | | return false; | 503 | | } | 504 | | } | 505 | | to = ToCppT(res); | 506 | 64 | } else { | 507 | 64 | if constexpr (IsDecimal128V2<FromCppT>) { | 508 | 64 | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 509 | | } else { | 510 | | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 511 | | } | 512 | 64 | } | 513 | 64 | } else { | 514 | | if constexpr (narrow_integral) { | 515 | | if constexpr (IsDecimal128V2<FromCppT>) { | 516 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 517 | | if (UNLIKELY(res < -max_result)) { | 518 | | if (params.is_strict) { | 519 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 520 | | decimal_to_string(from.value(), scale_from), | 521 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 522 | | precision_to, scale_to); | 523 | | } | 524 | | return false; | 525 | | } | 526 | | } else { | 527 | | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 528 | | if (UNLIKELY(res < -max_result)) { | 529 | | if (params.is_strict) { | 530 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 531 | | decimal_to_string(from.value, scale_from), | 532 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 533 | | precision_to, scale_to); | 534 | | } | 535 | | return false; | 536 | | } | 537 | | } | 538 | | to = ToCppT(res); | 539 | 0 | } else { | 540 | 0 | if constexpr (IsDecimal128V2<FromCppT>) { | 541 | 0 | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 542 | | } else { | 543 | | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 544 | | } | 545 | 0 | } | 546 | 0 | } | 547 | 64 | return true; | 548 | 64 | } |
_ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_14DecimalV2ValueENS_7DecimalIiEELb0ELb1EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKT3_RKNS5_10NativeTypeESF_RNS_14CastParametersE Line | Count | Source | 478 | 870 | CastParameters& params) { | 479 | 870 | MaxNativeType res; | 480 | 870 | if (from >= FromCppT(0)) { | 481 | 870 | if constexpr (narrow_integral) { | 482 | 870 | if constexpr (IsDecimal128V2<FromCppT>) { | 483 | 870 | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 484 | 870 | if (UNLIKELY(res > max_result)) { | 485 | 312 | if (params.is_strict) { | 486 | 156 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 487 | 156 | decimal_to_string(from.value(), scale_from), | 488 | 156 | fmt::format("decimal({}, {})", precision_from, scale_from), | 489 | 156 | precision_to, scale_to); | 490 | 156 | } | 491 | 312 | return false; | 492 | 312 | } | 493 | | } else { | 494 | | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 495 | | if (UNLIKELY(res > max_result)) { | 496 | | if (params.is_strict) { | 497 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 498 | | decimal_to_string(from.value, scale_from), | 499 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 500 | | precision_to, scale_to); | 501 | | } | 502 | | return false; | 503 | | } | 504 | | } | 505 | 558 | to = ToCppT(res); | 506 | | } else { | 507 | | if constexpr (IsDecimal128V2<FromCppT>) { | 508 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 509 | | } else { | 510 | | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 511 | | } | 512 | | } | 513 | 870 | } else { | 514 | 0 | if constexpr (narrow_integral) { | 515 | 0 | if constexpr (IsDecimal128V2<FromCppT>) { | 516 | 0 | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 517 | 0 | if (UNLIKELY(res < -max_result)) { | 518 | 0 | if (params.is_strict) { | 519 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 520 | 0 | decimal_to_string(from.value(), scale_from), | 521 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 522 | 0 | precision_to, scale_to); | 523 | 0 | } | 524 | 0 | return false; | 525 | 0 | } | 526 | | } else { | 527 | | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 528 | | if (UNLIKELY(res < -max_result)) { | 529 | | if (params.is_strict) { | 530 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 531 | | decimal_to_string(from.value, scale_from), | 532 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 533 | | precision_to, scale_to); | 534 | | } | 535 | | return false; | 536 | | } | 537 | | } | 538 | 0 | to = ToCppT(res); | 539 | | } else { | 540 | | if constexpr (IsDecimal128V2<FromCppT>) { | 541 | | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 542 | | } else { | 543 | | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 544 | | } | 545 | | } | 546 | 0 | } | 547 | 0 | return true; | 548 | 870 | } |
Unexecuted instantiation: _ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_14DecimalV2ValueENS_7DecimalIiEELb1ELb0EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKT3_RKNS5_10NativeTypeESF_RNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_14DecimalV2ValueENS_7DecimalIiEELb1ELb1EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKT3_RKNS5_10NativeTypeESF_RNS_14CastParametersE _ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_14DecimalV2ValueENS_7DecimalIlEELb0ELb0EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKT3_RKNS5_10NativeTypeESF_RNS_14CastParametersE Line | Count | Source | 478 | 248 | CastParameters& params) { | 479 | 248 | MaxNativeType res; | 480 | 248 | if (from >= FromCppT(0)) { | 481 | | if constexpr (narrow_integral) { | 482 | | if constexpr (IsDecimal128V2<FromCppT>) { | 483 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 484 | | if (UNLIKELY(res > max_result)) { | 485 | | if (params.is_strict) { | 486 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 487 | | decimal_to_string(from.value(), scale_from), | 488 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 489 | | precision_to, scale_to); | 490 | | } | 491 | | return false; | 492 | | } | 493 | | } else { | 494 | | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 495 | | if (UNLIKELY(res > max_result)) { | 496 | | if (params.is_strict) { | 497 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 498 | | decimal_to_string(from.value, scale_from), | 499 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 500 | | precision_to, scale_to); | 501 | | } | 502 | | return false; | 503 | | } | 504 | | } | 505 | | to = ToCppT(res); | 506 | 248 | } else { | 507 | 248 | if constexpr (IsDecimal128V2<FromCppT>) { | 508 | 248 | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 509 | | } else { | 510 | | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 511 | | } | 512 | 248 | } | 513 | 248 | } else { | 514 | | if constexpr (narrow_integral) { | 515 | | if constexpr (IsDecimal128V2<FromCppT>) { | 516 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 517 | | if (UNLIKELY(res < -max_result)) { | 518 | | if (params.is_strict) { | 519 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 520 | | decimal_to_string(from.value(), scale_from), | 521 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 522 | | precision_to, scale_to); | 523 | | } | 524 | | return false; | 525 | | } | 526 | | } else { | 527 | | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 528 | | if (UNLIKELY(res < -max_result)) { | 529 | | if (params.is_strict) { | 530 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 531 | | decimal_to_string(from.value, scale_from), | 532 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 533 | | precision_to, scale_to); | 534 | | } | 535 | | return false; | 536 | | } | 537 | | } | 538 | | to = ToCppT(res); | 539 | 0 | } else { | 540 | 0 | if constexpr (IsDecimal128V2<FromCppT>) { | 541 | 0 | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 542 | | } else { | 543 | | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 544 | | } | 545 | 0 | } | 546 | 0 | } | 547 | 248 | return true; | 548 | 248 | } |
_ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_14DecimalV2ValueENS_7DecimalIlEELb0ELb1EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKT3_RKNS5_10NativeTypeESF_RNS_14CastParametersE Line | Count | Source | 478 | 708 | CastParameters& params) { | 479 | 708 | MaxNativeType res; | 480 | 708 | if (from >= FromCppT(0)) { | 481 | 708 | if constexpr (narrow_integral) { | 482 | 708 | if constexpr (IsDecimal128V2<FromCppT>) { | 483 | 708 | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 484 | 708 | if (UNLIKELY(res > max_result)) { | 485 | 168 | if (params.is_strict) { | 486 | 84 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 487 | 84 | decimal_to_string(from.value(), scale_from), | 488 | 84 | fmt::format("decimal({}, {})", precision_from, scale_from), | 489 | 84 | precision_to, scale_to); | 490 | 84 | } | 491 | 168 | return false; | 492 | 168 | } | 493 | | } else { | 494 | | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 495 | | if (UNLIKELY(res > max_result)) { | 496 | | if (params.is_strict) { | 497 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 498 | | decimal_to_string(from.value, scale_from), | 499 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 500 | | precision_to, scale_to); | 501 | | } | 502 | | return false; | 503 | | } | 504 | | } | 505 | 540 | to = ToCppT(res); | 506 | | } else { | 507 | | if constexpr (IsDecimal128V2<FromCppT>) { | 508 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 509 | | } else { | 510 | | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 511 | | } | 512 | | } | 513 | 708 | } else { | 514 | 0 | if constexpr (narrow_integral) { | 515 | 0 | if constexpr (IsDecimal128V2<FromCppT>) { | 516 | 0 | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 517 | 0 | if (UNLIKELY(res < -max_result)) { | 518 | 0 | if (params.is_strict) { | 519 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 520 | 0 | decimal_to_string(from.value(), scale_from), | 521 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 522 | 0 | precision_to, scale_to); | 523 | 0 | } | 524 | 0 | return false; | 525 | 0 | } | 526 | | } else { | 527 | | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 528 | | if (UNLIKELY(res < -max_result)) { | 529 | | if (params.is_strict) { | 530 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 531 | | decimal_to_string(from.value, scale_from), | 532 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 533 | | precision_to, scale_to); | 534 | | } | 535 | | return false; | 536 | | } | 537 | | } | 538 | 0 | to = ToCppT(res); | 539 | | } else { | 540 | | if constexpr (IsDecimal128V2<FromCppT>) { | 541 | | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 542 | | } else { | 543 | | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 544 | | } | 545 | | } | 546 | 0 | } | 547 | 0 | return true; | 548 | 708 | } |
Unexecuted instantiation: _ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_14DecimalV2ValueENS_7DecimalIlEELb1ELb0EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKT3_RKNS5_10NativeTypeESF_RNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_14DecimalV2ValueENS_7DecimalIlEELb1ELb1EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKT3_RKNS5_10NativeTypeESF_RNS_14CastParametersE _ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_14DecimalV2ValueENS_12Decimal128V3ELb0ELb0EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 478 | 728 | CastParameters& params) { | 479 | 728 | MaxNativeType res; | 480 | 728 | if (from >= FromCppT(0)) { | 481 | | if constexpr (narrow_integral) { | 482 | | if constexpr (IsDecimal128V2<FromCppT>) { | 483 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 484 | | if (UNLIKELY(res > max_result)) { | 485 | | if (params.is_strict) { | 486 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 487 | | decimal_to_string(from.value(), scale_from), | 488 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 489 | | precision_to, scale_to); | 490 | | } | 491 | | return false; | 492 | | } | 493 | | } else { | 494 | | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 495 | | if (UNLIKELY(res > max_result)) { | 496 | | if (params.is_strict) { | 497 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 498 | | decimal_to_string(from.value, scale_from), | 499 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 500 | | precision_to, scale_to); | 501 | | } | 502 | | return false; | 503 | | } | 504 | | } | 505 | | to = ToCppT(res); | 506 | 728 | } else { | 507 | 728 | if constexpr (IsDecimal128V2<FromCppT>) { | 508 | 728 | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 509 | | } else { | 510 | | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 511 | | } | 512 | 728 | } | 513 | 728 | } else { | 514 | | if constexpr (narrow_integral) { | 515 | | if constexpr (IsDecimal128V2<FromCppT>) { | 516 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 517 | | if (UNLIKELY(res < -max_result)) { | 518 | | if (params.is_strict) { | 519 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 520 | | decimal_to_string(from.value(), scale_from), | 521 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 522 | | precision_to, scale_to); | 523 | | } | 524 | | return false; | 525 | | } | 526 | | } else { | 527 | | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 528 | | if (UNLIKELY(res < -max_result)) { | 529 | | if (params.is_strict) { | 530 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 531 | | decimal_to_string(from.value, scale_from), | 532 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 533 | | precision_to, scale_to); | 534 | | } | 535 | | return false; | 536 | | } | 537 | | } | 538 | | to = ToCppT(res); | 539 | 0 | } else { | 540 | 0 | if constexpr (IsDecimal128V2<FromCppT>) { | 541 | 0 | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 542 | | } else { | 543 | | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 544 | | } | 545 | 0 | } | 546 | 0 | } | 547 | 728 | return true; | 548 | 728 | } |
_ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_14DecimalV2ValueENS_12Decimal128V3ELb0ELb1EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 478 | 100 | CastParameters& params) { | 479 | 100 | MaxNativeType res; | 480 | 100 | if (from >= FromCppT(0)) { | 481 | 100 | if constexpr (narrow_integral) { | 482 | 100 | if constexpr (IsDecimal128V2<FromCppT>) { | 483 | 100 | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 484 | 100 | if (UNLIKELY(res > max_result)) { | 485 | 8 | if (params.is_strict) { | 486 | 4 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 487 | 4 | decimal_to_string(from.value(), scale_from), | 488 | 4 | fmt::format("decimal({}, {})", precision_from, scale_from), | 489 | 4 | precision_to, scale_to); | 490 | 4 | } | 491 | 8 | return false; | 492 | 8 | } | 493 | | } else { | 494 | | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 495 | | if (UNLIKELY(res > max_result)) { | 496 | | if (params.is_strict) { | 497 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 498 | | decimal_to_string(from.value, scale_from), | 499 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 500 | | precision_to, scale_to); | 501 | | } | 502 | | return false; | 503 | | } | 504 | | } | 505 | 92 | to = ToCppT(res); | 506 | | } else { | 507 | | if constexpr (IsDecimal128V2<FromCppT>) { | 508 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 509 | | } else { | 510 | | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 511 | | } | 512 | | } | 513 | 100 | } else { | 514 | 0 | if constexpr (narrow_integral) { | 515 | 0 | if constexpr (IsDecimal128V2<FromCppT>) { | 516 | 0 | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 517 | 0 | if (UNLIKELY(res < -max_result)) { | 518 | 0 | if (params.is_strict) { | 519 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 520 | 0 | decimal_to_string(from.value(), scale_from), | 521 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 522 | 0 | precision_to, scale_to); | 523 | 0 | } | 524 | 0 | return false; | 525 | 0 | } | 526 | | } else { | 527 | | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 528 | | if (UNLIKELY(res < -max_result)) { | 529 | | if (params.is_strict) { | 530 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 531 | | decimal_to_string(from.value, scale_from), | 532 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 533 | | precision_to, scale_to); | 534 | | } | 535 | | return false; | 536 | | } | 537 | | } | 538 | 0 | to = ToCppT(res); | 539 | | } else { | 540 | | if constexpr (IsDecimal128V2<FromCppT>) { | 541 | | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 542 | | } else { | 543 | | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 544 | | } | 545 | | } | 546 | 0 | } | 547 | 0 | return true; | 548 | 100 | } |
Unexecuted instantiation: _ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_14DecimalV2ValueENS_12Decimal128V3ELb1ELb0EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_14DecimalV2ValueENS_12Decimal128V3ELb1ELb1EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE _ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_14DecimalV2ValueENS_7DecimalIN4wide7integerILm256EiEEEELb0ELb0ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKT3_RKNS8_10NativeTypeESI_RNS_14CastParametersE Line | Count | Source | 478 | 824 | CastParameters& params) { | 479 | 824 | MaxNativeType res; | 480 | 824 | if (from >= FromCppT(0)) { | 481 | | if constexpr (narrow_integral) { | 482 | | if constexpr (IsDecimal128V2<FromCppT>) { | 483 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 484 | | if (UNLIKELY(res > max_result)) { | 485 | | if (params.is_strict) { | 486 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 487 | | decimal_to_string(from.value(), scale_from), | 488 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 489 | | precision_to, scale_to); | 490 | | } | 491 | | return false; | 492 | | } | 493 | | } else { | 494 | | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 495 | | if (UNLIKELY(res > max_result)) { | 496 | | if (params.is_strict) { | 497 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 498 | | decimal_to_string(from.value, scale_from), | 499 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 500 | | precision_to, scale_to); | 501 | | } | 502 | | return false; | 503 | | } | 504 | | } | 505 | | to = ToCppT(res); | 506 | 824 | } else { | 507 | 824 | if constexpr (IsDecimal128V2<FromCppT>) { | 508 | 824 | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 509 | | } else { | 510 | | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 511 | | } | 512 | 824 | } | 513 | 824 | } else { | 514 | | if constexpr (narrow_integral) { | 515 | | if constexpr (IsDecimal128V2<FromCppT>) { | 516 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 517 | | if (UNLIKELY(res < -max_result)) { | 518 | | if (params.is_strict) { | 519 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 520 | | decimal_to_string(from.value(), scale_from), | 521 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 522 | | precision_to, scale_to); | 523 | | } | 524 | | return false; | 525 | | } | 526 | | } else { | 527 | | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 528 | | if (UNLIKELY(res < -max_result)) { | 529 | | if (params.is_strict) { | 530 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 531 | | decimal_to_string(from.value, scale_from), | 532 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 533 | | precision_to, scale_to); | 534 | | } | 535 | | return false; | 536 | | } | 537 | | } | 538 | | to = ToCppT(res); | 539 | 0 | } else { | 540 | 0 | if constexpr (IsDecimal128V2<FromCppT>) { | 541 | 0 | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 542 | | } else { | 543 | | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 544 | | } | 545 | 0 | } | 546 | 0 | } | 547 | 824 | return true; | 548 | 824 | } |
Unexecuted instantiation: _ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_14DecimalV2ValueENS_7DecimalIN4wide7integerILm256EiEEEELb0ELb1ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKT3_RKNS8_10NativeTypeESI_RNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_14DecimalV2ValueENS_7DecimalIN4wide7integerILm256EiEEEELb1ELb0ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKT3_RKNS8_10NativeTypeESI_RNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_14DecimalV2ValueENS_7DecimalIN4wide7integerILm256EiEEEELb1ELb1ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKT3_RKNS8_10NativeTypeESI_RNS_14CastParametersE |
549 | | |
550 | | template <typename FromCppT, typename ToCppT, bool multiply_may_overflow, bool narrow_integral, |
551 | | typename MaxNativeType = |
552 | | std::conditional_t<(sizeof(FromCppT) > sizeof(typename ToCppT::NativeType)), |
553 | | FromCppT, typename ToCppT::NativeType>> |
554 | | requires(IsDecimalNumber<ToCppT> && !IsDecimal128V2<ToCppT> && |
555 | | (IsCppTypeInt<FromCppT> || std::is_same_v<FromCppT, UInt8>)) |
556 | | static inline bool _from_int(const FromCppT& from, ToCppT& to, UInt32 precision, UInt32 scale, |
557 | | const MaxNativeType& scale_multiplier, |
558 | | const typename ToCppT::NativeType& min_result, |
559 | | const typename ToCppT::NativeType& max_result, |
560 | 6.67k | CastParameters& params) { |
561 | 6.67k | MaxNativeType tmp; |
562 | 6.67k | if constexpr (multiply_may_overflow) { |
563 | 2.11k | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { |
564 | 308 | if (params.is_strict) { |
565 | 152 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, |
566 | 152 | precision, scale); |
567 | 152 | } |
568 | 308 | return false; |
569 | 308 | } |
570 | 1.80k | if constexpr (narrow_integral) { |
571 | 1.80k | if (tmp < min_result || tmp > max_result) { |
572 | 354 | if (params.is_strict) { |
573 | 176 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( |
574 | 176 | from, int_type_name<FromCppT>, precision, scale); |
575 | 176 | } |
576 | 354 | return false; |
577 | 354 | } |
578 | 1.80k | } |
579 | 1.44k | to.value = static_cast<typename ToCppT::NativeType>(tmp); |
580 | 4.56k | } else { |
581 | 4.56k | tmp = scale_multiplier * from; |
582 | 4.56k | if constexpr (narrow_integral) { |
583 | 2.84k | if (tmp < min_result || tmp > max_result) { |
584 | 866 | if (params.is_strict) { |
585 | 432 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( |
586 | 432 | from, int_type_name<FromCppT>, precision, scale); |
587 | 432 | } |
588 | 866 | return false; |
589 | 866 | } |
590 | 2.84k | } |
591 | 1.97k | to.value = static_cast<typename ToCppT::NativeType>(tmp); |
592 | 4.56k | } |
593 | | |
594 | 0 | return true; |
595 | 6.67k | } _ZN5doris13CastToDecimal9_from_intIhNS_7DecimalIiEELb0ELb0EiQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS4_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 560 | 20 | CastParameters& params) { | 561 | 20 | MaxNativeType tmp; | 562 | | if constexpr (multiply_may_overflow) { | 563 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | | if (params.is_strict) { | 565 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | | precision, scale); | 567 | | } | 568 | | return false; | 569 | | } | 570 | | if constexpr (narrow_integral) { | 571 | | if (tmp < min_result || tmp > max_result) { | 572 | | if (params.is_strict) { | 573 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | | from, int_type_name<FromCppT>, precision, scale); | 575 | | } | 576 | | return false; | 577 | | } | 578 | | } | 579 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | 20 | } else { | 581 | 20 | tmp = scale_multiplier * from; | 582 | | if constexpr (narrow_integral) { | 583 | | if (tmp < min_result || tmp > max_result) { | 584 | | if (params.is_strict) { | 585 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | | from, int_type_name<FromCppT>, precision, scale); | 587 | | } | 588 | | return false; | 589 | | } | 590 | | } | 591 | 20 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | 20 | } | 593 | | | 594 | 20 | return true; | 595 | 20 | } |
Unexecuted instantiation: _ZN5doris13CastToDecimal9_from_intIhNS_7DecimalIiEELb0ELb1EiQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS4_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal9_from_intIhNS_7DecimalIiEELb1ELb0EiQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS4_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE _ZN5doris13CastToDecimal9_from_intIhNS_7DecimalIiEELb1ELb1EiQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS4_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 560 | 8 | CastParameters& params) { | 561 | 8 | MaxNativeType tmp; | 562 | 8 | if constexpr (multiply_may_overflow) { | 563 | 8 | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | 0 | if (params.is_strict) { | 565 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | 0 | precision, scale); | 567 | 0 | } | 568 | 0 | return false; | 569 | 0 | } | 570 | 8 | if constexpr (narrow_integral) { | 571 | 8 | if (tmp < min_result || tmp > max_result) { | 572 | 4 | if (params.is_strict) { | 573 | 2 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | 2 | from, int_type_name<FromCppT>, precision, scale); | 575 | 2 | } | 576 | 4 | return false; | 577 | 4 | } | 578 | 8 | } | 579 | 4 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | | } else { | 581 | | tmp = scale_multiplier * from; | 582 | | if constexpr (narrow_integral) { | 583 | | if (tmp < min_result || tmp > max_result) { | 584 | | if (params.is_strict) { | 585 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | | from, int_type_name<FromCppT>, precision, scale); | 587 | | } | 588 | | return false; | 589 | | } | 590 | | } | 591 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | | } | 593 | | | 594 | 0 | return true; | 595 | 8 | } |
_ZN5doris13CastToDecimal9_from_intIaNS_7DecimalIiEELb0ELb0EiQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS4_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 560 | 110 | CastParameters& params) { | 561 | 110 | MaxNativeType tmp; | 562 | | if constexpr (multiply_may_overflow) { | 563 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | | if (params.is_strict) { | 565 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | | precision, scale); | 567 | | } | 568 | | return false; | 569 | | } | 570 | | if constexpr (narrow_integral) { | 571 | | if (tmp < min_result || tmp > max_result) { | 572 | | if (params.is_strict) { | 573 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | | from, int_type_name<FromCppT>, precision, scale); | 575 | | } | 576 | | return false; | 577 | | } | 578 | | } | 579 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | 110 | } else { | 581 | 110 | tmp = scale_multiplier * from; | 582 | | if constexpr (narrow_integral) { | 583 | | if (tmp < min_result || tmp > max_result) { | 584 | | if (params.is_strict) { | 585 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | | from, int_type_name<FromCppT>, precision, scale); | 587 | | } | 588 | | return false; | 589 | | } | 590 | | } | 591 | 110 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | 110 | } | 593 | | | 594 | 110 | return true; | 595 | 110 | } |
_ZN5doris13CastToDecimal9_from_intIaNS_7DecimalIiEELb0ELb1EiQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS4_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 560 | 148 | CastParameters& params) { | 561 | 148 | MaxNativeType tmp; | 562 | | if constexpr (multiply_may_overflow) { | 563 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | | if (params.is_strict) { | 565 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | | precision, scale); | 567 | | } | 568 | | return false; | 569 | | } | 570 | | if constexpr (narrow_integral) { | 571 | | if (tmp < min_result || tmp > max_result) { | 572 | | if (params.is_strict) { | 573 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | | from, int_type_name<FromCppT>, precision, scale); | 575 | | } | 576 | | return false; | 577 | | } | 578 | | } | 579 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | 148 | } else { | 581 | 148 | tmp = scale_multiplier * from; | 582 | 148 | if constexpr (narrow_integral) { | 583 | 148 | if (tmp < min_result || tmp > max_result) { | 584 | 48 | if (params.is_strict) { | 585 | 24 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | 24 | from, int_type_name<FromCppT>, precision, scale); | 587 | 24 | } | 588 | 48 | return false; | 589 | 48 | } | 590 | 148 | } | 591 | 100 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | 148 | } | 593 | | | 594 | 0 | return true; | 595 | 148 | } |
Unexecuted instantiation: _ZN5doris13CastToDecimal9_from_intIaNS_7DecimalIiEELb1ELb0EiQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS4_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE _ZN5doris13CastToDecimal9_from_intIaNS_7DecimalIiEELb1ELb1EiQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS4_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 560 | 44 | CastParameters& params) { | 561 | 44 | MaxNativeType tmp; | 562 | 44 | if constexpr (multiply_may_overflow) { | 563 | 44 | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | 8 | if (params.is_strict) { | 565 | 4 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | 4 | precision, scale); | 567 | 4 | } | 568 | 8 | return false; | 569 | 8 | } | 570 | 36 | if constexpr (narrow_integral) { | 571 | 36 | if (tmp < min_result || tmp > max_result) { | 572 | 8 | if (params.is_strict) { | 573 | 4 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | 4 | from, int_type_name<FromCppT>, precision, scale); | 575 | 4 | } | 576 | 8 | return false; | 577 | 8 | } | 578 | 36 | } | 579 | 28 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | | } else { | 581 | | tmp = scale_multiplier * from; | 582 | | if constexpr (narrow_integral) { | 583 | | if (tmp < min_result || tmp > max_result) { | 584 | | if (params.is_strict) { | 585 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | | from, int_type_name<FromCppT>, precision, scale); | 587 | | } | 588 | | return false; | 589 | | } | 590 | | } | 591 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | | } | 593 | | | 594 | 0 | return true; | 595 | 44 | } |
_ZN5doris13CastToDecimal9_from_intIsNS_7DecimalIiEELb0ELb0EiQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS4_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 560 | 72 | CastParameters& params) { | 561 | 72 | MaxNativeType tmp; | 562 | | if constexpr (multiply_may_overflow) { | 563 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | | if (params.is_strict) { | 565 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | | precision, scale); | 567 | | } | 568 | | return false; | 569 | | } | 570 | | if constexpr (narrow_integral) { | 571 | | if (tmp < min_result || tmp > max_result) { | 572 | | if (params.is_strict) { | 573 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | | from, int_type_name<FromCppT>, precision, scale); | 575 | | } | 576 | | return false; | 577 | | } | 578 | | } | 579 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | 72 | } else { | 581 | 72 | tmp = scale_multiplier * from; | 582 | | if constexpr (narrow_integral) { | 583 | | if (tmp < min_result || tmp > max_result) { | 584 | | if (params.is_strict) { | 585 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | | from, int_type_name<FromCppT>, precision, scale); | 587 | | } | 588 | | return false; | 589 | | } | 590 | | } | 591 | 72 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | 72 | } | 593 | | | 594 | 72 | return true; | 595 | 72 | } |
_ZN5doris13CastToDecimal9_from_intIsNS_7DecimalIiEELb0ELb1EiQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS4_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 560 | 218 | CastParameters& params) { | 561 | 218 | MaxNativeType tmp; | 562 | | if constexpr (multiply_may_overflow) { | 563 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | | if (params.is_strict) { | 565 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | | precision, scale); | 567 | | } | 568 | | return false; | 569 | | } | 570 | | if constexpr (narrow_integral) { | 571 | | if (tmp < min_result || tmp > max_result) { | 572 | | if (params.is_strict) { | 573 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | | from, int_type_name<FromCppT>, precision, scale); | 575 | | } | 576 | | return false; | 577 | | } | 578 | | } | 579 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | 218 | } else { | 581 | 218 | tmp = scale_multiplier * from; | 582 | 218 | if constexpr (narrow_integral) { | 583 | 218 | if (tmp < min_result || tmp > max_result) { | 584 | 66 | if (params.is_strict) { | 585 | 32 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | 32 | from, int_type_name<FromCppT>, precision, scale); | 587 | 32 | } | 588 | 66 | return false; | 589 | 66 | } | 590 | 218 | } | 591 | 152 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | 218 | } | 593 | | | 594 | 0 | return true; | 595 | 218 | } |
Unexecuted instantiation: _ZN5doris13CastToDecimal9_from_intIsNS_7DecimalIiEELb1ELb0EiQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS4_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE _ZN5doris13CastToDecimal9_from_intIsNS_7DecimalIiEELb1ELb1EiQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS4_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 560 | 44 | CastParameters& params) { | 561 | 44 | MaxNativeType tmp; | 562 | 44 | if constexpr (multiply_may_overflow) { | 563 | 44 | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | 8 | if (params.is_strict) { | 565 | 4 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | 4 | precision, scale); | 567 | 4 | } | 568 | 8 | return false; | 569 | 8 | } | 570 | 36 | if constexpr (narrow_integral) { | 571 | 36 | if (tmp < min_result || tmp > max_result) { | 572 | 8 | if (params.is_strict) { | 573 | 4 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | 4 | from, int_type_name<FromCppT>, precision, scale); | 575 | 4 | } | 576 | 8 | return false; | 577 | 8 | } | 578 | 36 | } | 579 | 28 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | | } else { | 581 | | tmp = scale_multiplier * from; | 582 | | if constexpr (narrow_integral) { | 583 | | if (tmp < min_result || tmp > max_result) { | 584 | | if (params.is_strict) { | 585 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | | from, int_type_name<FromCppT>, precision, scale); | 587 | | } | 588 | | return false; | 589 | | } | 590 | | } | 591 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | | } | 593 | | | 594 | 0 | return true; | 595 | 44 | } |
Unexecuted instantiation: _ZN5doris13CastToDecimal9_from_intIiNS_7DecimalIiEELb0ELb0EiQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS4_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE _ZN5doris13CastToDecimal9_from_intIiNS_7DecimalIiEELb0ELb1EiQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS4_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 560 | 180 | CastParameters& params) { | 561 | 180 | MaxNativeType tmp; | 562 | | if constexpr (multiply_may_overflow) { | 563 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | | if (params.is_strict) { | 565 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | | precision, scale); | 567 | | } | 568 | | return false; | 569 | | } | 570 | | if constexpr (narrow_integral) { | 571 | | if (tmp < min_result || tmp > max_result) { | 572 | | if (params.is_strict) { | 573 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | | from, int_type_name<FromCppT>, precision, scale); | 575 | | } | 576 | | return false; | 577 | | } | 578 | | } | 579 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | 180 | } else { | 581 | 180 | tmp = scale_multiplier * from; | 582 | 180 | if constexpr (narrow_integral) { | 583 | 180 | if (tmp < min_result || tmp > max_result) { | 584 | 48 | if (params.is_strict) { | 585 | 24 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | 24 | from, int_type_name<FromCppT>, precision, scale); | 587 | 24 | } | 588 | 48 | return false; | 589 | 48 | } | 590 | 180 | } | 591 | 132 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | 180 | } | 593 | | | 594 | 0 | return true; | 595 | 180 | } |
Unexecuted instantiation: _ZN5doris13CastToDecimal9_from_intIiNS_7DecimalIiEELb1ELb0EiQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS4_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE _ZN5doris13CastToDecimal9_from_intIiNS_7DecimalIiEELb1ELb1EiQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS4_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 560 | 218 | CastParameters& params) { | 561 | 218 | MaxNativeType tmp; | 562 | 218 | if constexpr (multiply_may_overflow) { | 563 | 218 | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | 34 | if (params.is_strict) { | 565 | 16 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | 16 | precision, scale); | 567 | 16 | } | 568 | 34 | return false; | 569 | 34 | } | 570 | 184 | if constexpr (narrow_integral) { | 571 | 184 | if (tmp < min_result || tmp > max_result) { | 572 | 32 | if (params.is_strict) { | 573 | 16 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | 16 | from, int_type_name<FromCppT>, precision, scale); | 575 | 16 | } | 576 | 32 | return false; | 577 | 32 | } | 578 | 184 | } | 579 | 152 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | | } else { | 581 | | tmp = scale_multiplier * from; | 582 | | if constexpr (narrow_integral) { | 583 | | if (tmp < min_result || tmp > max_result) { | 584 | | if (params.is_strict) { | 585 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | | from, int_type_name<FromCppT>, precision, scale); | 587 | | } | 588 | | return false; | 589 | | } | 590 | | } | 591 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | | } | 593 | | | 594 | 0 | return true; | 595 | 218 | } |
Unexecuted instantiation: _ZN5doris13CastToDecimal9_from_intIlNS_7DecimalIiEELb0ELb0ElQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS4_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE _ZN5doris13CastToDecimal9_from_intIlNS_7DecimalIiEELb0ELb1ElQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS4_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 560 | 180 | CastParameters& params) { | 561 | 180 | MaxNativeType tmp; | 562 | | if constexpr (multiply_may_overflow) { | 563 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | | if (params.is_strict) { | 565 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | | precision, scale); | 567 | | } | 568 | | return false; | 569 | | } | 570 | | if constexpr (narrow_integral) { | 571 | | if (tmp < min_result || tmp > max_result) { | 572 | | if (params.is_strict) { | 573 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | | from, int_type_name<FromCppT>, precision, scale); | 575 | | } | 576 | | return false; | 577 | | } | 578 | | } | 579 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | 180 | } else { | 581 | 180 | tmp = scale_multiplier * from; | 582 | 180 | if constexpr (narrow_integral) { | 583 | 180 | if (tmp < min_result || tmp > max_result) { | 584 | 48 | if (params.is_strict) { | 585 | 24 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | 24 | from, int_type_name<FromCppT>, precision, scale); | 587 | 24 | } | 588 | 48 | return false; | 589 | 48 | } | 590 | 180 | } | 591 | 132 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | 180 | } | 593 | | | 594 | 0 | return true; | 595 | 180 | } |
Unexecuted instantiation: _ZN5doris13CastToDecimal9_from_intIlNS_7DecimalIiEELb1ELb0ElQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS4_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE _ZN5doris13CastToDecimal9_from_intIlNS_7DecimalIiEELb1ELb1ElQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS4_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 560 | 218 | CastParameters& params) { | 561 | 218 | MaxNativeType tmp; | 562 | 218 | if constexpr (multiply_may_overflow) { | 563 | 218 | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | 34 | if (params.is_strict) { | 565 | 16 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | 16 | precision, scale); | 567 | 16 | } | 568 | 34 | return false; | 569 | 34 | } | 570 | 184 | if constexpr (narrow_integral) { | 571 | 184 | if (tmp < min_result || tmp > max_result) { | 572 | 32 | if (params.is_strict) { | 573 | 16 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | 16 | from, int_type_name<FromCppT>, precision, scale); | 575 | 16 | } | 576 | 32 | return false; | 577 | 32 | } | 578 | 184 | } | 579 | 152 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | | } else { | 581 | | tmp = scale_multiplier * from; | 582 | | if constexpr (narrow_integral) { | 583 | | if (tmp < min_result || tmp > max_result) { | 584 | | if (params.is_strict) { | 585 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | | from, int_type_name<FromCppT>, precision, scale); | 587 | | } | 588 | | return false; | 589 | | } | 590 | | } | 591 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | | } | 593 | | | 594 | 0 | return true; | 595 | 218 | } |
Unexecuted instantiation: _ZN5doris13CastToDecimal9_from_intInNS_7DecimalIiEELb0ELb0EnQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS4_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE _ZN5doris13CastToDecimal9_from_intInNS_7DecimalIiEELb0ELb1EnQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS4_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 560 | 180 | CastParameters& params) { | 561 | 180 | MaxNativeType tmp; | 562 | | if constexpr (multiply_may_overflow) { | 563 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | | if (params.is_strict) { | 565 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | | precision, scale); | 567 | | } | 568 | | return false; | 569 | | } | 570 | | if constexpr (narrow_integral) { | 571 | | if (tmp < min_result || tmp > max_result) { | 572 | | if (params.is_strict) { | 573 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | | from, int_type_name<FromCppT>, precision, scale); | 575 | | } | 576 | | return false; | 577 | | } | 578 | | } | 579 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | 180 | } else { | 581 | 180 | tmp = scale_multiplier * from; | 582 | 180 | if constexpr (narrow_integral) { | 583 | 180 | if (tmp < min_result || tmp > max_result) { | 584 | 48 | if (params.is_strict) { | 585 | 24 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | 24 | from, int_type_name<FromCppT>, precision, scale); | 587 | 24 | } | 588 | 48 | return false; | 589 | 48 | } | 590 | 180 | } | 591 | 132 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | 180 | } | 593 | | | 594 | 0 | return true; | 595 | 180 | } |
Unexecuted instantiation: _ZN5doris13CastToDecimal9_from_intInNS_7DecimalIiEELb1ELb0EnQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS4_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE _ZN5doris13CastToDecimal9_from_intInNS_7DecimalIiEELb1ELb1EnQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS4_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 560 | 218 | CastParameters& params) { | 561 | 218 | MaxNativeType tmp; | 562 | 218 | if constexpr (multiply_may_overflow) { | 563 | 218 | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | 32 | if (params.is_strict) { | 565 | 16 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | 16 | precision, scale); | 567 | 16 | } | 568 | 32 | return false; | 569 | 32 | } | 570 | 186 | if constexpr (narrow_integral) { | 571 | 186 | if (tmp < min_result || tmp > max_result) { | 572 | 34 | if (params.is_strict) { | 573 | 16 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | 16 | from, int_type_name<FromCppT>, precision, scale); | 575 | 16 | } | 576 | 34 | return false; | 577 | 34 | } | 578 | 186 | } | 579 | 152 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | | } else { | 581 | | tmp = scale_multiplier * from; | 582 | | if constexpr (narrow_integral) { | 583 | | if (tmp < min_result || tmp > max_result) { | 584 | | if (params.is_strict) { | 585 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | | from, int_type_name<FromCppT>, precision, scale); | 587 | | } | 588 | | return false; | 589 | | } | 590 | | } | 591 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | | } | 593 | | | 594 | 0 | return true; | 595 | 218 | } |
_ZN5doris13CastToDecimal9_from_intIhNS_7DecimalIlEELb0ELb0ElQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS4_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 560 | 16 | CastParameters& params) { | 561 | 16 | MaxNativeType tmp; | 562 | | if constexpr (multiply_may_overflow) { | 563 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | | if (params.is_strict) { | 565 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | | precision, scale); | 567 | | } | 568 | | return false; | 569 | | } | 570 | | if constexpr (narrow_integral) { | 571 | | if (tmp < min_result || tmp > max_result) { | 572 | | if (params.is_strict) { | 573 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | | from, int_type_name<FromCppT>, precision, scale); | 575 | | } | 576 | | return false; | 577 | | } | 578 | | } | 579 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | 16 | } else { | 581 | 16 | tmp = scale_multiplier * from; | 582 | | if constexpr (narrow_integral) { | 583 | | if (tmp < min_result || tmp > max_result) { | 584 | | if (params.is_strict) { | 585 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | | from, int_type_name<FromCppT>, precision, scale); | 587 | | } | 588 | | return false; | 589 | | } | 590 | | } | 591 | 16 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | 16 | } | 593 | | | 594 | 16 | return true; | 595 | 16 | } |
Unexecuted instantiation: _ZN5doris13CastToDecimal9_from_intIhNS_7DecimalIlEELb0ELb1ElQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS4_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal9_from_intIhNS_7DecimalIlEELb1ELb0ElQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS4_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE _ZN5doris13CastToDecimal9_from_intIhNS_7DecimalIlEELb1ELb1ElQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS4_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 560 | 8 | CastParameters& params) { | 561 | 8 | MaxNativeType tmp; | 562 | 8 | if constexpr (multiply_may_overflow) { | 563 | 8 | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | 0 | if (params.is_strict) { | 565 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | 0 | precision, scale); | 567 | 0 | } | 568 | 0 | return false; | 569 | 0 | } | 570 | 8 | if constexpr (narrow_integral) { | 571 | 8 | if (tmp < min_result || tmp > max_result) { | 572 | 4 | if (params.is_strict) { | 573 | 2 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | 2 | from, int_type_name<FromCppT>, precision, scale); | 575 | 2 | } | 576 | 4 | return false; | 577 | 4 | } | 578 | 8 | } | 579 | 4 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | | } else { | 581 | | tmp = scale_multiplier * from; | 582 | | if constexpr (narrow_integral) { | 583 | | if (tmp < min_result || tmp > max_result) { | 584 | | if (params.is_strict) { | 585 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | | from, int_type_name<FromCppT>, precision, scale); | 587 | | } | 588 | | return false; | 589 | | } | 590 | | } | 591 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | | } | 593 | | | 594 | 0 | return true; | 595 | 8 | } |
_ZN5doris13CastToDecimal9_from_intIaNS_7DecimalIlEELb0ELb0ElQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS4_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 560 | 144 | CastParameters& params) { | 561 | 144 | MaxNativeType tmp; | 562 | | if constexpr (multiply_may_overflow) { | 563 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | | if (params.is_strict) { | 565 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | | precision, scale); | 567 | | } | 568 | | return false; | 569 | | } | 570 | | if constexpr (narrow_integral) { | 571 | | if (tmp < min_result || tmp > max_result) { | 572 | | if (params.is_strict) { | 573 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | | from, int_type_name<FromCppT>, precision, scale); | 575 | | } | 576 | | return false; | 577 | | } | 578 | | } | 579 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | 144 | } else { | 581 | 144 | tmp = scale_multiplier * from; | 582 | | if constexpr (narrow_integral) { | 583 | | if (tmp < min_result || tmp > max_result) { | 584 | | if (params.is_strict) { | 585 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | | from, int_type_name<FromCppT>, precision, scale); | 587 | | } | 588 | | return false; | 589 | | } | 590 | | } | 591 | 144 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | 144 | } | 593 | | | 594 | 144 | return true; | 595 | 144 | } |
_ZN5doris13CastToDecimal9_from_intIaNS_7DecimalIlEELb0ELb1ElQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS4_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 560 | 88 | CastParameters& params) { | 561 | 88 | MaxNativeType tmp; | 562 | | if constexpr (multiply_may_overflow) { | 563 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | | if (params.is_strict) { | 565 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | | precision, scale); | 567 | | } | 568 | | return false; | 569 | | } | 570 | | if constexpr (narrow_integral) { | 571 | | if (tmp < min_result || tmp > max_result) { | 572 | | if (params.is_strict) { | 573 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | | from, int_type_name<FromCppT>, precision, scale); | 575 | | } | 576 | | return false; | 577 | | } | 578 | | } | 579 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | 88 | } else { | 581 | 88 | tmp = scale_multiplier * from; | 582 | 88 | if constexpr (narrow_integral) { | 583 | 88 | if (tmp < min_result || tmp > max_result) { | 584 | 32 | if (params.is_strict) { | 585 | 16 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | 16 | from, int_type_name<FromCppT>, precision, scale); | 587 | 16 | } | 588 | 32 | return false; | 589 | 32 | } | 590 | 88 | } | 591 | 56 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | 88 | } | 593 | | | 594 | 0 | return true; | 595 | 88 | } |
Unexecuted instantiation: _ZN5doris13CastToDecimal9_from_intIaNS_7DecimalIlEELb1ELb0ElQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS4_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE _ZN5doris13CastToDecimal9_from_intIaNS_7DecimalIlEELb1ELb1ElQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS4_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 560 | 44 | CastParameters& params) { | 561 | 44 | MaxNativeType tmp; | 562 | 44 | if constexpr (multiply_may_overflow) { | 563 | 44 | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | 8 | if (params.is_strict) { | 565 | 4 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | 4 | precision, scale); | 567 | 4 | } | 568 | 8 | return false; | 569 | 8 | } | 570 | 36 | if constexpr (narrow_integral) { | 571 | 36 | if (tmp < min_result || tmp > max_result) { | 572 | 8 | if (params.is_strict) { | 573 | 4 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | 4 | from, int_type_name<FromCppT>, precision, scale); | 575 | 4 | } | 576 | 8 | return false; | 577 | 8 | } | 578 | 36 | } | 579 | 28 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | | } else { | 581 | | tmp = scale_multiplier * from; | 582 | | if constexpr (narrow_integral) { | 583 | | if (tmp < min_result || tmp > max_result) { | 584 | | if (params.is_strict) { | 585 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | | from, int_type_name<FromCppT>, precision, scale); | 587 | | } | 588 | | return false; | 589 | | } | 590 | | } | 591 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | | } | 593 | | | 594 | 0 | return true; | 595 | 44 | } |
_ZN5doris13CastToDecimal9_from_intIsNS_7DecimalIlEELb0ELb0ElQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS4_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 560 | 144 | CastParameters& params) { | 561 | 144 | MaxNativeType tmp; | 562 | | if constexpr (multiply_may_overflow) { | 563 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | | if (params.is_strict) { | 565 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | | precision, scale); | 567 | | } | 568 | | return false; | 569 | | } | 570 | | if constexpr (narrow_integral) { | 571 | | if (tmp < min_result || tmp > max_result) { | 572 | | if (params.is_strict) { | 573 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | | from, int_type_name<FromCppT>, precision, scale); | 575 | | } | 576 | | return false; | 577 | | } | 578 | | } | 579 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | 144 | } else { | 581 | 144 | tmp = scale_multiplier * from; | 582 | | if constexpr (narrow_integral) { | 583 | | if (tmp < min_result || tmp > max_result) { | 584 | | if (params.is_strict) { | 585 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | | from, int_type_name<FromCppT>, precision, scale); | 587 | | } | 588 | | return false; | 589 | | } | 590 | | } | 591 | 144 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | 144 | } | 593 | | | 594 | 144 | return true; | 595 | 144 | } |
_ZN5doris13CastToDecimal9_from_intIsNS_7DecimalIlEELb0ELb1ElQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS4_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 560 | 88 | CastParameters& params) { | 561 | 88 | MaxNativeType tmp; | 562 | | if constexpr (multiply_may_overflow) { | 563 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | | if (params.is_strict) { | 565 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | | precision, scale); | 567 | | } | 568 | | return false; | 569 | | } | 570 | | if constexpr (narrow_integral) { | 571 | | if (tmp < min_result || tmp > max_result) { | 572 | | if (params.is_strict) { | 573 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | | from, int_type_name<FromCppT>, precision, scale); | 575 | | } | 576 | | return false; | 577 | | } | 578 | | } | 579 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | 88 | } else { | 581 | 88 | tmp = scale_multiplier * from; | 582 | 88 | if constexpr (narrow_integral) { | 583 | 88 | if (tmp < min_result || tmp > max_result) { | 584 | 32 | if (params.is_strict) { | 585 | 16 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | 16 | from, int_type_name<FromCppT>, precision, scale); | 587 | 16 | } | 588 | 32 | return false; | 589 | 32 | } | 590 | 88 | } | 591 | 56 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | 88 | } | 593 | | | 594 | 0 | return true; | 595 | 88 | } |
Unexecuted instantiation: _ZN5doris13CastToDecimal9_from_intIsNS_7DecimalIlEELb1ELb0ElQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS4_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE _ZN5doris13CastToDecimal9_from_intIsNS_7DecimalIlEELb1ELb1ElQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS4_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 560 | 44 | CastParameters& params) { | 561 | 44 | MaxNativeType tmp; | 562 | 44 | if constexpr (multiply_may_overflow) { | 563 | 44 | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | 8 | if (params.is_strict) { | 565 | 4 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | 4 | precision, scale); | 567 | 4 | } | 568 | 8 | return false; | 569 | 8 | } | 570 | 36 | if constexpr (narrow_integral) { | 571 | 36 | if (tmp < min_result || tmp > max_result) { | 572 | 8 | if (params.is_strict) { | 573 | 4 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | 4 | from, int_type_name<FromCppT>, precision, scale); | 575 | 4 | } | 576 | 8 | return false; | 577 | 8 | } | 578 | 36 | } | 579 | 28 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | | } else { | 581 | | tmp = scale_multiplier * from; | 582 | | if constexpr (narrow_integral) { | 583 | | if (tmp < min_result || tmp > max_result) { | 584 | | if (params.is_strict) { | 585 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | | from, int_type_name<FromCppT>, precision, scale); | 587 | | } | 588 | | return false; | 589 | | } | 590 | | } | 591 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | | } | 593 | | | 594 | 0 | return true; | 595 | 44 | } |
_ZN5doris13CastToDecimal9_from_intIiNS_7DecimalIlEELb0ELb0ElQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS4_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 560 | 36 | CastParameters& params) { | 561 | 36 | MaxNativeType tmp; | 562 | | if constexpr (multiply_may_overflow) { | 563 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | | if (params.is_strict) { | 565 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | | precision, scale); | 567 | | } | 568 | | return false; | 569 | | } | 570 | | if constexpr (narrow_integral) { | 571 | | if (tmp < min_result || tmp > max_result) { | 572 | | if (params.is_strict) { | 573 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | | from, int_type_name<FromCppT>, precision, scale); | 575 | | } | 576 | | return false; | 577 | | } | 578 | | } | 579 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | 36 | } else { | 581 | 36 | tmp = scale_multiplier * from; | 582 | | if constexpr (narrow_integral) { | 583 | | if (tmp < min_result || tmp > max_result) { | 584 | | if (params.is_strict) { | 585 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | | from, int_type_name<FromCppT>, precision, scale); | 587 | | } | 588 | | return false; | 589 | | } | 590 | | } | 591 | 36 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | 36 | } | 593 | | | 594 | 36 | return true; | 595 | 36 | } |
_ZN5doris13CastToDecimal9_from_intIiNS_7DecimalIlEELb0ELb1ElQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS4_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 560 | 224 | CastParameters& params) { | 561 | 224 | MaxNativeType tmp; | 562 | | if constexpr (multiply_may_overflow) { | 563 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | | if (params.is_strict) { | 565 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | | precision, scale); | 567 | | } | 568 | | return false; | 569 | | } | 570 | | if constexpr (narrow_integral) { | 571 | | if (tmp < min_result || tmp > max_result) { | 572 | | if (params.is_strict) { | 573 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | | from, int_type_name<FromCppT>, precision, scale); | 575 | | } | 576 | | return false; | 577 | | } | 578 | | } | 579 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | 224 | } else { | 581 | 224 | tmp = scale_multiplier * from; | 582 | 224 | if constexpr (narrow_integral) { | 583 | 224 | if (tmp < min_result || tmp > max_result) { | 584 | 64 | if (params.is_strict) { | 585 | 32 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | 32 | from, int_type_name<FromCppT>, precision, scale); | 587 | 32 | } | 588 | 64 | return false; | 589 | 64 | } | 590 | 224 | } | 591 | 160 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | 224 | } | 593 | | | 594 | 0 | return true; | 595 | 224 | } |
Unexecuted instantiation: _ZN5doris13CastToDecimal9_from_intIiNS_7DecimalIlEELb1ELb0ElQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS4_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE _ZN5doris13CastToDecimal9_from_intIiNS_7DecimalIlEELb1ELb1ElQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS4_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 560 | 112 | CastParameters& params) { | 561 | 112 | MaxNativeType tmp; | 562 | 112 | if constexpr (multiply_may_overflow) { | 563 | 112 | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | 8 | if (params.is_strict) { | 565 | 4 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | 4 | precision, scale); | 567 | 4 | } | 568 | 8 | return false; | 569 | 8 | } | 570 | 104 | if constexpr (narrow_integral) { | 571 | 104 | if (tmp < min_result || tmp > max_result) { | 572 | 24 | if (params.is_strict) { | 573 | 12 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | 12 | from, int_type_name<FromCppT>, precision, scale); | 575 | 12 | } | 576 | 24 | return false; | 577 | 24 | } | 578 | 104 | } | 579 | 80 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | | } else { | 581 | | tmp = scale_multiplier * from; | 582 | | if constexpr (narrow_integral) { | 583 | | if (tmp < min_result || tmp > max_result) { | 584 | | if (params.is_strict) { | 585 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | | from, int_type_name<FromCppT>, precision, scale); | 587 | | } | 588 | | return false; | 589 | | } | 590 | | } | 591 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | | } | 593 | | | 594 | 0 | return true; | 595 | 112 | } |
Unexecuted instantiation: _ZN5doris13CastToDecimal9_from_intIlNS_7DecimalIlEELb0ELb0ElQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS4_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE _ZN5doris13CastToDecimal9_from_intIlNS_7DecimalIlEELb0ELb1ElQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS4_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 560 | 180 | CastParameters& params) { | 561 | 180 | MaxNativeType tmp; | 562 | | if constexpr (multiply_may_overflow) { | 563 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | | if (params.is_strict) { | 565 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | | precision, scale); | 567 | | } | 568 | | return false; | 569 | | } | 570 | | if constexpr (narrow_integral) { | 571 | | if (tmp < min_result || tmp > max_result) { | 572 | | if (params.is_strict) { | 573 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | | from, int_type_name<FromCppT>, precision, scale); | 575 | | } | 576 | | return false; | 577 | | } | 578 | | } | 579 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | 180 | } else { | 581 | 180 | tmp = scale_multiplier * from; | 582 | 180 | if constexpr (narrow_integral) { | 583 | 180 | if (tmp < min_result || tmp > max_result) { | 584 | 48 | if (params.is_strict) { | 585 | 24 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | 24 | from, int_type_name<FromCppT>, precision, scale); | 587 | 24 | } | 588 | 48 | return false; | 589 | 48 | } | 590 | 180 | } | 591 | 132 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | 180 | } | 593 | | | 594 | 0 | return true; | 595 | 180 | } |
Unexecuted instantiation: _ZN5doris13CastToDecimal9_from_intIlNS_7DecimalIlEELb1ELb0ElQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS4_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE _ZN5doris13CastToDecimal9_from_intIlNS_7DecimalIlEELb1ELb1ElQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS4_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 560 | 224 | CastParameters& params) { | 561 | 224 | MaxNativeType tmp; | 562 | 224 | if constexpr (multiply_may_overflow) { | 563 | 224 | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | 32 | if (params.is_strict) { | 565 | 16 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | 16 | precision, scale); | 567 | 16 | } | 568 | 32 | return false; | 569 | 32 | } | 570 | 192 | if constexpr (narrow_integral) { | 571 | 192 | if (tmp < min_result || tmp > max_result) { | 572 | 32 | if (params.is_strict) { | 573 | 16 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | 16 | from, int_type_name<FromCppT>, precision, scale); | 575 | 16 | } | 576 | 32 | return false; | 577 | 32 | } | 578 | 192 | } | 579 | 160 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | | } else { | 581 | | tmp = scale_multiplier * from; | 582 | | if constexpr (narrow_integral) { | 583 | | if (tmp < min_result || tmp > max_result) { | 584 | | if (params.is_strict) { | 585 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | | from, int_type_name<FromCppT>, precision, scale); | 587 | | } | 588 | | return false; | 589 | | } | 590 | | } | 591 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | | } | 593 | | | 594 | 0 | return true; | 595 | 224 | } |
Unexecuted instantiation: _ZN5doris13CastToDecimal9_from_intInNS_7DecimalIlEELb0ELb0EnQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS4_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE _ZN5doris13CastToDecimal9_from_intInNS_7DecimalIlEELb0ELb1EnQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS4_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 560 | 180 | CastParameters& params) { | 561 | 180 | MaxNativeType tmp; | 562 | | if constexpr (multiply_may_overflow) { | 563 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | | if (params.is_strict) { | 565 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | | precision, scale); | 567 | | } | 568 | | return false; | 569 | | } | 570 | | if constexpr (narrow_integral) { | 571 | | if (tmp < min_result || tmp > max_result) { | 572 | | if (params.is_strict) { | 573 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | | from, int_type_name<FromCppT>, precision, scale); | 575 | | } | 576 | | return false; | 577 | | } | 578 | | } | 579 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | 180 | } else { | 581 | 180 | tmp = scale_multiplier * from; | 582 | 180 | if constexpr (narrow_integral) { | 583 | 180 | if (tmp < min_result || tmp > max_result) { | 584 | 48 | if (params.is_strict) { | 585 | 24 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | 24 | from, int_type_name<FromCppT>, precision, scale); | 587 | 24 | } | 588 | 48 | return false; | 589 | 48 | } | 590 | 180 | } | 591 | 132 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | 180 | } | 593 | | | 594 | 0 | return true; | 595 | 180 | } |
Unexecuted instantiation: _ZN5doris13CastToDecimal9_from_intInNS_7DecimalIlEELb1ELb0EnQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS4_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE _ZN5doris13CastToDecimal9_from_intInNS_7DecimalIlEELb1ELb1EnQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS4_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 560 | 224 | CastParameters& params) { | 561 | 224 | MaxNativeType tmp; | 562 | 224 | if constexpr (multiply_may_overflow) { | 563 | 224 | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | 32 | if (params.is_strict) { | 565 | 16 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | 16 | precision, scale); | 567 | 16 | } | 568 | 32 | return false; | 569 | 32 | } | 570 | 192 | if constexpr (narrow_integral) { | 571 | 192 | if (tmp < min_result || tmp > max_result) { | 572 | 32 | if (params.is_strict) { | 573 | 16 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | 16 | from, int_type_name<FromCppT>, precision, scale); | 575 | 16 | } | 576 | 32 | return false; | 577 | 32 | } | 578 | 192 | } | 579 | 160 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | | } else { | 581 | | tmp = scale_multiplier * from; | 582 | | if constexpr (narrow_integral) { | 583 | | if (tmp < min_result || tmp > max_result) { | 584 | | if (params.is_strict) { | 585 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | | from, int_type_name<FromCppT>, precision, scale); | 587 | | } | 588 | | return false; | 589 | | } | 590 | | } | 591 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | | } | 593 | | | 594 | 0 | return true; | 595 | 224 | } |
_ZN5doris13CastToDecimal9_from_intIhNS_12Decimal128V3ELb0ELb0EnQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS3_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRKT3_RKNS3_10NativeTypeESD_RNS_14CastParametersE Line | Count | Source | 560 | 16 | CastParameters& params) { | 561 | 16 | MaxNativeType tmp; | 562 | | if constexpr (multiply_may_overflow) { | 563 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | | if (params.is_strict) { | 565 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | | precision, scale); | 567 | | } | 568 | | return false; | 569 | | } | 570 | | if constexpr (narrow_integral) { | 571 | | if (tmp < min_result || tmp > max_result) { | 572 | | if (params.is_strict) { | 573 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | | from, int_type_name<FromCppT>, precision, scale); | 575 | | } | 576 | | return false; | 577 | | } | 578 | | } | 579 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | 16 | } else { | 581 | 16 | tmp = scale_multiplier * from; | 582 | | if constexpr (narrow_integral) { | 583 | | if (tmp < min_result || tmp > max_result) { | 584 | | if (params.is_strict) { | 585 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | | from, int_type_name<FromCppT>, precision, scale); | 587 | | } | 588 | | return false; | 589 | | } | 590 | | } | 591 | 16 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | 16 | } | 593 | | | 594 | 16 | return true; | 595 | 16 | } |
Unexecuted instantiation: _ZN5doris13CastToDecimal9_from_intIhNS_12Decimal128V3ELb0ELb1EnQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS3_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRKT3_RKNS3_10NativeTypeESD_RNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal9_from_intIhNS_12Decimal128V3ELb1ELb0EnQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS3_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRKT3_RKNS3_10NativeTypeESD_RNS_14CastParametersE _ZN5doris13CastToDecimal9_from_intIhNS_12Decimal128V3ELb1ELb1EnQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS3_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRKT3_RKNS3_10NativeTypeESD_RNS_14CastParametersE Line | Count | Source | 560 | 8 | CastParameters& params) { | 561 | 8 | MaxNativeType tmp; | 562 | 8 | if constexpr (multiply_may_overflow) { | 563 | 8 | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | 0 | if (params.is_strict) { | 565 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | 0 | precision, scale); | 567 | 0 | } | 568 | 0 | return false; | 569 | 0 | } | 570 | 8 | if constexpr (narrow_integral) { | 571 | 8 | if (tmp < min_result || tmp > max_result) { | 572 | 4 | if (params.is_strict) { | 573 | 2 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | 2 | from, int_type_name<FromCppT>, precision, scale); | 575 | 2 | } | 576 | 4 | return false; | 577 | 4 | } | 578 | 8 | } | 579 | 4 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | | } else { | 581 | | tmp = scale_multiplier * from; | 582 | | if constexpr (narrow_integral) { | 583 | | if (tmp < min_result || tmp > max_result) { | 584 | | if (params.is_strict) { | 585 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | | from, int_type_name<FromCppT>, precision, scale); | 587 | | } | 588 | | return false; | 589 | | } | 590 | | } | 591 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | | } | 593 | | | 594 | 0 | return true; | 595 | 8 | } |
_ZN5doris13CastToDecimal9_from_intIaNS_12Decimal128V3ELb0ELb0EnQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS3_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRKT3_RKNS3_10NativeTypeESD_RNS_14CastParametersE Line | Count | Source | 560 | 144 | CastParameters& params) { | 561 | 144 | MaxNativeType tmp; | 562 | | if constexpr (multiply_may_overflow) { | 563 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | | if (params.is_strict) { | 565 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | | precision, scale); | 567 | | } | 568 | | return false; | 569 | | } | 570 | | if constexpr (narrow_integral) { | 571 | | if (tmp < min_result || tmp > max_result) { | 572 | | if (params.is_strict) { | 573 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | | from, int_type_name<FromCppT>, precision, scale); | 575 | | } | 576 | | return false; | 577 | | } | 578 | | } | 579 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | 144 | } else { | 581 | 144 | tmp = scale_multiplier * from; | 582 | | if constexpr (narrow_integral) { | 583 | | if (tmp < min_result || tmp > max_result) { | 584 | | if (params.is_strict) { | 585 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | | from, int_type_name<FromCppT>, precision, scale); | 587 | | } | 588 | | return false; | 589 | | } | 590 | | } | 591 | 144 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | 144 | } | 593 | | | 594 | 144 | return true; | 595 | 144 | } |
_ZN5doris13CastToDecimal9_from_intIaNS_12Decimal128V3ELb0ELb1EnQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS3_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRKT3_RKNS3_10NativeTypeESD_RNS_14CastParametersE Line | Count | Source | 560 | 88 | CastParameters& params) { | 561 | 88 | MaxNativeType tmp; | 562 | | if constexpr (multiply_may_overflow) { | 563 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | | if (params.is_strict) { | 565 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | | precision, scale); | 567 | | } | 568 | | return false; | 569 | | } | 570 | | if constexpr (narrow_integral) { | 571 | | if (tmp < min_result || tmp > max_result) { | 572 | | if (params.is_strict) { | 573 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | | from, int_type_name<FromCppT>, precision, scale); | 575 | | } | 576 | | return false; | 577 | | } | 578 | | } | 579 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | 88 | } else { | 581 | 88 | tmp = scale_multiplier * from; | 582 | 88 | if constexpr (narrow_integral) { | 583 | 88 | if (tmp < min_result || tmp > max_result) { | 584 | 32 | if (params.is_strict) { | 585 | 16 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | 16 | from, int_type_name<FromCppT>, precision, scale); | 587 | 16 | } | 588 | 32 | return false; | 589 | 32 | } | 590 | 88 | } | 591 | 56 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | 88 | } | 593 | | | 594 | 0 | return true; | 595 | 88 | } |
Unexecuted instantiation: _ZN5doris13CastToDecimal9_from_intIaNS_12Decimal128V3ELb1ELb0EnQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS3_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRKT3_RKNS3_10NativeTypeESD_RNS_14CastParametersE _ZN5doris13CastToDecimal9_from_intIaNS_12Decimal128V3ELb1ELb1EnQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS3_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRKT3_RKNS3_10NativeTypeESD_RNS_14CastParametersE Line | Count | Source | 560 | 44 | CastParameters& params) { | 561 | 44 | MaxNativeType tmp; | 562 | 44 | if constexpr (multiply_may_overflow) { | 563 | 44 | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | 8 | if (params.is_strict) { | 565 | 4 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | 4 | precision, scale); | 567 | 4 | } | 568 | 8 | return false; | 569 | 8 | } | 570 | 36 | if constexpr (narrow_integral) { | 571 | 36 | if (tmp < min_result || tmp > max_result) { | 572 | 8 | if (params.is_strict) { | 573 | 4 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | 4 | from, int_type_name<FromCppT>, precision, scale); | 575 | 4 | } | 576 | 8 | return false; | 577 | 8 | } | 578 | 36 | } | 579 | 28 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | | } else { | 581 | | tmp = scale_multiplier * from; | 582 | | if constexpr (narrow_integral) { | 583 | | if (tmp < min_result || tmp > max_result) { | 584 | | if (params.is_strict) { | 585 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | | from, int_type_name<FromCppT>, precision, scale); | 587 | | } | 588 | | return false; | 589 | | } | 590 | | } | 591 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | | } | 593 | | | 594 | 0 | return true; | 595 | 44 | } |
_ZN5doris13CastToDecimal9_from_intIsNS_12Decimal128V3ELb0ELb0EnQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS3_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRKT3_RKNS3_10NativeTypeESD_RNS_14CastParametersE Line | Count | Source | 560 | 144 | CastParameters& params) { | 561 | 144 | MaxNativeType tmp; | 562 | | if constexpr (multiply_may_overflow) { | 563 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | | if (params.is_strict) { | 565 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | | precision, scale); | 567 | | } | 568 | | return false; | 569 | | } | 570 | | if constexpr (narrow_integral) { | 571 | | if (tmp < min_result || tmp > max_result) { | 572 | | if (params.is_strict) { | 573 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | | from, int_type_name<FromCppT>, precision, scale); | 575 | | } | 576 | | return false; | 577 | | } | 578 | | } | 579 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | 144 | } else { | 581 | 144 | tmp = scale_multiplier * from; | 582 | | if constexpr (narrow_integral) { | 583 | | if (tmp < min_result || tmp > max_result) { | 584 | | if (params.is_strict) { | 585 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | | from, int_type_name<FromCppT>, precision, scale); | 587 | | } | 588 | | return false; | 589 | | } | 590 | | } | 591 | 144 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | 144 | } | 593 | | | 594 | 144 | return true; | 595 | 144 | } |
_ZN5doris13CastToDecimal9_from_intIsNS_12Decimal128V3ELb0ELb1EnQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS3_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRKT3_RKNS3_10NativeTypeESD_RNS_14CastParametersE Line | Count | Source | 560 | 88 | CastParameters& params) { | 561 | 88 | MaxNativeType tmp; | 562 | | if constexpr (multiply_may_overflow) { | 563 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | | if (params.is_strict) { | 565 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | | precision, scale); | 567 | | } | 568 | | return false; | 569 | | } | 570 | | if constexpr (narrow_integral) { | 571 | | if (tmp < min_result || tmp > max_result) { | 572 | | if (params.is_strict) { | 573 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | | from, int_type_name<FromCppT>, precision, scale); | 575 | | } | 576 | | return false; | 577 | | } | 578 | | } | 579 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | 88 | } else { | 581 | 88 | tmp = scale_multiplier * from; | 582 | 88 | if constexpr (narrow_integral) { | 583 | 88 | if (tmp < min_result || tmp > max_result) { | 584 | 32 | if (params.is_strict) { | 585 | 16 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | 16 | from, int_type_name<FromCppT>, precision, scale); | 587 | 16 | } | 588 | 32 | return false; | 589 | 32 | } | 590 | 88 | } | 591 | 56 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | 88 | } | 593 | | | 594 | 0 | return true; | 595 | 88 | } |
Unexecuted instantiation: _ZN5doris13CastToDecimal9_from_intIsNS_12Decimal128V3ELb1ELb0EnQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS3_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRKT3_RKNS3_10NativeTypeESD_RNS_14CastParametersE _ZN5doris13CastToDecimal9_from_intIsNS_12Decimal128V3ELb1ELb1EnQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS3_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRKT3_RKNS3_10NativeTypeESD_RNS_14CastParametersE Line | Count | Source | 560 | 44 | CastParameters& params) { | 561 | 44 | MaxNativeType tmp; | 562 | 44 | if constexpr (multiply_may_overflow) { | 563 | 44 | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | 8 | if (params.is_strict) { | 565 | 4 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | 4 | precision, scale); | 567 | 4 | } | 568 | 8 | return false; | 569 | 8 | } | 570 | 36 | if constexpr (narrow_integral) { | 571 | 36 | if (tmp < min_result || tmp > max_result) { | 572 | 8 | if (params.is_strict) { | 573 | 4 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | 4 | from, int_type_name<FromCppT>, precision, scale); | 575 | 4 | } | 576 | 8 | return false; | 577 | 8 | } | 578 | 36 | } | 579 | 28 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | | } else { | 581 | | tmp = scale_multiplier * from; | 582 | | if constexpr (narrow_integral) { | 583 | | if (tmp < min_result || tmp > max_result) { | 584 | | if (params.is_strict) { | 585 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | | from, int_type_name<FromCppT>, precision, scale); | 587 | | } | 588 | | return false; | 589 | | } | 590 | | } | 591 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | | } | 593 | | | 594 | 0 | return true; | 595 | 44 | } |
_ZN5doris13CastToDecimal9_from_intIiNS_12Decimal128V3ELb0ELb0EnQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS3_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRKT3_RKNS3_10NativeTypeESD_RNS_14CastParametersE Line | Count | Source | 560 | 144 | CastParameters& params) { | 561 | 144 | MaxNativeType tmp; | 562 | | if constexpr (multiply_may_overflow) { | 563 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | | if (params.is_strict) { | 565 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | | precision, scale); | 567 | | } | 568 | | return false; | 569 | | } | 570 | | if constexpr (narrow_integral) { | 571 | | if (tmp < min_result || tmp > max_result) { | 572 | | if (params.is_strict) { | 573 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | | from, int_type_name<FromCppT>, precision, scale); | 575 | | } | 576 | | return false; | 577 | | } | 578 | | } | 579 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | 144 | } else { | 581 | 144 | tmp = scale_multiplier * from; | 582 | | if constexpr (narrow_integral) { | 583 | | if (tmp < min_result || tmp > max_result) { | 584 | | if (params.is_strict) { | 585 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | | from, int_type_name<FromCppT>, precision, scale); | 587 | | } | 588 | | return false; | 589 | | } | 590 | | } | 591 | 144 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | 144 | } | 593 | | | 594 | 144 | return true; | 595 | 144 | } |
_ZN5doris13CastToDecimal9_from_intIiNS_12Decimal128V3ELb0ELb1EnQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS3_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRKT3_RKNS3_10NativeTypeESD_RNS_14CastParametersE Line | Count | Source | 560 | 88 | CastParameters& params) { | 561 | 88 | MaxNativeType tmp; | 562 | | if constexpr (multiply_may_overflow) { | 563 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | | if (params.is_strict) { | 565 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | | precision, scale); | 567 | | } | 568 | | return false; | 569 | | } | 570 | | if constexpr (narrow_integral) { | 571 | | if (tmp < min_result || tmp > max_result) { | 572 | | if (params.is_strict) { | 573 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | | from, int_type_name<FromCppT>, precision, scale); | 575 | | } | 576 | | return false; | 577 | | } | 578 | | } | 579 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | 88 | } else { | 581 | 88 | tmp = scale_multiplier * from; | 582 | 88 | if constexpr (narrow_integral) { | 583 | 88 | if (tmp < min_result || tmp > max_result) { | 584 | 32 | if (params.is_strict) { | 585 | 16 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | 16 | from, int_type_name<FromCppT>, precision, scale); | 587 | 16 | } | 588 | 32 | return false; | 589 | 32 | } | 590 | 88 | } | 591 | 56 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | 88 | } | 593 | | | 594 | 0 | return true; | 595 | 88 | } |
Unexecuted instantiation: _ZN5doris13CastToDecimal9_from_intIiNS_12Decimal128V3ELb1ELb0EnQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS3_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRKT3_RKNS3_10NativeTypeESD_RNS_14CastParametersE _ZN5doris13CastToDecimal9_from_intIiNS_12Decimal128V3ELb1ELb1EnQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS3_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRKT3_RKNS3_10NativeTypeESD_RNS_14CastParametersE Line | Count | Source | 560 | 44 | CastParameters& params) { | 561 | 44 | MaxNativeType tmp; | 562 | 44 | if constexpr (multiply_may_overflow) { | 563 | 44 | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | 8 | if (params.is_strict) { | 565 | 4 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | 4 | precision, scale); | 567 | 4 | } | 568 | 8 | return false; | 569 | 8 | } | 570 | 36 | if constexpr (narrow_integral) { | 571 | 36 | if (tmp < min_result || tmp > max_result) { | 572 | 8 | if (params.is_strict) { | 573 | 4 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | 4 | from, int_type_name<FromCppT>, precision, scale); | 575 | 4 | } | 576 | 8 | return false; | 577 | 8 | } | 578 | 36 | } | 579 | 28 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | | } else { | 581 | | tmp = scale_multiplier * from; | 582 | | if constexpr (narrow_integral) { | 583 | | if (tmp < min_result || tmp > max_result) { | 584 | | if (params.is_strict) { | 585 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | | from, int_type_name<FromCppT>, precision, scale); | 587 | | } | 588 | | return false; | 589 | | } | 590 | | } | 591 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | | } | 593 | | | 594 | 0 | return true; | 595 | 44 | } |
_ZN5doris13CastToDecimal9_from_intIlNS_12Decimal128V3ELb0ELb0EnQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS3_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRKT3_RKNS3_10NativeTypeESD_RNS_14CastParametersE Line | Count | Source | 560 | 108 | CastParameters& params) { | 561 | 108 | MaxNativeType tmp; | 562 | | if constexpr (multiply_may_overflow) { | 563 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | | if (params.is_strict) { | 565 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | | precision, scale); | 567 | | } | 568 | | return false; | 569 | | } | 570 | | if constexpr (narrow_integral) { | 571 | | if (tmp < min_result || tmp > max_result) { | 572 | | if (params.is_strict) { | 573 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | | from, int_type_name<FromCppT>, precision, scale); | 575 | | } | 576 | | return false; | 577 | | } | 578 | | } | 579 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | 108 | } else { | 581 | 108 | tmp = scale_multiplier * from; | 582 | | if constexpr (narrow_integral) { | 583 | | if (tmp < min_result || tmp > max_result) { | 584 | | if (params.is_strict) { | 585 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | | from, int_type_name<FromCppT>, precision, scale); | 587 | | } | 588 | | return false; | 589 | | } | 590 | | } | 591 | 108 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | 108 | } | 593 | | | 594 | 108 | return true; | 595 | 108 | } |
_ZN5doris13CastToDecimal9_from_intIlNS_12Decimal128V3ELb0ELb1EnQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS3_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRKT3_RKNS3_10NativeTypeESD_RNS_14CastParametersE Line | Count | Source | 560 | 156 | CastParameters& params) { | 561 | 156 | MaxNativeType tmp; | 562 | | if constexpr (multiply_may_overflow) { | 563 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | | if (params.is_strict) { | 565 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | | precision, scale); | 567 | | } | 568 | | return false; | 569 | | } | 570 | | if constexpr (narrow_integral) { | 571 | | if (tmp < min_result || tmp > max_result) { | 572 | | if (params.is_strict) { | 573 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | | from, int_type_name<FromCppT>, precision, scale); | 575 | | } | 576 | | return false; | 577 | | } | 578 | | } | 579 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | 156 | } else { | 581 | 156 | tmp = scale_multiplier * from; | 582 | 156 | if constexpr (narrow_integral) { | 583 | 156 | if (tmp < min_result || tmp > max_result) { | 584 | 48 | if (params.is_strict) { | 585 | 24 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | 24 | from, int_type_name<FromCppT>, precision, scale); | 587 | 24 | } | 588 | 48 | return false; | 589 | 48 | } | 590 | 156 | } | 591 | 108 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | 156 | } | 593 | | | 594 | 0 | return true; | 595 | 156 | } |
Unexecuted instantiation: _ZN5doris13CastToDecimal9_from_intIlNS_12Decimal128V3ELb1ELb0EnQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS3_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRKT3_RKNS3_10NativeTypeESD_RNS_14CastParametersE _ZN5doris13CastToDecimal9_from_intIlNS_12Decimal128V3ELb1ELb1EnQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS3_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRKT3_RKNS3_10NativeTypeESD_RNS_14CastParametersE Line | Count | Source | 560 | 44 | CastParameters& params) { | 561 | 44 | MaxNativeType tmp; | 562 | 44 | if constexpr (multiply_may_overflow) { | 563 | 44 | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | 8 | if (params.is_strict) { | 565 | 4 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | 4 | precision, scale); | 567 | 4 | } | 568 | 8 | return false; | 569 | 8 | } | 570 | 36 | if constexpr (narrow_integral) { | 571 | 36 | if (tmp < min_result || tmp > max_result) { | 572 | 8 | if (params.is_strict) { | 573 | 4 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | 4 | from, int_type_name<FromCppT>, precision, scale); | 575 | 4 | } | 576 | 8 | return false; | 577 | 8 | } | 578 | 36 | } | 579 | 28 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | | } else { | 581 | | tmp = scale_multiplier * from; | 582 | | if constexpr (narrow_integral) { | 583 | | if (tmp < min_result || tmp > max_result) { | 584 | | if (params.is_strict) { | 585 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | | from, int_type_name<FromCppT>, precision, scale); | 587 | | } | 588 | | return false; | 589 | | } | 590 | | } | 591 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | | } | 593 | | | 594 | 0 | return true; | 595 | 44 | } |
Unexecuted instantiation: _ZN5doris13CastToDecimal9_from_intInNS_12Decimal128V3ELb0ELb0EnQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS3_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRKT3_RKNS3_10NativeTypeESD_RNS_14CastParametersE _ZN5doris13CastToDecimal9_from_intInNS_12Decimal128V3ELb0ELb1EnQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS3_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRKT3_RKNS3_10NativeTypeESD_RNS_14CastParametersE Line | Count | Source | 560 | 180 | CastParameters& params) { | 561 | 180 | MaxNativeType tmp; | 562 | | if constexpr (multiply_may_overflow) { | 563 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | | if (params.is_strict) { | 565 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | | precision, scale); | 567 | | } | 568 | | return false; | 569 | | } | 570 | | if constexpr (narrow_integral) { | 571 | | if (tmp < min_result || tmp > max_result) { | 572 | | if (params.is_strict) { | 573 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | | from, int_type_name<FromCppT>, precision, scale); | 575 | | } | 576 | | return false; | 577 | | } | 578 | | } | 579 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | 180 | } else { | 581 | 180 | tmp = scale_multiplier * from; | 582 | 180 | if constexpr (narrow_integral) { | 583 | 180 | if (tmp < min_result || tmp > max_result) { | 584 | 48 | if (params.is_strict) { | 585 | 24 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | 24 | from, int_type_name<FromCppT>, precision, scale); | 587 | 24 | } | 588 | 48 | return false; | 589 | 48 | } | 590 | 180 | } | 591 | 132 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | 180 | } | 593 | | | 594 | 0 | return true; | 595 | 180 | } |
Unexecuted instantiation: _ZN5doris13CastToDecimal9_from_intInNS_12Decimal128V3ELb1ELb0EnQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS3_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRKT3_RKNS3_10NativeTypeESD_RNS_14CastParametersE _ZN5doris13CastToDecimal9_from_intInNS_12Decimal128V3ELb1ELb1EnQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS3_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRKT3_RKNS3_10NativeTypeESD_RNS_14CastParametersE Line | Count | Source | 560 | 224 | CastParameters& params) { | 561 | 224 | MaxNativeType tmp; | 562 | 224 | if constexpr (multiply_may_overflow) { | 563 | 224 | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | 32 | if (params.is_strict) { | 565 | 16 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | 16 | precision, scale); | 567 | 16 | } | 568 | 32 | return false; | 569 | 32 | } | 570 | 192 | if constexpr (narrow_integral) { | 571 | 192 | if (tmp < min_result || tmp > max_result) { | 572 | 32 | if (params.is_strict) { | 573 | 16 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | 16 | from, int_type_name<FromCppT>, precision, scale); | 575 | 16 | } | 576 | 32 | return false; | 577 | 32 | } | 578 | 192 | } | 579 | 160 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | | } else { | 581 | | tmp = scale_multiplier * from; | 582 | | if constexpr (narrow_integral) { | 583 | | if (tmp < min_result || tmp > max_result) { | 584 | | if (params.is_strict) { | 585 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | | from, int_type_name<FromCppT>, precision, scale); | 587 | | } | 588 | | return false; | 589 | | } | 590 | | } | 591 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | | } | 593 | | | 594 | 0 | return true; | 595 | 224 | } |
_ZN5doris13CastToDecimal9_from_intIhNS_7DecimalIN4wide7integerILm256EiEEEELb0ELb0ES5_Qaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS7_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS8_hEEEbRKS8_RS7_jjRKT3_RKNS7_10NativeTypeESH_RNS_14CastParametersE Line | Count | Source | 560 | 16 | CastParameters& params) { | 561 | 16 | MaxNativeType tmp; | 562 | | if constexpr (multiply_may_overflow) { | 563 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | | if (params.is_strict) { | 565 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | | precision, scale); | 567 | | } | 568 | | return false; | 569 | | } | 570 | | if constexpr (narrow_integral) { | 571 | | if (tmp < min_result || tmp > max_result) { | 572 | | if (params.is_strict) { | 573 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | | from, int_type_name<FromCppT>, precision, scale); | 575 | | } | 576 | | return false; | 577 | | } | 578 | | } | 579 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | 16 | } else { | 581 | 16 | tmp = scale_multiplier * from; | 582 | | if constexpr (narrow_integral) { | 583 | | if (tmp < min_result || tmp > max_result) { | 584 | | if (params.is_strict) { | 585 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | | from, int_type_name<FromCppT>, precision, scale); | 587 | | } | 588 | | return false; | 589 | | } | 590 | | } | 591 | 16 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | 16 | } | 593 | | | 594 | 16 | return true; | 595 | 16 | } |
Unexecuted instantiation: _ZN5doris13CastToDecimal9_from_intIhNS_7DecimalIN4wide7integerILm256EiEEEELb0ELb1ES5_Qaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS7_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS8_hEEEbRKS8_RS7_jjRKT3_RKNS7_10NativeTypeESH_RNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal9_from_intIhNS_7DecimalIN4wide7integerILm256EiEEEELb1ELb0ES5_Qaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS7_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS8_hEEEbRKS8_RS7_jjRKT3_RKNS7_10NativeTypeESH_RNS_14CastParametersE _ZN5doris13CastToDecimal9_from_intIhNS_7DecimalIN4wide7integerILm256EiEEEELb1ELb1ES5_Qaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS7_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS8_hEEEbRKS8_RS7_jjRKT3_RKNS7_10NativeTypeESH_RNS_14CastParametersE Line | Count | Source | 560 | 8 | CastParameters& params) { | 561 | 8 | MaxNativeType tmp; | 562 | 8 | if constexpr (multiply_may_overflow) { | 563 | 8 | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | 0 | if (params.is_strict) { | 565 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | 0 | precision, scale); | 567 | 0 | } | 568 | 0 | return false; | 569 | 0 | } | 570 | 8 | if constexpr (narrow_integral) { | 571 | 8 | if (tmp < min_result || tmp > max_result) { | 572 | 4 | if (params.is_strict) { | 573 | 2 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | 2 | from, int_type_name<FromCppT>, precision, scale); | 575 | 2 | } | 576 | 4 | return false; | 577 | 4 | } | 578 | 8 | } | 579 | 4 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | | } else { | 581 | | tmp = scale_multiplier * from; | 582 | | if constexpr (narrow_integral) { | 583 | | if (tmp < min_result || tmp > max_result) { | 584 | | if (params.is_strict) { | 585 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | | from, int_type_name<FromCppT>, precision, scale); | 587 | | } | 588 | | return false; | 589 | | } | 590 | | } | 591 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | | } | 593 | | | 594 | 0 | return true; | 595 | 8 | } |
_ZN5doris13CastToDecimal9_from_intIaNS_7DecimalIN4wide7integerILm256EiEEEELb0ELb0ES5_Qaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS7_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS8_hEEEbRKS8_RS7_jjRKT3_RKNS7_10NativeTypeESH_RNS_14CastParametersE Line | Count | Source | 560 | 144 | CastParameters& params) { | 561 | 144 | MaxNativeType tmp; | 562 | | if constexpr (multiply_may_overflow) { | 563 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | | if (params.is_strict) { | 565 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | | precision, scale); | 567 | | } | 568 | | return false; | 569 | | } | 570 | | if constexpr (narrow_integral) { | 571 | | if (tmp < min_result || tmp > max_result) { | 572 | | if (params.is_strict) { | 573 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | | from, int_type_name<FromCppT>, precision, scale); | 575 | | } | 576 | | return false; | 577 | | } | 578 | | } | 579 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | 144 | } else { | 581 | 144 | tmp = scale_multiplier * from; | 582 | | if constexpr (narrow_integral) { | 583 | | if (tmp < min_result || tmp > max_result) { | 584 | | if (params.is_strict) { | 585 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | | from, int_type_name<FromCppT>, precision, scale); | 587 | | } | 588 | | return false; | 589 | | } | 590 | | } | 591 | 144 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | 144 | } | 593 | | | 594 | 144 | return true; | 595 | 144 | } |
_ZN5doris13CastToDecimal9_from_intIaNS_7DecimalIN4wide7integerILm256EiEEEELb0ELb1ES5_Qaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS7_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS8_hEEEbRKS8_RS7_jjRKT3_RKNS7_10NativeTypeESH_RNS_14CastParametersE Line | Count | Source | 560 | 88 | CastParameters& params) { | 561 | 88 | MaxNativeType tmp; | 562 | | if constexpr (multiply_may_overflow) { | 563 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | | if (params.is_strict) { | 565 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | | precision, scale); | 567 | | } | 568 | | return false; | 569 | | } | 570 | | if constexpr (narrow_integral) { | 571 | | if (tmp < min_result || tmp > max_result) { | 572 | | if (params.is_strict) { | 573 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | | from, int_type_name<FromCppT>, precision, scale); | 575 | | } | 576 | | return false; | 577 | | } | 578 | | } | 579 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | 88 | } else { | 581 | 88 | tmp = scale_multiplier * from; | 582 | 88 | if constexpr (narrow_integral) { | 583 | 88 | if (tmp < min_result || tmp > max_result) { | 584 | 32 | if (params.is_strict) { | 585 | 16 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | 16 | from, int_type_name<FromCppT>, precision, scale); | 587 | 16 | } | 588 | 32 | return false; | 589 | 32 | } | 590 | 88 | } | 591 | 56 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | 88 | } | 593 | | | 594 | 0 | return true; | 595 | 88 | } |
Unexecuted instantiation: _ZN5doris13CastToDecimal9_from_intIaNS_7DecimalIN4wide7integerILm256EiEEEELb1ELb0ES5_Qaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS7_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS8_hEEEbRKS8_RS7_jjRKT3_RKNS7_10NativeTypeESH_RNS_14CastParametersE _ZN5doris13CastToDecimal9_from_intIaNS_7DecimalIN4wide7integerILm256EiEEEELb1ELb1ES5_Qaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS7_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS8_hEEEbRKS8_RS7_jjRKT3_RKNS7_10NativeTypeESH_RNS_14CastParametersE Line | Count | Source | 560 | 44 | CastParameters& params) { | 561 | 44 | MaxNativeType tmp; | 562 | 44 | if constexpr (multiply_may_overflow) { | 563 | 44 | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | 8 | if (params.is_strict) { | 565 | 4 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | 4 | precision, scale); | 567 | 4 | } | 568 | 8 | return false; | 569 | 8 | } | 570 | 36 | if constexpr (narrow_integral) { | 571 | 36 | if (tmp < min_result || tmp > max_result) { | 572 | 8 | if (params.is_strict) { | 573 | 4 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | 4 | from, int_type_name<FromCppT>, precision, scale); | 575 | 4 | } | 576 | 8 | return false; | 577 | 8 | } | 578 | 36 | } | 579 | 28 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | | } else { | 581 | | tmp = scale_multiplier * from; | 582 | | if constexpr (narrow_integral) { | 583 | | if (tmp < min_result || tmp > max_result) { | 584 | | if (params.is_strict) { | 585 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | | from, int_type_name<FromCppT>, precision, scale); | 587 | | } | 588 | | return false; | 589 | | } | 590 | | } | 591 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | | } | 593 | | | 594 | 0 | return true; | 595 | 44 | } |
_ZN5doris13CastToDecimal9_from_intIsNS_7DecimalIN4wide7integerILm256EiEEEELb0ELb0ES5_Qaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS7_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS8_hEEEbRKS8_RS7_jjRKT3_RKNS7_10NativeTypeESH_RNS_14CastParametersE Line | Count | Source | 560 | 144 | CastParameters& params) { | 561 | 144 | MaxNativeType tmp; | 562 | | if constexpr (multiply_may_overflow) { | 563 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | | if (params.is_strict) { | 565 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | | precision, scale); | 567 | | } | 568 | | return false; | 569 | | } | 570 | | if constexpr (narrow_integral) { | 571 | | if (tmp < min_result || tmp > max_result) { | 572 | | if (params.is_strict) { | 573 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | | from, int_type_name<FromCppT>, precision, scale); | 575 | | } | 576 | | return false; | 577 | | } | 578 | | } | 579 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | 144 | } else { | 581 | 144 | tmp = scale_multiplier * from; | 582 | | if constexpr (narrow_integral) { | 583 | | if (tmp < min_result || tmp > max_result) { | 584 | | if (params.is_strict) { | 585 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | | from, int_type_name<FromCppT>, precision, scale); | 587 | | } | 588 | | return false; | 589 | | } | 590 | | } | 591 | 144 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | 144 | } | 593 | | | 594 | 144 | return true; | 595 | 144 | } |
_ZN5doris13CastToDecimal9_from_intIsNS_7DecimalIN4wide7integerILm256EiEEEELb0ELb1ES5_Qaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS7_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS8_hEEEbRKS8_RS7_jjRKT3_RKNS7_10NativeTypeESH_RNS_14CastParametersE Line | Count | Source | 560 | 88 | CastParameters& params) { | 561 | 88 | MaxNativeType tmp; | 562 | | if constexpr (multiply_may_overflow) { | 563 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | | if (params.is_strict) { | 565 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | | precision, scale); | 567 | | } | 568 | | return false; | 569 | | } | 570 | | if constexpr (narrow_integral) { | 571 | | if (tmp < min_result || tmp > max_result) { | 572 | | if (params.is_strict) { | 573 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | | from, int_type_name<FromCppT>, precision, scale); | 575 | | } | 576 | | return false; | 577 | | } | 578 | | } | 579 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | 88 | } else { | 581 | 88 | tmp = scale_multiplier * from; | 582 | 88 | if constexpr (narrow_integral) { | 583 | 88 | if (tmp < min_result || tmp > max_result) { | 584 | 32 | if (params.is_strict) { | 585 | 16 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | 16 | from, int_type_name<FromCppT>, precision, scale); | 587 | 16 | } | 588 | 32 | return false; | 589 | 32 | } | 590 | 88 | } | 591 | 56 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | 88 | } | 593 | | | 594 | 0 | return true; | 595 | 88 | } |
Unexecuted instantiation: _ZN5doris13CastToDecimal9_from_intIsNS_7DecimalIN4wide7integerILm256EiEEEELb1ELb0ES5_Qaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS7_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS8_hEEEbRKS8_RS7_jjRKT3_RKNS7_10NativeTypeESH_RNS_14CastParametersE _ZN5doris13CastToDecimal9_from_intIsNS_7DecimalIN4wide7integerILm256EiEEEELb1ELb1ES5_Qaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS7_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS8_hEEEbRKS8_RS7_jjRKT3_RKNS7_10NativeTypeESH_RNS_14CastParametersE Line | Count | Source | 560 | 44 | CastParameters& params) { | 561 | 44 | MaxNativeType tmp; | 562 | 44 | if constexpr (multiply_may_overflow) { | 563 | 44 | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | 8 | if (params.is_strict) { | 565 | 4 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | 4 | precision, scale); | 567 | 4 | } | 568 | 8 | return false; | 569 | 8 | } | 570 | 36 | if constexpr (narrow_integral) { | 571 | 36 | if (tmp < min_result || tmp > max_result) { | 572 | 8 | if (params.is_strict) { | 573 | 4 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | 4 | from, int_type_name<FromCppT>, precision, scale); | 575 | 4 | } | 576 | 8 | return false; | 577 | 8 | } | 578 | 36 | } | 579 | 28 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | | } else { | 581 | | tmp = scale_multiplier * from; | 582 | | if constexpr (narrow_integral) { | 583 | | if (tmp < min_result || tmp > max_result) { | 584 | | if (params.is_strict) { | 585 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | | from, int_type_name<FromCppT>, precision, scale); | 587 | | } | 588 | | return false; | 589 | | } | 590 | | } | 591 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | | } | 593 | | | 594 | 0 | return true; | 595 | 44 | } |
_ZN5doris13CastToDecimal9_from_intIiNS_7DecimalIN4wide7integerILm256EiEEEELb0ELb0ES5_Qaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS7_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS8_hEEEbRKS8_RS7_jjRKT3_RKNS7_10NativeTypeESH_RNS_14CastParametersE Line | Count | Source | 560 | 144 | CastParameters& params) { | 561 | 144 | MaxNativeType tmp; | 562 | | if constexpr (multiply_may_overflow) { | 563 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | | if (params.is_strict) { | 565 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | | precision, scale); | 567 | | } | 568 | | return false; | 569 | | } | 570 | | if constexpr (narrow_integral) { | 571 | | if (tmp < min_result || tmp > max_result) { | 572 | | if (params.is_strict) { | 573 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | | from, int_type_name<FromCppT>, precision, scale); | 575 | | } | 576 | | return false; | 577 | | } | 578 | | } | 579 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | 144 | } else { | 581 | 144 | tmp = scale_multiplier * from; | 582 | | if constexpr (narrow_integral) { | 583 | | if (tmp < min_result || tmp > max_result) { | 584 | | if (params.is_strict) { | 585 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | | from, int_type_name<FromCppT>, precision, scale); | 587 | | } | 588 | | return false; | 589 | | } | 590 | | } | 591 | 144 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | 144 | } | 593 | | | 594 | 144 | return true; | 595 | 144 | } |
_ZN5doris13CastToDecimal9_from_intIiNS_7DecimalIN4wide7integerILm256EiEEEELb0ELb1ES5_Qaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS7_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS8_hEEEbRKS8_RS7_jjRKT3_RKNS7_10NativeTypeESH_RNS_14CastParametersE Line | Count | Source | 560 | 88 | CastParameters& params) { | 561 | 88 | MaxNativeType tmp; | 562 | | if constexpr (multiply_may_overflow) { | 563 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | | if (params.is_strict) { | 565 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | | precision, scale); | 567 | | } | 568 | | return false; | 569 | | } | 570 | | if constexpr (narrow_integral) { | 571 | | if (tmp < min_result || tmp > max_result) { | 572 | | if (params.is_strict) { | 573 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | | from, int_type_name<FromCppT>, precision, scale); | 575 | | } | 576 | | return false; | 577 | | } | 578 | | } | 579 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | 88 | } else { | 581 | 88 | tmp = scale_multiplier * from; | 582 | 88 | if constexpr (narrow_integral) { | 583 | 88 | if (tmp < min_result || tmp > max_result) { | 584 | 32 | if (params.is_strict) { | 585 | 16 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | 16 | from, int_type_name<FromCppT>, precision, scale); | 587 | 16 | } | 588 | 32 | return false; | 589 | 32 | } | 590 | 88 | } | 591 | 56 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | 88 | } | 593 | | | 594 | 0 | return true; | 595 | 88 | } |
Unexecuted instantiation: _ZN5doris13CastToDecimal9_from_intIiNS_7DecimalIN4wide7integerILm256EiEEEELb1ELb0ES5_Qaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS7_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS8_hEEEbRKS8_RS7_jjRKT3_RKNS7_10NativeTypeESH_RNS_14CastParametersE _ZN5doris13CastToDecimal9_from_intIiNS_7DecimalIN4wide7integerILm256EiEEEELb1ELb1ES5_Qaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS7_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS8_hEEEbRKS8_RS7_jjRKT3_RKNS7_10NativeTypeESH_RNS_14CastParametersE Line | Count | Source | 560 | 44 | CastParameters& params) { | 561 | 44 | MaxNativeType tmp; | 562 | 44 | if constexpr (multiply_may_overflow) { | 563 | 44 | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | 8 | if (params.is_strict) { | 565 | 4 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | 4 | precision, scale); | 567 | 4 | } | 568 | 8 | return false; | 569 | 8 | } | 570 | 36 | if constexpr (narrow_integral) { | 571 | 36 | if (tmp < min_result || tmp > max_result) { | 572 | 8 | if (params.is_strict) { | 573 | 4 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | 4 | from, int_type_name<FromCppT>, precision, scale); | 575 | 4 | } | 576 | 8 | return false; | 577 | 8 | } | 578 | 36 | } | 579 | 28 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | | } else { | 581 | | tmp = scale_multiplier * from; | 582 | | if constexpr (narrow_integral) { | 583 | | if (tmp < min_result || tmp > max_result) { | 584 | | if (params.is_strict) { | 585 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | | from, int_type_name<FromCppT>, precision, scale); | 587 | | } | 588 | | return false; | 589 | | } | 590 | | } | 591 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | | } | 593 | | | 594 | 0 | return true; | 595 | 44 | } |
_ZN5doris13CastToDecimal9_from_intIlNS_7DecimalIN4wide7integerILm256EiEEEELb0ELb0ES5_Qaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS7_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS8_hEEEbRKS8_RS7_jjRKT3_RKNS7_10NativeTypeESH_RNS_14CastParametersE Line | Count | Source | 560 | 144 | CastParameters& params) { | 561 | 144 | MaxNativeType tmp; | 562 | | if constexpr (multiply_may_overflow) { | 563 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | | if (params.is_strict) { | 565 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | | precision, scale); | 567 | | } | 568 | | return false; | 569 | | } | 570 | | if constexpr (narrow_integral) { | 571 | | if (tmp < min_result || tmp > max_result) { | 572 | | if (params.is_strict) { | 573 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | | from, int_type_name<FromCppT>, precision, scale); | 575 | | } | 576 | | return false; | 577 | | } | 578 | | } | 579 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | 144 | } else { | 581 | 144 | tmp = scale_multiplier * from; | 582 | | if constexpr (narrow_integral) { | 583 | | if (tmp < min_result || tmp > max_result) { | 584 | | if (params.is_strict) { | 585 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | | from, int_type_name<FromCppT>, precision, scale); | 587 | | } | 588 | | return false; | 589 | | } | 590 | | } | 591 | 144 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | 144 | } | 593 | | | 594 | 144 | return true; | 595 | 144 | } |
_ZN5doris13CastToDecimal9_from_intIlNS_7DecimalIN4wide7integerILm256EiEEEELb0ELb1ES5_Qaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS7_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS8_hEEEbRKS8_RS7_jjRKT3_RKNS7_10NativeTypeESH_RNS_14CastParametersE Line | Count | Source | 560 | 88 | CastParameters& params) { | 561 | 88 | MaxNativeType tmp; | 562 | | if constexpr (multiply_may_overflow) { | 563 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | | if (params.is_strict) { | 565 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | | precision, scale); | 567 | | } | 568 | | return false; | 569 | | } | 570 | | if constexpr (narrow_integral) { | 571 | | if (tmp < min_result || tmp > max_result) { | 572 | | if (params.is_strict) { | 573 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | | from, int_type_name<FromCppT>, precision, scale); | 575 | | } | 576 | | return false; | 577 | | } | 578 | | } | 579 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | 88 | } else { | 581 | 88 | tmp = scale_multiplier * from; | 582 | 88 | if constexpr (narrow_integral) { | 583 | 88 | if (tmp < min_result || tmp > max_result) { | 584 | 32 | if (params.is_strict) { | 585 | 16 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | 16 | from, int_type_name<FromCppT>, precision, scale); | 587 | 16 | } | 588 | 32 | return false; | 589 | 32 | } | 590 | 88 | } | 591 | 56 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | 88 | } | 593 | | | 594 | 0 | return true; | 595 | 88 | } |
Unexecuted instantiation: _ZN5doris13CastToDecimal9_from_intIlNS_7DecimalIN4wide7integerILm256EiEEEELb1ELb0ES5_Qaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS7_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS8_hEEEbRKS8_RS7_jjRKT3_RKNS7_10NativeTypeESH_RNS_14CastParametersE _ZN5doris13CastToDecimal9_from_intIlNS_7DecimalIN4wide7integerILm256EiEEEELb1ELb1ES5_Qaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS7_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS8_hEEEbRKS8_RS7_jjRKT3_RKNS7_10NativeTypeESH_RNS_14CastParametersE Line | Count | Source | 560 | 44 | CastParameters& params) { | 561 | 44 | MaxNativeType tmp; | 562 | 44 | if constexpr (multiply_may_overflow) { | 563 | 44 | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | 8 | if (params.is_strict) { | 565 | 4 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | 4 | precision, scale); | 567 | 4 | } | 568 | 8 | return false; | 569 | 8 | } | 570 | 36 | if constexpr (narrow_integral) { | 571 | 36 | if (tmp < min_result || tmp > max_result) { | 572 | 8 | if (params.is_strict) { | 573 | 4 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | 4 | from, int_type_name<FromCppT>, precision, scale); | 575 | 4 | } | 576 | 8 | return false; | 577 | 8 | } | 578 | 36 | } | 579 | 28 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | | } else { | 581 | | tmp = scale_multiplier * from; | 582 | | if constexpr (narrow_integral) { | 583 | | if (tmp < min_result || tmp > max_result) { | 584 | | if (params.is_strict) { | 585 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | | from, int_type_name<FromCppT>, precision, scale); | 587 | | } | 588 | | return false; | 589 | | } | 590 | | } | 591 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | | } | 593 | | | 594 | 0 | return true; | 595 | 44 | } |
_ZN5doris13CastToDecimal9_from_intInNS_7DecimalIN4wide7integerILm256EiEEEELb0ELb0ES5_Qaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS7_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS8_hEEEbRKS8_RS7_jjRKT3_RKNS7_10NativeTypeESH_RNS_14CastParametersE Line | Count | Source | 560 | 36 | CastParameters& params) { | 561 | 36 | MaxNativeType tmp; | 562 | | if constexpr (multiply_may_overflow) { | 563 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | | if (params.is_strict) { | 565 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | | precision, scale); | 567 | | } | 568 | | return false; | 569 | | } | 570 | | if constexpr (narrow_integral) { | 571 | | if (tmp < min_result || tmp > max_result) { | 572 | | if (params.is_strict) { | 573 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | | from, int_type_name<FromCppT>, precision, scale); | 575 | | } | 576 | | return false; | 577 | | } | 578 | | } | 579 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | 36 | } else { | 581 | 36 | tmp = scale_multiplier * from; | 582 | | if constexpr (narrow_integral) { | 583 | | if (tmp < min_result || tmp > max_result) { | 584 | | if (params.is_strict) { | 585 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | | from, int_type_name<FromCppT>, precision, scale); | 587 | | } | 588 | | return false; | 589 | | } | 590 | | } | 591 | 36 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | 36 | } | 593 | | | 594 | 36 | return true; | 595 | 36 | } |
_ZN5doris13CastToDecimal9_from_intInNS_7DecimalIN4wide7integerILm256EiEEEELb0ELb1ES5_Qaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS7_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS8_hEEEbRKS8_RS7_jjRKT3_RKNS7_10NativeTypeESH_RNS_14CastParametersE Line | Count | Source | 560 | 224 | CastParameters& params) { | 561 | 224 | MaxNativeType tmp; | 562 | | if constexpr (multiply_may_overflow) { | 563 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | | if (params.is_strict) { | 565 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | | precision, scale); | 567 | | } | 568 | | return false; | 569 | | } | 570 | | if constexpr (narrow_integral) { | 571 | | if (tmp < min_result || tmp > max_result) { | 572 | | if (params.is_strict) { | 573 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | | from, int_type_name<FromCppT>, precision, scale); | 575 | | } | 576 | | return false; | 577 | | } | 578 | | } | 579 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | 224 | } else { | 581 | 224 | tmp = scale_multiplier * from; | 582 | 224 | if constexpr (narrow_integral) { | 583 | 224 | if (tmp < min_result || tmp > max_result) { | 584 | 64 | if (params.is_strict) { | 585 | 32 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | 32 | from, int_type_name<FromCppT>, precision, scale); | 587 | 32 | } | 588 | 64 | return false; | 589 | 64 | } | 590 | 224 | } | 591 | 160 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | 224 | } | 593 | | | 594 | 0 | return true; | 595 | 224 | } |
Unexecuted instantiation: _ZN5doris13CastToDecimal9_from_intInNS_7DecimalIN4wide7integerILm256EiEEEELb1ELb0ES5_Qaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS7_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS8_hEEEbRKS8_RS7_jjRKT3_RKNS7_10NativeTypeESH_RNS_14CastParametersE _ZN5doris13CastToDecimal9_from_intInNS_7DecimalIN4wide7integerILm256EiEEEELb1ELb1ES5_Qaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS7_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS8_hEEEbRKS8_RS7_jjRKT3_RKNS7_10NativeTypeESH_RNS_14CastParametersE Line | Count | Source | 560 | 112 | CastParameters& params) { | 561 | 112 | MaxNativeType tmp; | 562 | 112 | if constexpr (multiply_may_overflow) { | 563 | 112 | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | 8 | if (params.is_strict) { | 565 | 4 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | 4 | precision, scale); | 567 | 4 | } | 568 | 8 | return false; | 569 | 8 | } | 570 | 104 | if constexpr (narrow_integral) { | 571 | 104 | if (tmp < min_result || tmp > max_result) { | 572 | 24 | if (params.is_strict) { | 573 | 12 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | 12 | from, int_type_name<FromCppT>, precision, scale); | 575 | 12 | } | 576 | 24 | return false; | 577 | 24 | } | 578 | 104 | } | 579 | 80 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | | } else { | 581 | | tmp = scale_multiplier * from; | 582 | | if constexpr (narrow_integral) { | 583 | | if (tmp < min_result || tmp > max_result) { | 584 | | if (params.is_strict) { | 585 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | | from, int_type_name<FromCppT>, precision, scale); | 587 | | } | 588 | | return false; | 589 | | } | 590 | | } | 591 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | | } | 593 | | | 594 | 0 | return true; | 595 | 112 | } |
|
596 | | |
597 | | template <typename FromCppT, typename ToCppT, bool multiply_may_overflow, bool narrow_integral, |
598 | | typename MaxNativeType = |
599 | | std::conditional_t<(sizeof(FromCppT) > sizeof(typename ToCppT::NativeType)), |
600 | | FromCppT, typename ToCppT::NativeType>> |
601 | | requires(IsDecimalV2<ToCppT> && (IsCppTypeInt<FromCppT> || std::is_same_v<FromCppT, UInt8>)) |
602 | | static inline bool _from_int(const FromCppT& from, ToCppT& to, UInt32 precision, UInt32 scale, |
603 | | const MaxNativeType& scale_multiplier, |
604 | | const typename ToCppT::NativeType& min_result, |
605 | | const typename ToCppT::NativeType& max_result, |
606 | 12 | CastParameters& params) { |
607 | 12 | MaxNativeType tmp; |
608 | 12 | if constexpr (multiply_may_overflow) { |
609 | 0 | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { |
610 | 0 | if (params.is_strict) { |
611 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, |
612 | 0 | precision, scale); |
613 | 0 | } |
614 | 0 | return false; |
615 | 0 | } |
616 | 0 | if constexpr (narrow_integral) { |
617 | 0 | if (tmp < min_result || tmp > max_result) { |
618 | 0 | if (params.is_strict) { |
619 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( |
620 | 0 | from, int_type_name<FromCppT>, precision, scale); |
621 | 0 | } |
622 | 0 | return false; |
623 | 0 | } |
624 | 0 | } |
625 | 0 | to = DecimalV2Value(static_cast<typename ToCppT::NativeType>(tmp)); |
626 | 12 | } else { |
627 | 12 | tmp = scale_multiplier * from; |
628 | 12 | if constexpr (narrow_integral) { |
629 | 8 | if (tmp < min_result || tmp > max_result) { |
630 | 4 | if (params.is_strict) { |
631 | 2 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( |
632 | 2 | from, int_type_name<FromCppT>, precision, scale); |
633 | 2 | } |
634 | 4 | return false; |
635 | 4 | } |
636 | 8 | } |
637 | 4 | to = DecimalV2Value(static_cast<typename ToCppT::NativeType>(tmp)); |
638 | 12 | } |
639 | | |
640 | 0 | return true; |
641 | 12 | } _ZN5doris13CastToDecimal9_from_intIhNS_14DecimalV2ValueELb0ELb0EnQaa11IsDecimalV2IT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRKT3_RKNS3_10NativeTypeESD_RNS_14CastParametersE Line | Count | Source | 606 | 4 | CastParameters& params) { | 607 | 4 | MaxNativeType tmp; | 608 | | if constexpr (multiply_may_overflow) { | 609 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 610 | | if (params.is_strict) { | 611 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 612 | | precision, scale); | 613 | | } | 614 | | return false; | 615 | | } | 616 | | if constexpr (narrow_integral) { | 617 | | if (tmp < min_result || tmp > max_result) { | 618 | | if (params.is_strict) { | 619 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 620 | | from, int_type_name<FromCppT>, precision, scale); | 621 | | } | 622 | | return false; | 623 | | } | 624 | | } | 625 | | to = DecimalV2Value(static_cast<typename ToCppT::NativeType>(tmp)); | 626 | 4 | } else { | 627 | 4 | tmp = scale_multiplier * from; | 628 | | if constexpr (narrow_integral) { | 629 | | if (tmp < min_result || tmp > max_result) { | 630 | | if (params.is_strict) { | 631 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 632 | | from, int_type_name<FromCppT>, precision, scale); | 633 | | } | 634 | | return false; | 635 | | } | 636 | | } | 637 | 4 | to = DecimalV2Value(static_cast<typename ToCppT::NativeType>(tmp)); | 638 | 4 | } | 639 | | | 640 | 4 | return true; | 641 | 4 | } |
_ZN5doris13CastToDecimal9_from_intIhNS_14DecimalV2ValueELb0ELb1EnQaa11IsDecimalV2IT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRKT3_RKNS3_10NativeTypeESD_RNS_14CastParametersE Line | Count | Source | 606 | 8 | CastParameters& params) { | 607 | 8 | MaxNativeType tmp; | 608 | | if constexpr (multiply_may_overflow) { | 609 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 610 | | if (params.is_strict) { | 611 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 612 | | precision, scale); | 613 | | } | 614 | | return false; | 615 | | } | 616 | | if constexpr (narrow_integral) { | 617 | | if (tmp < min_result || tmp > max_result) { | 618 | | if (params.is_strict) { | 619 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 620 | | from, int_type_name<FromCppT>, precision, scale); | 621 | | } | 622 | | return false; | 623 | | } | 624 | | } | 625 | | to = DecimalV2Value(static_cast<typename ToCppT::NativeType>(tmp)); | 626 | 8 | } else { | 627 | 8 | tmp = scale_multiplier * from; | 628 | 8 | if constexpr (narrow_integral) { | 629 | 8 | if (tmp < min_result || tmp > max_result) { | 630 | 4 | if (params.is_strict) { | 631 | 2 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 632 | 2 | from, int_type_name<FromCppT>, precision, scale); | 633 | 2 | } | 634 | 4 | return false; | 635 | 4 | } | 636 | 8 | } | 637 | 4 | to = DecimalV2Value(static_cast<typename ToCppT::NativeType>(tmp)); | 638 | 8 | } | 639 | | | 640 | 0 | return true; | 641 | 8 | } |
Unexecuted instantiation: _ZN5doris13CastToDecimal9_from_intIhNS_14DecimalV2ValueELb1ELb0EnQaa11IsDecimalV2IT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRKT3_RKNS3_10NativeTypeESD_RNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal9_from_intIhNS_14DecimalV2ValueELb1ELb1EnQaa11IsDecimalV2IT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRKT3_RKNS3_10NativeTypeESD_RNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal9_from_intIaNS_14DecimalV2ValueELb0ELb0EnQaa11IsDecimalV2IT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRKT3_RKNS3_10NativeTypeESD_RNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal9_from_intIaNS_14DecimalV2ValueELb0ELb1EnQaa11IsDecimalV2IT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRKT3_RKNS3_10NativeTypeESD_RNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal9_from_intIaNS_14DecimalV2ValueELb1ELb0EnQaa11IsDecimalV2IT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRKT3_RKNS3_10NativeTypeESD_RNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal9_from_intIaNS_14DecimalV2ValueELb1ELb1EnQaa11IsDecimalV2IT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRKT3_RKNS3_10NativeTypeESD_RNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal9_from_intIsNS_14DecimalV2ValueELb0ELb0EnQaa11IsDecimalV2IT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRKT3_RKNS3_10NativeTypeESD_RNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal9_from_intIsNS_14DecimalV2ValueELb0ELb1EnQaa11IsDecimalV2IT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRKT3_RKNS3_10NativeTypeESD_RNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal9_from_intIsNS_14DecimalV2ValueELb1ELb0EnQaa11IsDecimalV2IT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRKT3_RKNS3_10NativeTypeESD_RNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal9_from_intIsNS_14DecimalV2ValueELb1ELb1EnQaa11IsDecimalV2IT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRKT3_RKNS3_10NativeTypeESD_RNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal9_from_intIiNS_14DecimalV2ValueELb0ELb0EnQaa11IsDecimalV2IT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRKT3_RKNS3_10NativeTypeESD_RNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal9_from_intIiNS_14DecimalV2ValueELb0ELb1EnQaa11IsDecimalV2IT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRKT3_RKNS3_10NativeTypeESD_RNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal9_from_intIiNS_14DecimalV2ValueELb1ELb0EnQaa11IsDecimalV2IT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRKT3_RKNS3_10NativeTypeESD_RNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal9_from_intIiNS_14DecimalV2ValueELb1ELb1EnQaa11IsDecimalV2IT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRKT3_RKNS3_10NativeTypeESD_RNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal9_from_intIlNS_14DecimalV2ValueELb0ELb0EnQaa11IsDecimalV2IT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRKT3_RKNS3_10NativeTypeESD_RNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal9_from_intIlNS_14DecimalV2ValueELb0ELb1EnQaa11IsDecimalV2IT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRKT3_RKNS3_10NativeTypeESD_RNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal9_from_intIlNS_14DecimalV2ValueELb1ELb0EnQaa11IsDecimalV2IT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRKT3_RKNS3_10NativeTypeESD_RNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal9_from_intIlNS_14DecimalV2ValueELb1ELb1EnQaa11IsDecimalV2IT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRKT3_RKNS3_10NativeTypeESD_RNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal9_from_intInNS_14DecimalV2ValueELb0ELb0EnQaa11IsDecimalV2IT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRKT3_RKNS3_10NativeTypeESD_RNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal9_from_intInNS_14DecimalV2ValueELb0ELb1EnQaa11IsDecimalV2IT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRKT3_RKNS3_10NativeTypeESD_RNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal9_from_intInNS_14DecimalV2ValueELb1ELb0EnQaa11IsDecimalV2IT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRKT3_RKNS3_10NativeTypeESD_RNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal9_from_intInNS_14DecimalV2ValueELb1ELb1EnQaa11IsDecimalV2IT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRKT3_RKNS3_10NativeTypeESD_RNS_14CastParametersE |
642 | | }; |
643 | | |
644 | | // Casting from string to decimal types. |
645 | | template <CastModeType Mode, typename ToDataType> |
646 | | requires(IsDataTypeDecimal<ToDataType>) |
647 | | class CastToImpl<Mode, DataTypeString, ToDataType> : public CastToBase { |
648 | | Status execute_impl(FunctionContext* context, Block& block, const ColumnNumbers& arguments, |
649 | | uint32_t result, size_t input_rows_count, |
650 | 11.7k | const NullMap::value_type* null_map = nullptr) const override { |
651 | 11.7k | const auto* col_from = check_and_get_column<DataTypeString::ColumnType>( |
652 | 11.7k | block.get_by_position(arguments[0]).column.get()); |
653 | | |
654 | 11.7k | auto to_type = block.get_by_position(result).type; |
655 | 11.7k | auto serde = remove_nullable(to_type)->get_serde(); |
656 | | |
657 | | // by default framework, to_type is already unwrapped nullable |
658 | 11.7k | MutableColumnPtr column_to = to_type->create_column(); |
659 | 11.7k | ColumnNullable::MutablePtr nullable_col_to = ColumnNullable::create( |
660 | 11.7k | std::move(column_to), ColumnUInt8::create(input_rows_count, 0)); |
661 | | |
662 | 11.7k | if constexpr (Mode == CastModeType::NonStrictMode) { |
663 | | // may write nulls to nullable_col_to |
664 | 5.79k | RETURN_IF_ERROR(serde->from_string_batch(*col_from, *nullable_col_to, {})); |
665 | 5.93k | } else if constexpr (Mode == CastModeType::StrictMode) { |
666 | | // WON'T write nulls to nullable_col_to, just raise errors. null_map is only used to skip invalid rows |
667 | 5.93k | RETURN_IF_ERROR(serde->from_string_strict_mode_batch( |
668 | 5.93k | *col_from, nullable_col_to->get_nested_column(), {}, null_map)); |
669 | | } else { |
670 | | return Status::InternalError("Unsupported cast mode"); |
671 | | } |
672 | | |
673 | 10.9k | block.get_by_position(result).column = std::move(nullable_col_to); |
674 | 11.7k | return Status::OK(); |
675 | 11.7k | } Unexecuted instantiation: _ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeStringENS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Unexecuted instantiation: _ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeStringENS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh _ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeStringENS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 650 | 1.70k | const NullMap::value_type* null_map = nullptr) const override { | 651 | 1.70k | const auto* col_from = check_and_get_column<DataTypeString::ColumnType>( | 652 | 1.70k | block.get_by_position(arguments[0]).column.get()); | 653 | | | 654 | 1.70k | auto to_type = block.get_by_position(result).type; | 655 | 1.70k | auto serde = remove_nullable(to_type)->get_serde(); | 656 | | | 657 | | // by default framework, to_type is already unwrapped nullable | 658 | 1.70k | MutableColumnPtr column_to = to_type->create_column(); | 659 | 1.70k | ColumnNullable::MutablePtr nullable_col_to = ColumnNullable::create( | 660 | 1.70k | std::move(column_to), ColumnUInt8::create(input_rows_count, 0)); | 661 | | | 662 | | if constexpr (Mode == CastModeType::NonStrictMode) { | 663 | | // may write nulls to nullable_col_to | 664 | | RETURN_IF_ERROR(serde->from_string_batch(*col_from, *nullable_col_to, {})); | 665 | 1.70k | } else if constexpr (Mode == CastModeType::StrictMode) { | 666 | | // WON'T write nulls to nullable_col_to, just raise errors. null_map is only used to skip invalid rows | 667 | 1.70k | RETURN_IF_ERROR(serde->from_string_strict_mode_batch( | 668 | 1.70k | *col_from, nullable_col_to->get_nested_column(), {}, null_map)); | 669 | | } else { | 670 | | return Status::InternalError("Unsupported cast mode"); | 671 | | } | 672 | | | 673 | 1.33k | block.get_by_position(result).column = std::move(nullable_col_to); | 674 | 1.70k | return Status::OK(); | 675 | 1.70k | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeStringENS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 650 | 1.56k | const NullMap::value_type* null_map = nullptr) const override { | 651 | 1.56k | const auto* col_from = check_and_get_column<DataTypeString::ColumnType>( | 652 | 1.56k | block.get_by_position(arguments[0]).column.get()); | 653 | | | 654 | 1.56k | auto to_type = block.get_by_position(result).type; | 655 | 1.56k | auto serde = remove_nullable(to_type)->get_serde(); | 656 | | | 657 | | // by default framework, to_type is already unwrapped nullable | 658 | 1.56k | MutableColumnPtr column_to = to_type->create_column(); | 659 | 1.56k | ColumnNullable::MutablePtr nullable_col_to = ColumnNullable::create( | 660 | 1.56k | std::move(column_to), ColumnUInt8::create(input_rows_count, 0)); | 661 | | | 662 | 1.56k | if constexpr (Mode == CastModeType::NonStrictMode) { | 663 | | // may write nulls to nullable_col_to | 664 | 1.56k | RETURN_IF_ERROR(serde->from_string_batch(*col_from, *nullable_col_to, {})); | 665 | | } else if constexpr (Mode == CastModeType::StrictMode) { | 666 | | // WON'T write nulls to nullable_col_to, just raise errors. null_map is only used to skip invalid rows | 667 | | RETURN_IF_ERROR(serde->from_string_strict_mode_batch( | 668 | | *col_from, nullable_col_to->get_nested_column(), {}, null_map)); | 669 | | } else { | 670 | | return Status::InternalError("Unsupported cast mode"); | 671 | | } | 672 | | | 673 | 1.56k | block.get_by_position(result).column = std::move(nullable_col_to); | 674 | 1.56k | return Status::OK(); | 675 | 1.56k | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeStringENS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 650 | 1.41k | const NullMap::value_type* null_map = nullptr) const override { | 651 | 1.41k | const auto* col_from = check_and_get_column<DataTypeString::ColumnType>( | 652 | 1.41k | block.get_by_position(arguments[0]).column.get()); | 653 | | | 654 | 1.41k | auto to_type = block.get_by_position(result).type; | 655 | 1.41k | auto serde = remove_nullable(to_type)->get_serde(); | 656 | | | 657 | | // by default framework, to_type is already unwrapped nullable | 658 | 1.41k | MutableColumnPtr column_to = to_type->create_column(); | 659 | 1.41k | ColumnNullable::MutablePtr nullable_col_to = ColumnNullable::create( | 660 | 1.41k | std::move(column_to), ColumnUInt8::create(input_rows_count, 0)); | 661 | | | 662 | | if constexpr (Mode == CastModeType::NonStrictMode) { | 663 | | // may write nulls to nullable_col_to | 664 | | RETURN_IF_ERROR(serde->from_string_batch(*col_from, *nullable_col_to, {})); | 665 | 1.41k | } else if constexpr (Mode == CastModeType::StrictMode) { | 666 | | // WON'T write nulls to nullable_col_to, just raise errors. null_map is only used to skip invalid rows | 667 | 1.41k | RETURN_IF_ERROR(serde->from_string_strict_mode_batch( | 668 | 1.41k | *col_from, nullable_col_to->get_nested_column(), {}, null_map)); | 669 | | } else { | 670 | | return Status::InternalError("Unsupported cast mode"); | 671 | | } | 672 | | | 673 | 1.26k | block.get_by_position(result).column = std::move(nullable_col_to); | 674 | 1.41k | return Status::OK(); | 675 | 1.41k | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeStringENS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 650 | 1.41k | const NullMap::value_type* null_map = nullptr) const override { | 651 | 1.41k | const auto* col_from = check_and_get_column<DataTypeString::ColumnType>( | 652 | 1.41k | block.get_by_position(arguments[0]).column.get()); | 653 | | | 654 | 1.41k | auto to_type = block.get_by_position(result).type; | 655 | 1.41k | auto serde = remove_nullable(to_type)->get_serde(); | 656 | | | 657 | | // by default framework, to_type is already unwrapped nullable | 658 | 1.41k | MutableColumnPtr column_to = to_type->create_column(); | 659 | 1.41k | ColumnNullable::MutablePtr nullable_col_to = ColumnNullable::create( | 660 | 1.41k | std::move(column_to), ColumnUInt8::create(input_rows_count, 0)); | 661 | | | 662 | 1.41k | if constexpr (Mode == CastModeType::NonStrictMode) { | 663 | | // may write nulls to nullable_col_to | 664 | 1.41k | RETURN_IF_ERROR(serde->from_string_batch(*col_from, *nullable_col_to, {})); | 665 | | } else if constexpr (Mode == CastModeType::StrictMode) { | 666 | | // WON'T write nulls to nullable_col_to, just raise errors. null_map is only used to skip invalid rows | 667 | | RETURN_IF_ERROR(serde->from_string_strict_mode_batch( | 668 | | *col_from, nullable_col_to->get_nested_column(), {}, null_map)); | 669 | | } else { | 670 | | return Status::InternalError("Unsupported cast mode"); | 671 | | } | 672 | | | 673 | 1.41k | block.get_by_position(result).column = std::move(nullable_col_to); | 674 | 1.41k | return Status::OK(); | 675 | 1.41k | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeStringENS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 650 | 1.41k | const NullMap::value_type* null_map = nullptr) const override { | 651 | 1.41k | const auto* col_from = check_and_get_column<DataTypeString::ColumnType>( | 652 | 1.41k | block.get_by_position(arguments[0]).column.get()); | 653 | | | 654 | 1.41k | auto to_type = block.get_by_position(result).type; | 655 | 1.41k | auto serde = remove_nullable(to_type)->get_serde(); | 656 | | | 657 | | // by default framework, to_type is already unwrapped nullable | 658 | 1.41k | MutableColumnPtr column_to = to_type->create_column(); | 659 | 1.41k | ColumnNullable::MutablePtr nullable_col_to = ColumnNullable::create( | 660 | 1.41k | std::move(column_to), ColumnUInt8::create(input_rows_count, 0)); | 661 | | | 662 | | if constexpr (Mode == CastModeType::NonStrictMode) { | 663 | | // may write nulls to nullable_col_to | 664 | | RETURN_IF_ERROR(serde->from_string_batch(*col_from, *nullable_col_to, {})); | 665 | 1.41k | } else if constexpr (Mode == CastModeType::StrictMode) { | 666 | | // WON'T write nulls to nullable_col_to, just raise errors. null_map is only used to skip invalid rows | 667 | 1.41k | RETURN_IF_ERROR(serde->from_string_strict_mode_batch( | 668 | 1.41k | *col_from, nullable_col_to->get_nested_column(), {}, null_map)); | 669 | | } else { | 670 | | return Status::InternalError("Unsupported cast mode"); | 671 | | } | 672 | | | 673 | 1.26k | block.get_by_position(result).column = std::move(nullable_col_to); | 674 | 1.41k | return Status::OK(); | 675 | 1.41k | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeStringENS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 650 | 1.41k | const NullMap::value_type* null_map = nullptr) const override { | 651 | 1.41k | const auto* col_from = check_and_get_column<DataTypeString::ColumnType>( | 652 | 1.41k | block.get_by_position(arguments[0]).column.get()); | 653 | | | 654 | 1.41k | auto to_type = block.get_by_position(result).type; | 655 | 1.41k | auto serde = remove_nullable(to_type)->get_serde(); | 656 | | | 657 | | // by default framework, to_type is already unwrapped nullable | 658 | 1.41k | MutableColumnPtr column_to = to_type->create_column(); | 659 | 1.41k | ColumnNullable::MutablePtr nullable_col_to = ColumnNullable::create( | 660 | 1.41k | std::move(column_to), ColumnUInt8::create(input_rows_count, 0)); | 661 | | | 662 | 1.41k | if constexpr (Mode == CastModeType::NonStrictMode) { | 663 | | // may write nulls to nullable_col_to | 664 | 1.41k | RETURN_IF_ERROR(serde->from_string_batch(*col_from, *nullable_col_to, {})); | 665 | | } else if constexpr (Mode == CastModeType::StrictMode) { | 666 | | // WON'T write nulls to nullable_col_to, just raise errors. null_map is only used to skip invalid rows | 667 | | RETURN_IF_ERROR(serde->from_string_strict_mode_batch( | 668 | | *col_from, nullable_col_to->get_nested_column(), {}, null_map)); | 669 | | } else { | 670 | | return Status::InternalError("Unsupported cast mode"); | 671 | | } | 672 | | | 673 | 1.41k | block.get_by_position(result).column = std::move(nullable_col_to); | 674 | 1.41k | return Status::OK(); | 675 | 1.41k | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeStringENS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 650 | 1.39k | const NullMap::value_type* null_map = nullptr) const override { | 651 | 1.39k | const auto* col_from = check_and_get_column<DataTypeString::ColumnType>( | 652 | 1.39k | block.get_by_position(arguments[0]).column.get()); | 653 | | | 654 | 1.39k | auto to_type = block.get_by_position(result).type; | 655 | 1.39k | auto serde = remove_nullable(to_type)->get_serde(); | 656 | | | 657 | | // by default framework, to_type is already unwrapped nullable | 658 | 1.39k | MutableColumnPtr column_to = to_type->create_column(); | 659 | 1.39k | ColumnNullable::MutablePtr nullable_col_to = ColumnNullable::create( | 660 | 1.39k | std::move(column_to), ColumnUInt8::create(input_rows_count, 0)); | 661 | | | 662 | | if constexpr (Mode == CastModeType::NonStrictMode) { | 663 | | // may write nulls to nullable_col_to | 664 | | RETURN_IF_ERROR(serde->from_string_batch(*col_from, *nullable_col_to, {})); | 665 | 1.39k | } else if constexpr (Mode == CastModeType::StrictMode) { | 666 | | // WON'T write nulls to nullable_col_to, just raise errors. null_map is only used to skip invalid rows | 667 | 1.39k | RETURN_IF_ERROR(serde->from_string_strict_mode_batch( | 668 | 1.39k | *col_from, nullable_col_to->get_nested_column(), {}, null_map)); | 669 | | } else { | 670 | | return Status::InternalError("Unsupported cast mode"); | 671 | | } | 672 | | | 673 | 1.26k | block.get_by_position(result).column = std::move(nullable_col_to); | 674 | 1.39k | return Status::OK(); | 675 | 1.39k | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeStringENS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 650 | 1.39k | const NullMap::value_type* null_map = nullptr) const override { | 651 | 1.39k | const auto* col_from = check_and_get_column<DataTypeString::ColumnType>( | 652 | 1.39k | block.get_by_position(arguments[0]).column.get()); | 653 | | | 654 | 1.39k | auto to_type = block.get_by_position(result).type; | 655 | 1.39k | auto serde = remove_nullable(to_type)->get_serde(); | 656 | | | 657 | | // by default framework, to_type is already unwrapped nullable | 658 | 1.39k | MutableColumnPtr column_to = to_type->create_column(); | 659 | 1.39k | ColumnNullable::MutablePtr nullable_col_to = ColumnNullable::create( | 660 | 1.39k | std::move(column_to), ColumnUInt8::create(input_rows_count, 0)); | 661 | | | 662 | 1.39k | if constexpr (Mode == CastModeType::NonStrictMode) { | 663 | | // may write nulls to nullable_col_to | 664 | 1.39k | RETURN_IF_ERROR(serde->from_string_batch(*col_from, *nullable_col_to, {})); | 665 | | } else if constexpr (Mode == CastModeType::StrictMode) { | 666 | | // WON'T write nulls to nullable_col_to, just raise errors. null_map is only used to skip invalid rows | 667 | | RETURN_IF_ERROR(serde->from_string_strict_mode_batch( | 668 | | *col_from, nullable_col_to->get_nested_column(), {}, null_map)); | 669 | | } else { | 670 | | return Status::InternalError("Unsupported cast mode"); | 671 | | } | 672 | | | 673 | 1.39k | block.get_by_position(result).column = std::move(nullable_col_to); | 674 | 1.39k | return Status::OK(); | 675 | 1.39k | } |
|
676 | | }; |
677 | | |
678 | | // cast bool and int to decimal. when may overflow, result column is nullable. |
679 | | template <CastModeType CastMode, typename FromDataType, typename ToDataType> |
680 | | requires(IsDataTypeDecimal<ToDataType> && |
681 | | (IsDataTypeInt<FromDataType> || IsDataTypeBool<FromDataType>)) |
682 | | class CastToImpl<CastMode, FromDataType, ToDataType> : public CastToBase { |
683 | | public: |
684 | | Status execute_impl(FunctionContext* context, Block& block, const ColumnNumbers& arguments, |
685 | | uint32_t result, size_t input_rows_count, |
686 | 1.56k | const NullMap::value_type* null_map = nullptr) const override { |
687 | 1.56k | using FromFieldType = typename FromDataType::FieldType; |
688 | 1.56k | using ToFieldType = typename ToDataType::FieldType; |
689 | 1.56k | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); |
690 | 1.56k | const auto* col_from = |
691 | 1.56k | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); |
692 | 1.56k | if (!col_from) { |
693 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", |
694 | 0 | named_from.column->get_name()); |
695 | 0 | } |
696 | | |
697 | 1.56k | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); |
698 | 1.56k | constexpr UInt32 from_scale = 0; |
699 | | |
700 | 1.56k | const ColumnWithTypeAndName& named_to = block.get_by_position(result); |
701 | 1.56k | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); |
702 | 1.56k | UInt32 to_precision = to_decimal_type.get_precision(); |
703 | 1.56k | ToDataType::check_type_precision(to_precision); |
704 | 1.56k | UInt32 to_scale = to_decimal_type.get_scale(); |
705 | 1.56k | ToDataType::check_type_scale(to_scale); |
706 | | |
707 | 1.56k | auto from_max_int_digit_count = from_precision - from_scale; |
708 | 1.56k | auto to_max_int_digit_count = to_precision - to_scale; |
709 | | // may overflow. nullable result column. |
710 | 1.56k | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); |
711 | | // only in non-strict mode and may overflow, we set nullable |
712 | 1.56k | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; |
713 | | |
714 | 1.56k | constexpr UInt32 to_max_digits = |
715 | 1.56k | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); |
716 | 1.56k | bool multiply_may_overflow = false; |
717 | 1.56k | if (to_scale > from_scale) { |
718 | 966 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; |
719 | 966 | } |
720 | 1.56k | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > |
721 | 1.56k | sizeof(typename ToFieldType::NativeType)), |
722 | 1.56k | FromFieldType, typename ToFieldType::NativeType>; |
723 | 1.56k | MaxNativeType scale_multiplier = |
724 | 1.56k | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); |
725 | 1.56k | typename ToFieldType::NativeType max_result = |
726 | 1.56k | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); |
727 | 1.56k | typename ToFieldType::NativeType min_result = -max_result; |
728 | | |
729 | 1.56k | ColumnUInt8::MutablePtr col_null_map_to; |
730 | 1.56k | NullMap::value_type* null_map_data = nullptr; |
731 | 1.56k | if (narrow_integral) { |
732 | 1.34k | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); |
733 | 1.34k | null_map_data = col_null_map_to->get_data().data(); |
734 | 1.34k | } |
735 | | |
736 | 1.56k | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); |
737 | 1.56k | const auto& vec_from = col_from->get_data(); |
738 | 1.56k | const auto* vec_from_data = vec_from.data(); |
739 | 1.56k | auto& vec_to = col_to->get_data(); |
740 | 1.56k | auto* vec_to_data = vec_to.data(); |
741 | | |
742 | 1.56k | CastParameters params; |
743 | 1.56k | params.is_strict = (CastMode == CastModeType::StrictMode); |
744 | 1.56k | size_t size = vec_from.size(); |
745 | | |
746 | 1.56k | RETURN_IF_ERROR(std::visit( |
747 | 1.56k | [&](auto multiply_may_overflow, auto narrow_integral) { |
748 | 1.56k | for (size_t i = 0; i < size; i++) { |
749 | 1.56k | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, |
750 | 1.56k | typename ToDataType::FieldType, |
751 | 1.56k | multiply_may_overflow, narrow_integral>( |
752 | 1.56k | vec_from_data[i], vec_to_data[i], to_precision, to_scale, |
753 | 1.56k | scale_multiplier, min_result, max_result, params)) { |
754 | 1.56k | if (set_nullable) { |
755 | 1.56k | null_map_data[i] = 1; |
756 | 1.56k | } else { |
757 | 1.56k | return params.status; |
758 | 1.56k | } |
759 | 1.56k | } |
760 | 1.56k | } |
761 | 1.56k | return Status::OK(); |
762 | 1.56k | }, |
763 | 1.56k | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); |
764 | | |
765 | 802 | if (narrow_integral) { |
766 | 584 | block.get_by_position(result).column = |
767 | 584 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); |
768 | 584 | } else { |
769 | 218 | block.get_by_position(result).column = std::move(col_to); |
770 | 218 | } |
771 | 802 | return Status::OK(); |
772 | 1.56k | } _ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE2EEENS_15DataTypeDecimalILS3_20EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 686 | 4 | const NullMap::value_type* null_map = nullptr) const override { | 687 | 4 | using FromFieldType = typename FromDataType::FieldType; | 688 | 4 | using ToFieldType = typename ToDataType::FieldType; | 689 | 4 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 690 | 4 | const auto* col_from = | 691 | 4 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 692 | 4 | if (!col_from) { | 693 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 694 | 0 | named_from.column->get_name()); | 695 | 0 | } | 696 | | | 697 | 4 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 698 | 4 | constexpr UInt32 from_scale = 0; | 699 | | | 700 | 4 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 701 | 4 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 702 | 4 | UInt32 to_precision = to_decimal_type.get_precision(); | 703 | 4 | ToDataType::check_type_precision(to_precision); | 704 | 4 | UInt32 to_scale = to_decimal_type.get_scale(); | 705 | 4 | ToDataType::check_type_scale(to_scale); | 706 | | | 707 | 4 | auto from_max_int_digit_count = from_precision - from_scale; | 708 | 4 | auto to_max_int_digit_count = to_precision - to_scale; | 709 | | // may overflow. nullable result column. | 710 | 4 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 711 | | // only in non-strict mode and may overflow, we set nullable | 712 | 4 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 713 | | | 714 | 4 | constexpr UInt32 to_max_digits = | 715 | 4 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 716 | 4 | bool multiply_may_overflow = false; | 717 | 4 | if (to_scale > from_scale) { | 718 | 4 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 719 | 4 | } | 720 | 4 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 721 | 4 | sizeof(typename ToFieldType::NativeType)), | 722 | 4 | FromFieldType, typename ToFieldType::NativeType>; | 723 | 4 | MaxNativeType scale_multiplier = | 724 | 4 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 725 | 4 | typename ToFieldType::NativeType max_result = | 726 | 4 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 727 | 4 | typename ToFieldType::NativeType min_result = -max_result; | 728 | | | 729 | 4 | ColumnUInt8::MutablePtr col_null_map_to; | 730 | 4 | NullMap::value_type* null_map_data = nullptr; | 731 | 4 | if (narrow_integral) { | 732 | 4 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 733 | 4 | null_map_data = col_null_map_to->get_data().data(); | 734 | 4 | } | 735 | | | 736 | 4 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 737 | 4 | const auto& vec_from = col_from->get_data(); | 738 | 4 | const auto* vec_from_data = vec_from.data(); | 739 | 4 | auto& vec_to = col_to->get_data(); | 740 | 4 | auto* vec_to_data = vec_to.data(); | 741 | | | 742 | 4 | CastParameters params; | 743 | 4 | params.is_strict = (CastMode == CastModeType::StrictMode); | 744 | 4 | size_t size = vec_from.size(); | 745 | | | 746 | 4 | RETURN_IF_ERROR(std::visit( | 747 | 4 | [&](auto multiply_may_overflow, auto narrow_integral) { | 748 | 4 | for (size_t i = 0; i < size; i++) { | 749 | 4 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 750 | 4 | typename ToDataType::FieldType, | 751 | 4 | multiply_may_overflow, narrow_integral>( | 752 | 4 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 753 | 4 | scale_multiplier, min_result, max_result, params)) { | 754 | 4 | if (set_nullable) { | 755 | 4 | null_map_data[i] = 1; | 756 | 4 | } else { | 757 | 4 | return params.status; | 758 | 4 | } | 759 | 4 | } | 760 | 4 | } | 761 | 4 | return Status::OK(); | 762 | 4 | }, | 763 | 4 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 764 | | | 765 | 2 | if (narrow_integral) { | 766 | 2 | block.get_by_position(result).column = | 767 | 2 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 768 | 2 | } else { | 769 | 0 | block.get_by_position(result).column = std::move(col_to); | 770 | 0 | } | 771 | 2 | return Status::OK(); | 772 | 4 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE2EEENS_15DataTypeDecimalILS3_20EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 686 | 4 | const NullMap::value_type* null_map = nullptr) const override { | 687 | 4 | using FromFieldType = typename FromDataType::FieldType; | 688 | 4 | using ToFieldType = typename ToDataType::FieldType; | 689 | 4 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 690 | 4 | const auto* col_from = | 691 | 4 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 692 | 4 | if (!col_from) { | 693 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 694 | 0 | named_from.column->get_name()); | 695 | 0 | } | 696 | | | 697 | 4 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 698 | 4 | constexpr UInt32 from_scale = 0; | 699 | | | 700 | 4 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 701 | 4 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 702 | 4 | UInt32 to_precision = to_decimal_type.get_precision(); | 703 | 4 | ToDataType::check_type_precision(to_precision); | 704 | 4 | UInt32 to_scale = to_decimal_type.get_scale(); | 705 | 4 | ToDataType::check_type_scale(to_scale); | 706 | | | 707 | 4 | auto from_max_int_digit_count = from_precision - from_scale; | 708 | 4 | auto to_max_int_digit_count = to_precision - to_scale; | 709 | | // may overflow. nullable result column. | 710 | 4 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 711 | | // only in non-strict mode and may overflow, we set nullable | 712 | 4 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 713 | | | 714 | 4 | constexpr UInt32 to_max_digits = | 715 | 4 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 716 | 4 | bool multiply_may_overflow = false; | 717 | 4 | if (to_scale > from_scale) { | 718 | 4 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 719 | 4 | } | 720 | 4 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 721 | 4 | sizeof(typename ToFieldType::NativeType)), | 722 | 4 | FromFieldType, typename ToFieldType::NativeType>; | 723 | 4 | MaxNativeType scale_multiplier = | 724 | 4 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 725 | 4 | typename ToFieldType::NativeType max_result = | 726 | 4 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 727 | 4 | typename ToFieldType::NativeType min_result = -max_result; | 728 | | | 729 | 4 | ColumnUInt8::MutablePtr col_null_map_to; | 730 | 4 | NullMap::value_type* null_map_data = nullptr; | 731 | 4 | if (narrow_integral) { | 732 | 2 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 733 | 2 | null_map_data = col_null_map_to->get_data().data(); | 734 | 2 | } | 735 | | | 736 | 4 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 737 | 4 | const auto& vec_from = col_from->get_data(); | 738 | 4 | const auto* vec_from_data = vec_from.data(); | 739 | 4 | auto& vec_to = col_to->get_data(); | 740 | 4 | auto* vec_to_data = vec_to.data(); | 741 | | | 742 | 4 | CastParameters params; | 743 | 4 | params.is_strict = (CastMode == CastModeType::StrictMode); | 744 | 4 | size_t size = vec_from.size(); | 745 | | | 746 | 4 | RETURN_IF_ERROR(std::visit( | 747 | 4 | [&](auto multiply_may_overflow, auto narrow_integral) { | 748 | 4 | for (size_t i = 0; i < size; i++) { | 749 | 4 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 750 | 4 | typename ToDataType::FieldType, | 751 | 4 | multiply_may_overflow, narrow_integral>( | 752 | 4 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 753 | 4 | scale_multiplier, min_result, max_result, params)) { | 754 | 4 | if (set_nullable) { | 755 | 4 | null_map_data[i] = 1; | 756 | 4 | } else { | 757 | 4 | return params.status; | 758 | 4 | } | 759 | 4 | } | 760 | 4 | } | 761 | 4 | return Status::OK(); | 762 | 4 | }, | 763 | 4 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 764 | | | 765 | 4 | if (narrow_integral) { | 766 | 2 | block.get_by_position(result).column = | 767 | 2 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 768 | 2 | } else { | 769 | 2 | block.get_by_position(result).column = std::move(col_to); | 770 | 2 | } | 771 | 4 | return Status::OK(); | 772 | 4 | } |
Unexecuted instantiation: _ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE3EEENS_15DataTypeDecimalILS3_20EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Unexecuted instantiation: _ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE3EEENS_15DataTypeDecimalILS3_20EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Unexecuted instantiation: _ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE4EEENS_15DataTypeDecimalILS3_20EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Unexecuted instantiation: _ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE4EEENS_15DataTypeDecimalILS3_20EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Unexecuted instantiation: _ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE5EEENS_15DataTypeDecimalILS3_20EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Unexecuted instantiation: _ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE5EEENS_15DataTypeDecimalILS3_20EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Unexecuted instantiation: _ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE6EEENS_15DataTypeDecimalILS3_20EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Unexecuted instantiation: _ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE6EEENS_15DataTypeDecimalILS3_20EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Unexecuted instantiation: _ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE7EEENS_15DataTypeDecimalILS3_20EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Unexecuted instantiation: _ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE7EEENS_15DataTypeDecimalILS3_20EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh _ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE2EEENS_15DataTypeDecimalILS3_28EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 686 | 4 | const NullMap::value_type* null_map = nullptr) const override { | 687 | 4 | using FromFieldType = typename FromDataType::FieldType; | 688 | 4 | using ToFieldType = typename ToDataType::FieldType; | 689 | 4 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 690 | 4 | const auto* col_from = | 691 | 4 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 692 | 4 | if (!col_from) { | 693 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 694 | 0 | named_from.column->get_name()); | 695 | 0 | } | 696 | | | 697 | 4 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 698 | 4 | constexpr UInt32 from_scale = 0; | 699 | | | 700 | 4 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 701 | 4 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 702 | 4 | UInt32 to_precision = to_decimal_type.get_precision(); | 703 | 4 | ToDataType::check_type_precision(to_precision); | 704 | 4 | UInt32 to_scale = to_decimal_type.get_scale(); | 705 | 4 | ToDataType::check_type_scale(to_scale); | 706 | | | 707 | 4 | auto from_max_int_digit_count = from_precision - from_scale; | 708 | 4 | auto to_max_int_digit_count = to_precision - to_scale; | 709 | | // may overflow. nullable result column. | 710 | 4 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 711 | | // only in non-strict mode and may overflow, we set nullable | 712 | 4 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 713 | | | 714 | 4 | constexpr UInt32 to_max_digits = | 715 | 4 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 716 | 4 | bool multiply_may_overflow = false; | 717 | 4 | if (to_scale > from_scale) { | 718 | 4 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 719 | 4 | } | 720 | 4 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 721 | 4 | sizeof(typename ToFieldType::NativeType)), | 722 | 4 | FromFieldType, typename ToFieldType::NativeType>; | 723 | 4 | MaxNativeType scale_multiplier = | 724 | 4 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 725 | 4 | typename ToFieldType::NativeType max_result = | 726 | 4 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 727 | 4 | typename ToFieldType::NativeType min_result = -max_result; | 728 | | | 729 | 4 | ColumnUInt8::MutablePtr col_null_map_to; | 730 | 4 | NullMap::value_type* null_map_data = nullptr; | 731 | 4 | if (narrow_integral) { | 732 | 4 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 733 | 4 | null_map_data = col_null_map_to->get_data().data(); | 734 | 4 | } | 735 | | | 736 | 4 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 737 | 4 | const auto& vec_from = col_from->get_data(); | 738 | 4 | const auto* vec_from_data = vec_from.data(); | 739 | 4 | auto& vec_to = col_to->get_data(); | 740 | 4 | auto* vec_to_data = vec_to.data(); | 741 | | | 742 | 4 | CastParameters params; | 743 | 4 | params.is_strict = (CastMode == CastModeType::StrictMode); | 744 | 4 | size_t size = vec_from.size(); | 745 | | | 746 | 4 | RETURN_IF_ERROR(std::visit( | 747 | 4 | [&](auto multiply_may_overflow, auto narrow_integral) { | 748 | 4 | for (size_t i = 0; i < size; i++) { | 749 | 4 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 750 | 4 | typename ToDataType::FieldType, | 751 | 4 | multiply_may_overflow, narrow_integral>( | 752 | 4 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 753 | 4 | scale_multiplier, min_result, max_result, params)) { | 754 | 4 | if (set_nullable) { | 755 | 4 | null_map_data[i] = 1; | 756 | 4 | } else { | 757 | 4 | return params.status; | 758 | 4 | } | 759 | 4 | } | 760 | 4 | } | 761 | 4 | return Status::OK(); | 762 | 4 | }, | 763 | 4 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 764 | | | 765 | 2 | if (narrow_integral) { | 766 | 2 | block.get_by_position(result).column = | 767 | 2 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 768 | 2 | } else { | 769 | 0 | block.get_by_position(result).column = std::move(col_to); | 770 | 0 | } | 771 | 2 | return Status::OK(); | 772 | 4 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE2EEENS_15DataTypeDecimalILS3_28EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 686 | 10 | const NullMap::value_type* null_map = nullptr) const override { | 687 | 10 | using FromFieldType = typename FromDataType::FieldType; | 688 | 10 | using ToFieldType = typename ToDataType::FieldType; | 689 | 10 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 690 | 10 | const auto* col_from = | 691 | 10 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 692 | 10 | if (!col_from) { | 693 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 694 | 0 | named_from.column->get_name()); | 695 | 0 | } | 696 | | | 697 | 10 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 698 | 10 | constexpr UInt32 from_scale = 0; | 699 | | | 700 | 10 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 701 | 10 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 702 | 10 | UInt32 to_precision = to_decimal_type.get_precision(); | 703 | 10 | ToDataType::check_type_precision(to_precision); | 704 | 10 | UInt32 to_scale = to_decimal_type.get_scale(); | 705 | 10 | ToDataType::check_type_scale(to_scale); | 706 | | | 707 | 10 | auto from_max_int_digit_count = from_precision - from_scale; | 708 | 10 | auto to_max_int_digit_count = to_precision - to_scale; | 709 | | // may overflow. nullable result column. | 710 | 10 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 711 | | // only in non-strict mode and may overflow, we set nullable | 712 | 10 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 713 | | | 714 | 10 | constexpr UInt32 to_max_digits = | 715 | 10 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 716 | 10 | bool multiply_may_overflow = false; | 717 | 10 | if (to_scale > from_scale) { | 718 | 8 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 719 | 8 | } | 720 | 10 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 721 | 10 | sizeof(typename ToFieldType::NativeType)), | 722 | 10 | FromFieldType, typename ToFieldType::NativeType>; | 723 | 10 | MaxNativeType scale_multiplier = | 724 | 10 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 725 | 10 | typename ToFieldType::NativeType max_result = | 726 | 10 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 727 | 10 | typename ToFieldType::NativeType min_result = -max_result; | 728 | | | 729 | 10 | ColumnUInt8::MutablePtr col_null_map_to; | 730 | 10 | NullMap::value_type* null_map_data = nullptr; | 731 | 10 | if (narrow_integral) { | 732 | 2 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 733 | 2 | null_map_data = col_null_map_to->get_data().data(); | 734 | 2 | } | 735 | | | 736 | 10 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 737 | 10 | const auto& vec_from = col_from->get_data(); | 738 | 10 | const auto* vec_from_data = vec_from.data(); | 739 | 10 | auto& vec_to = col_to->get_data(); | 740 | 10 | auto* vec_to_data = vec_to.data(); | 741 | | | 742 | 10 | CastParameters params; | 743 | 10 | params.is_strict = (CastMode == CastModeType::StrictMode); | 744 | 10 | size_t size = vec_from.size(); | 745 | | | 746 | 10 | RETURN_IF_ERROR(std::visit( | 747 | 10 | [&](auto multiply_may_overflow, auto narrow_integral) { | 748 | 10 | for (size_t i = 0; i < size; i++) { | 749 | 10 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 750 | 10 | typename ToDataType::FieldType, | 751 | 10 | multiply_may_overflow, narrow_integral>( | 752 | 10 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 753 | 10 | scale_multiplier, min_result, max_result, params)) { | 754 | 10 | if (set_nullable) { | 755 | 10 | null_map_data[i] = 1; | 756 | 10 | } else { | 757 | 10 | return params.status; | 758 | 10 | } | 759 | 10 | } | 760 | 10 | } | 761 | 10 | return Status::OK(); | 762 | 10 | }, | 763 | 10 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 764 | | | 765 | 10 | if (narrow_integral) { | 766 | 2 | block.get_by_position(result).column = | 767 | 2 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 768 | 8 | } else { | 769 | 8 | block.get_by_position(result).column = std::move(col_to); | 770 | 8 | } | 771 | 10 | return Status::OK(); | 772 | 10 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE3EEENS_15DataTypeDecimalILS3_28EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 686 | 46 | const NullMap::value_type* null_map = nullptr) const override { | 687 | 46 | using FromFieldType = typename FromDataType::FieldType; | 688 | 46 | using ToFieldType = typename ToDataType::FieldType; | 689 | 46 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 690 | 46 | const auto* col_from = | 691 | 46 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 692 | 46 | if (!col_from) { | 693 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 694 | 0 | named_from.column->get_name()); | 695 | 0 | } | 696 | | | 697 | 46 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 698 | 46 | constexpr UInt32 from_scale = 0; | 699 | | | 700 | 46 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 701 | 46 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 702 | 46 | UInt32 to_precision = to_decimal_type.get_precision(); | 703 | 46 | ToDataType::check_type_precision(to_precision); | 704 | 46 | UInt32 to_scale = to_decimal_type.get_scale(); | 705 | 46 | ToDataType::check_type_scale(to_scale); | 706 | | | 707 | 46 | auto from_max_int_digit_count = from_precision - from_scale; | 708 | 46 | auto to_max_int_digit_count = to_precision - to_scale; | 709 | | // may overflow. nullable result column. | 710 | 46 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 711 | | // only in non-strict mode and may overflow, we set nullable | 712 | 46 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 713 | | | 714 | 46 | constexpr UInt32 to_max_digits = | 715 | 46 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 716 | 46 | bool multiply_may_overflow = false; | 717 | 46 | if (to_scale > from_scale) { | 718 | 32 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 719 | 32 | } | 720 | 46 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 721 | 46 | sizeof(typename ToFieldType::NativeType)), | 722 | 46 | FromFieldType, typename ToFieldType::NativeType>; | 723 | 46 | MaxNativeType scale_multiplier = | 724 | 46 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 725 | 46 | typename ToFieldType::NativeType max_result = | 726 | 46 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 727 | 46 | typename ToFieldType::NativeType min_result = -max_result; | 728 | | | 729 | 46 | ColumnUInt8::MutablePtr col_null_map_to; | 730 | 46 | NullMap::value_type* null_map_data = nullptr; | 731 | 46 | if (narrow_integral) { | 732 | 40 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 733 | 40 | null_map_data = col_null_map_to->get_data().data(); | 734 | 40 | } | 735 | | | 736 | 46 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 737 | 46 | const auto& vec_from = col_from->get_data(); | 738 | 46 | const auto* vec_from_data = vec_from.data(); | 739 | 46 | auto& vec_to = col_to->get_data(); | 740 | 46 | auto* vec_to_data = vec_to.data(); | 741 | | | 742 | 46 | CastParameters params; | 743 | 46 | params.is_strict = (CastMode == CastModeType::StrictMode); | 744 | 46 | size_t size = vec_from.size(); | 745 | | | 746 | 46 | RETURN_IF_ERROR(std::visit( | 747 | 46 | [&](auto multiply_may_overflow, auto narrow_integral) { | 748 | 46 | for (size_t i = 0; i < size; i++) { | 749 | 46 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 750 | 46 | typename ToDataType::FieldType, | 751 | 46 | multiply_may_overflow, narrow_integral>( | 752 | 46 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 753 | 46 | scale_multiplier, min_result, max_result, params)) { | 754 | 46 | if (set_nullable) { | 755 | 46 | null_map_data[i] = 1; | 756 | 46 | } else { | 757 | 46 | return params.status; | 758 | 46 | } | 759 | 46 | } | 760 | 46 | } | 761 | 46 | return Status::OK(); | 762 | 46 | }, | 763 | 46 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 764 | | | 765 | 14 | if (narrow_integral) { | 766 | 8 | block.get_by_position(result).column = | 767 | 8 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 768 | 8 | } else { | 769 | 6 | block.get_by_position(result).column = std::move(col_to); | 770 | 6 | } | 771 | 14 | return Status::OK(); | 772 | 46 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE3EEENS_15DataTypeDecimalILS3_28EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 686 | 22 | const NullMap::value_type* null_map = nullptr) const override { | 687 | 22 | using FromFieldType = typename FromDataType::FieldType; | 688 | 22 | using ToFieldType = typename ToDataType::FieldType; | 689 | 22 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 690 | 22 | const auto* col_from = | 691 | 22 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 692 | 22 | if (!col_from) { | 693 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 694 | 0 | named_from.column->get_name()); | 695 | 0 | } | 696 | | | 697 | 22 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 698 | 22 | constexpr UInt32 from_scale = 0; | 699 | | | 700 | 22 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 701 | 22 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 702 | 22 | UInt32 to_precision = to_decimal_type.get_precision(); | 703 | 22 | ToDataType::check_type_precision(to_precision); | 704 | 22 | UInt32 to_scale = to_decimal_type.get_scale(); | 705 | 22 | ToDataType::check_type_scale(to_scale); | 706 | | | 707 | 22 | auto from_max_int_digit_count = from_precision - from_scale; | 708 | 22 | auto to_max_int_digit_count = to_precision - to_scale; | 709 | | // may overflow. nullable result column. | 710 | 22 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 711 | | // only in non-strict mode and may overflow, we set nullable | 712 | 22 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 713 | | | 714 | 22 | constexpr UInt32 to_max_digits = | 715 | 22 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 716 | 22 | bool multiply_may_overflow = false; | 717 | 22 | if (to_scale > from_scale) { | 718 | 14 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 719 | 14 | } | 720 | 22 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 721 | 22 | sizeof(typename ToFieldType::NativeType)), | 722 | 22 | FromFieldType, typename ToFieldType::NativeType>; | 723 | 22 | MaxNativeType scale_multiplier = | 724 | 22 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 725 | 22 | typename ToFieldType::NativeType max_result = | 726 | 22 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 727 | 22 | typename ToFieldType::NativeType min_result = -max_result; | 728 | | | 729 | 22 | ColumnUInt8::MutablePtr col_null_map_to; | 730 | 22 | NullMap::value_type* null_map_data = nullptr; | 731 | 22 | if (narrow_integral) { | 732 | 16 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 733 | 16 | null_map_data = col_null_map_to->get_data().data(); | 734 | 16 | } | 735 | | | 736 | 22 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 737 | 22 | const auto& vec_from = col_from->get_data(); | 738 | 22 | const auto* vec_from_data = vec_from.data(); | 739 | 22 | auto& vec_to = col_to->get_data(); | 740 | 22 | auto* vec_to_data = vec_to.data(); | 741 | | | 742 | 22 | CastParameters params; | 743 | 22 | params.is_strict = (CastMode == CastModeType::StrictMode); | 744 | 22 | size_t size = vec_from.size(); | 745 | | | 746 | 22 | RETURN_IF_ERROR(std::visit( | 747 | 22 | [&](auto multiply_may_overflow, auto narrow_integral) { | 748 | 22 | for (size_t i = 0; i < size; i++) { | 749 | 22 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 750 | 22 | typename ToDataType::FieldType, | 751 | 22 | multiply_may_overflow, narrow_integral>( | 752 | 22 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 753 | 22 | scale_multiplier, min_result, max_result, params)) { | 754 | 22 | if (set_nullable) { | 755 | 22 | null_map_data[i] = 1; | 756 | 22 | } else { | 757 | 22 | return params.status; | 758 | 22 | } | 759 | 22 | } | 760 | 22 | } | 761 | 22 | return Status::OK(); | 762 | 22 | }, | 763 | 22 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 764 | | | 765 | 22 | if (narrow_integral) { | 766 | 16 | block.get_by_position(result).column = | 767 | 16 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 768 | 16 | } else { | 769 | 6 | block.get_by_position(result).column = std::move(col_to); | 770 | 6 | } | 771 | 22 | return Status::OK(); | 772 | 22 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE4EEENS_15DataTypeDecimalILS3_28EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 686 | 54 | const NullMap::value_type* null_map = nullptr) const override { | 687 | 54 | using FromFieldType = typename FromDataType::FieldType; | 688 | 54 | using ToFieldType = typename ToDataType::FieldType; | 689 | 54 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 690 | 54 | const auto* col_from = | 691 | 54 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 692 | 54 | if (!col_from) { | 693 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 694 | 0 | named_from.column->get_name()); | 695 | 0 | } | 696 | | | 697 | 54 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 698 | 54 | constexpr UInt32 from_scale = 0; | 699 | | | 700 | 54 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 701 | 54 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 702 | 54 | UInt32 to_precision = to_decimal_type.get_precision(); | 703 | 54 | ToDataType::check_type_precision(to_precision); | 704 | 54 | UInt32 to_scale = to_decimal_type.get_scale(); | 705 | 54 | ToDataType::check_type_scale(to_scale); | 706 | | | 707 | 54 | auto from_max_int_digit_count = from_precision - from_scale; | 708 | 54 | auto to_max_int_digit_count = to_precision - to_scale; | 709 | | // may overflow. nullable result column. | 710 | 54 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 711 | | // only in non-strict mode and may overflow, we set nullable | 712 | 54 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 713 | | | 714 | 54 | constexpr UInt32 to_max_digits = | 715 | 54 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 716 | 54 | bool multiply_may_overflow = false; | 717 | 54 | if (to_scale > from_scale) { | 718 | 32 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 719 | 32 | } | 720 | 54 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 721 | 54 | sizeof(typename ToFieldType::NativeType)), | 722 | 54 | FromFieldType, typename ToFieldType::NativeType>; | 723 | 54 | MaxNativeType scale_multiplier = | 724 | 54 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 725 | 54 | typename ToFieldType::NativeType max_result = | 726 | 54 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 727 | 54 | typename ToFieldType::NativeType min_result = -max_result; | 728 | | | 729 | 54 | ColumnUInt8::MutablePtr col_null_map_to; | 730 | 54 | NullMap::value_type* null_map_data = nullptr; | 731 | 54 | if (narrow_integral) { | 732 | 50 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 733 | 50 | null_map_data = col_null_map_to->get_data().data(); | 734 | 50 | } | 735 | | | 736 | 54 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 737 | 54 | const auto& vec_from = col_from->get_data(); | 738 | 54 | const auto* vec_from_data = vec_from.data(); | 739 | 54 | auto& vec_to = col_to->get_data(); | 740 | 54 | auto* vec_to_data = vec_to.data(); | 741 | | | 742 | 54 | CastParameters params; | 743 | 54 | params.is_strict = (CastMode == CastModeType::StrictMode); | 744 | 54 | size_t size = vec_from.size(); | 745 | | | 746 | 54 | RETURN_IF_ERROR(std::visit( | 747 | 54 | [&](auto multiply_may_overflow, auto narrow_integral) { | 748 | 54 | for (size_t i = 0; i < size; i++) { | 749 | 54 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 750 | 54 | typename ToDataType::FieldType, | 751 | 54 | multiply_may_overflow, narrow_integral>( | 752 | 54 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 753 | 54 | scale_multiplier, min_result, max_result, params)) { | 754 | 54 | if (set_nullable) { | 755 | 54 | null_map_data[i] = 1; | 756 | 54 | } else { | 757 | 54 | return params.status; | 758 | 54 | } | 759 | 54 | } | 760 | 54 | } | 761 | 54 | return Status::OK(); | 762 | 54 | }, | 763 | 54 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 764 | | | 765 | 14 | if (narrow_integral) { | 766 | 10 | block.get_by_position(result).column = | 767 | 10 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 768 | 10 | } else { | 769 | 4 | block.get_by_position(result).column = std::move(col_to); | 770 | 4 | } | 771 | 14 | return Status::OK(); | 772 | 54 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE4EEENS_15DataTypeDecimalILS3_28EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 686 | 24 | const NullMap::value_type* null_map = nullptr) const override { | 687 | 24 | using FromFieldType = typename FromDataType::FieldType; | 688 | 24 | using ToFieldType = typename ToDataType::FieldType; | 689 | 24 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 690 | 24 | const auto* col_from = | 691 | 24 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 692 | 24 | if (!col_from) { | 693 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 694 | 0 | named_from.column->get_name()); | 695 | 0 | } | 696 | | | 697 | 24 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 698 | 24 | constexpr UInt32 from_scale = 0; | 699 | | | 700 | 24 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 701 | 24 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 702 | 24 | UInt32 to_precision = to_decimal_type.get_precision(); | 703 | 24 | ToDataType::check_type_precision(to_precision); | 704 | 24 | UInt32 to_scale = to_decimal_type.get_scale(); | 705 | 24 | ToDataType::check_type_scale(to_scale); | 706 | | | 707 | 24 | auto from_max_int_digit_count = from_precision - from_scale; | 708 | 24 | auto to_max_int_digit_count = to_precision - to_scale; | 709 | | // may overflow. nullable result column. | 710 | 24 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 711 | | // only in non-strict mode and may overflow, we set nullable | 712 | 24 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 713 | | | 714 | 24 | constexpr UInt32 to_max_digits = | 715 | 24 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 716 | 24 | bool multiply_may_overflow = false; | 717 | 24 | if (to_scale > from_scale) { | 718 | 14 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 719 | 14 | } | 720 | 24 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 721 | 24 | sizeof(typename ToFieldType::NativeType)), | 722 | 24 | FromFieldType, typename ToFieldType::NativeType>; | 723 | 24 | MaxNativeType scale_multiplier = | 724 | 24 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 725 | 24 | typename ToFieldType::NativeType max_result = | 726 | 24 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 727 | 24 | typename ToFieldType::NativeType min_result = -max_result; | 728 | | | 729 | 24 | ColumnUInt8::MutablePtr col_null_map_to; | 730 | 24 | NullMap::value_type* null_map_data = nullptr; | 731 | 24 | if (narrow_integral) { | 732 | 20 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 733 | 20 | null_map_data = col_null_map_to->get_data().data(); | 734 | 20 | } | 735 | | | 736 | 24 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 737 | 24 | const auto& vec_from = col_from->get_data(); | 738 | 24 | const auto* vec_from_data = vec_from.data(); | 739 | 24 | auto& vec_to = col_to->get_data(); | 740 | 24 | auto* vec_to_data = vec_to.data(); | 741 | | | 742 | 24 | CastParameters params; | 743 | 24 | params.is_strict = (CastMode == CastModeType::StrictMode); | 744 | 24 | size_t size = vec_from.size(); | 745 | | | 746 | 24 | RETURN_IF_ERROR(std::visit( | 747 | 24 | [&](auto multiply_may_overflow, auto narrow_integral) { | 748 | 24 | for (size_t i = 0; i < size; i++) { | 749 | 24 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 750 | 24 | typename ToDataType::FieldType, | 751 | 24 | multiply_may_overflow, narrow_integral>( | 752 | 24 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 753 | 24 | scale_multiplier, min_result, max_result, params)) { | 754 | 24 | if (set_nullable) { | 755 | 24 | null_map_data[i] = 1; | 756 | 24 | } else { | 757 | 24 | return params.status; | 758 | 24 | } | 759 | 24 | } | 760 | 24 | } | 761 | 24 | return Status::OK(); | 762 | 24 | }, | 763 | 24 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 764 | | | 765 | 24 | if (narrow_integral) { | 766 | 20 | block.get_by_position(result).column = | 767 | 20 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 768 | 20 | } else { | 769 | 4 | block.get_by_position(result).column = std::move(col_to); | 770 | 4 | } | 771 | 24 | return Status::OK(); | 772 | 24 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE5EEENS_15DataTypeDecimalILS3_28EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 686 | 70 | const NullMap::value_type* null_map = nullptr) const override { | 687 | 70 | using FromFieldType = typename FromDataType::FieldType; | 688 | 70 | using ToFieldType = typename ToDataType::FieldType; | 689 | 70 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 690 | 70 | const auto* col_from = | 691 | 70 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 692 | 70 | if (!col_from) { | 693 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 694 | 0 | named_from.column->get_name()); | 695 | 0 | } | 696 | | | 697 | 70 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 698 | 70 | constexpr UInt32 from_scale = 0; | 699 | | | 700 | 70 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 701 | 70 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 702 | 70 | UInt32 to_precision = to_decimal_type.get_precision(); | 703 | 70 | ToDataType::check_type_precision(to_precision); | 704 | 70 | UInt32 to_scale = to_decimal_type.get_scale(); | 705 | 70 | ToDataType::check_type_scale(to_scale); | 706 | | | 707 | 70 | auto from_max_int_digit_count = from_precision - from_scale; | 708 | 70 | auto to_max_int_digit_count = to_precision - to_scale; | 709 | | // may overflow. nullable result column. | 710 | 70 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 711 | | // only in non-strict mode and may overflow, we set nullable | 712 | 70 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 713 | | | 714 | 70 | constexpr UInt32 to_max_digits = | 715 | 70 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 716 | 70 | bool multiply_may_overflow = false; | 717 | 70 | if (to_scale > from_scale) { | 718 | 40 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 719 | 40 | } | 720 | 70 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 721 | 70 | sizeof(typename ToFieldType::NativeType)), | 722 | 70 | FromFieldType, typename ToFieldType::NativeType>; | 723 | 70 | MaxNativeType scale_multiplier = | 724 | 70 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 725 | 70 | typename ToFieldType::NativeType max_result = | 726 | 70 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 727 | 70 | typename ToFieldType::NativeType min_result = -max_result; | 728 | | | 729 | 70 | ColumnUInt8::MutablePtr col_null_map_to; | 730 | 70 | NullMap::value_type* null_map_data = nullptr; | 731 | 70 | if (narrow_integral) { | 732 | 70 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 733 | 70 | null_map_data = col_null_map_to->get_data().data(); | 734 | 70 | } | 735 | | | 736 | 70 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 737 | 70 | const auto& vec_from = col_from->get_data(); | 738 | 70 | const auto* vec_from_data = vec_from.data(); | 739 | 70 | auto& vec_to = col_to->get_data(); | 740 | 70 | auto* vec_to_data = vec_to.data(); | 741 | | | 742 | 70 | CastParameters params; | 743 | 70 | params.is_strict = (CastMode == CastModeType::StrictMode); | 744 | 70 | size_t size = vec_from.size(); | 745 | | | 746 | 70 | RETURN_IF_ERROR(std::visit( | 747 | 70 | [&](auto multiply_may_overflow, auto narrow_integral) { | 748 | 70 | for (size_t i = 0; i < size; i++) { | 749 | 70 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 750 | 70 | typename ToDataType::FieldType, | 751 | 70 | multiply_may_overflow, narrow_integral>( | 752 | 70 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 753 | 70 | scale_multiplier, min_result, max_result, params)) { | 754 | 70 | if (set_nullable) { | 755 | 70 | null_map_data[i] = 1; | 756 | 70 | } else { | 757 | 70 | return params.status; | 758 | 70 | } | 759 | 70 | } | 760 | 70 | } | 761 | 70 | return Status::OK(); | 762 | 70 | }, | 763 | 70 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 764 | | | 765 | 14 | if (narrow_integral) { | 766 | 14 | block.get_by_position(result).column = | 767 | 14 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 768 | 14 | } else { | 769 | 0 | block.get_by_position(result).column = std::move(col_to); | 770 | 0 | } | 771 | 14 | return Status::OK(); | 772 | 70 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE5EEENS_15DataTypeDecimalILS3_28EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 686 | 28 | const NullMap::value_type* null_map = nullptr) const override { | 687 | 28 | using FromFieldType = typename FromDataType::FieldType; | 688 | 28 | using ToFieldType = typename ToDataType::FieldType; | 689 | 28 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 690 | 28 | const auto* col_from = | 691 | 28 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 692 | 28 | if (!col_from) { | 693 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 694 | 0 | named_from.column->get_name()); | 695 | 0 | } | 696 | | | 697 | 28 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 698 | 28 | constexpr UInt32 from_scale = 0; | 699 | | | 700 | 28 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 701 | 28 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 702 | 28 | UInt32 to_precision = to_decimal_type.get_precision(); | 703 | 28 | ToDataType::check_type_precision(to_precision); | 704 | 28 | UInt32 to_scale = to_decimal_type.get_scale(); | 705 | 28 | ToDataType::check_type_scale(to_scale); | 706 | | | 707 | 28 | auto from_max_int_digit_count = from_precision - from_scale; | 708 | 28 | auto to_max_int_digit_count = to_precision - to_scale; | 709 | | // may overflow. nullable result column. | 710 | 28 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 711 | | // only in non-strict mode and may overflow, we set nullable | 712 | 28 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 713 | | | 714 | 28 | constexpr UInt32 to_max_digits = | 715 | 28 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 716 | 28 | bool multiply_may_overflow = false; | 717 | 28 | if (to_scale > from_scale) { | 718 | 16 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 719 | 16 | } | 720 | 28 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 721 | 28 | sizeof(typename ToFieldType::NativeType)), | 722 | 28 | FromFieldType, typename ToFieldType::NativeType>; | 723 | 28 | MaxNativeType scale_multiplier = | 724 | 28 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 725 | 28 | typename ToFieldType::NativeType max_result = | 726 | 28 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 727 | 28 | typename ToFieldType::NativeType min_result = -max_result; | 728 | | | 729 | 28 | ColumnUInt8::MutablePtr col_null_map_to; | 730 | 28 | NullMap::value_type* null_map_data = nullptr; | 731 | 28 | if (narrow_integral) { | 732 | 28 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 733 | 28 | null_map_data = col_null_map_to->get_data().data(); | 734 | 28 | } | 735 | | | 736 | 28 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 737 | 28 | const auto& vec_from = col_from->get_data(); | 738 | 28 | const auto* vec_from_data = vec_from.data(); | 739 | 28 | auto& vec_to = col_to->get_data(); | 740 | 28 | auto* vec_to_data = vec_to.data(); | 741 | | | 742 | 28 | CastParameters params; | 743 | 28 | params.is_strict = (CastMode == CastModeType::StrictMode); | 744 | 28 | size_t size = vec_from.size(); | 745 | | | 746 | 28 | RETURN_IF_ERROR(std::visit( | 747 | 28 | [&](auto multiply_may_overflow, auto narrow_integral) { | 748 | 28 | for (size_t i = 0; i < size; i++) { | 749 | 28 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 750 | 28 | typename ToDataType::FieldType, | 751 | 28 | multiply_may_overflow, narrow_integral>( | 752 | 28 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 753 | 28 | scale_multiplier, min_result, max_result, params)) { | 754 | 28 | if (set_nullable) { | 755 | 28 | null_map_data[i] = 1; | 756 | 28 | } else { | 757 | 28 | return params.status; | 758 | 28 | } | 759 | 28 | } | 760 | 28 | } | 761 | 28 | return Status::OK(); | 762 | 28 | }, | 763 | 28 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 764 | | | 765 | 28 | if (narrow_integral) { | 766 | 28 | block.get_by_position(result).column = | 767 | 28 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 768 | 28 | } else { | 769 | 0 | block.get_by_position(result).column = std::move(col_to); | 770 | 0 | } | 771 | 28 | return Status::OK(); | 772 | 28 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE6EEENS_15DataTypeDecimalILS3_28EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 686 | 70 | const NullMap::value_type* null_map = nullptr) const override { | 687 | 70 | using FromFieldType = typename FromDataType::FieldType; | 688 | 70 | using ToFieldType = typename ToDataType::FieldType; | 689 | 70 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 690 | 70 | const auto* col_from = | 691 | 70 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 692 | 70 | if (!col_from) { | 693 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 694 | 0 | named_from.column->get_name()); | 695 | 0 | } | 696 | | | 697 | 70 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 698 | 70 | constexpr UInt32 from_scale = 0; | 699 | | | 700 | 70 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 701 | 70 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 702 | 70 | UInt32 to_precision = to_decimal_type.get_precision(); | 703 | 70 | ToDataType::check_type_precision(to_precision); | 704 | 70 | UInt32 to_scale = to_decimal_type.get_scale(); | 705 | 70 | ToDataType::check_type_scale(to_scale); | 706 | | | 707 | 70 | auto from_max_int_digit_count = from_precision - from_scale; | 708 | 70 | auto to_max_int_digit_count = to_precision - to_scale; | 709 | | // may overflow. nullable result column. | 710 | 70 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 711 | | // only in non-strict mode and may overflow, we set nullable | 712 | 70 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 713 | | | 714 | 70 | constexpr UInt32 to_max_digits = | 715 | 70 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 716 | 70 | bool multiply_may_overflow = false; | 717 | 70 | if (to_scale > from_scale) { | 718 | 40 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 719 | 40 | } | 720 | 70 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 721 | 70 | sizeof(typename ToFieldType::NativeType)), | 722 | 70 | FromFieldType, typename ToFieldType::NativeType>; | 723 | 70 | MaxNativeType scale_multiplier = | 724 | 70 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 725 | 70 | typename ToFieldType::NativeType max_result = | 726 | 70 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 727 | 70 | typename ToFieldType::NativeType min_result = -max_result; | 728 | | | 729 | 70 | ColumnUInt8::MutablePtr col_null_map_to; | 730 | 70 | NullMap::value_type* null_map_data = nullptr; | 731 | 70 | if (narrow_integral) { | 732 | 70 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 733 | 70 | null_map_data = col_null_map_to->get_data().data(); | 734 | 70 | } | 735 | | | 736 | 70 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 737 | 70 | const auto& vec_from = col_from->get_data(); | 738 | 70 | const auto* vec_from_data = vec_from.data(); | 739 | 70 | auto& vec_to = col_to->get_data(); | 740 | 70 | auto* vec_to_data = vec_to.data(); | 741 | | | 742 | 70 | CastParameters params; | 743 | 70 | params.is_strict = (CastMode == CastModeType::StrictMode); | 744 | 70 | size_t size = vec_from.size(); | 745 | | | 746 | 70 | RETURN_IF_ERROR(std::visit( | 747 | 70 | [&](auto multiply_may_overflow, auto narrow_integral) { | 748 | 70 | for (size_t i = 0; i < size; i++) { | 749 | 70 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 750 | 70 | typename ToDataType::FieldType, | 751 | 70 | multiply_may_overflow, narrow_integral>( | 752 | 70 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 753 | 70 | scale_multiplier, min_result, max_result, params)) { | 754 | 70 | if (set_nullable) { | 755 | 70 | null_map_data[i] = 1; | 756 | 70 | } else { | 757 | 70 | return params.status; | 758 | 70 | } | 759 | 70 | } | 760 | 70 | } | 761 | 70 | return Status::OK(); | 762 | 70 | }, | 763 | 70 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 764 | | | 765 | 14 | if (narrow_integral) { | 766 | 14 | block.get_by_position(result).column = | 767 | 14 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 768 | 14 | } else { | 769 | 0 | block.get_by_position(result).column = std::move(col_to); | 770 | 0 | } | 771 | 14 | return Status::OK(); | 772 | 70 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE6EEENS_15DataTypeDecimalILS3_28EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 686 | 28 | const NullMap::value_type* null_map = nullptr) const override { | 687 | 28 | using FromFieldType = typename FromDataType::FieldType; | 688 | 28 | using ToFieldType = typename ToDataType::FieldType; | 689 | 28 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 690 | 28 | const auto* col_from = | 691 | 28 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 692 | 28 | if (!col_from) { | 693 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 694 | 0 | named_from.column->get_name()); | 695 | 0 | } | 696 | | | 697 | 28 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 698 | 28 | constexpr UInt32 from_scale = 0; | 699 | | | 700 | 28 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 701 | 28 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 702 | 28 | UInt32 to_precision = to_decimal_type.get_precision(); | 703 | 28 | ToDataType::check_type_precision(to_precision); | 704 | 28 | UInt32 to_scale = to_decimal_type.get_scale(); | 705 | 28 | ToDataType::check_type_scale(to_scale); | 706 | | | 707 | 28 | auto from_max_int_digit_count = from_precision - from_scale; | 708 | 28 | auto to_max_int_digit_count = to_precision - to_scale; | 709 | | // may overflow. nullable result column. | 710 | 28 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 711 | | // only in non-strict mode and may overflow, we set nullable | 712 | 28 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 713 | | | 714 | 28 | constexpr UInt32 to_max_digits = | 715 | 28 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 716 | 28 | bool multiply_may_overflow = false; | 717 | 28 | if (to_scale > from_scale) { | 718 | 16 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 719 | 16 | } | 720 | 28 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 721 | 28 | sizeof(typename ToFieldType::NativeType)), | 722 | 28 | FromFieldType, typename ToFieldType::NativeType>; | 723 | 28 | MaxNativeType scale_multiplier = | 724 | 28 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 725 | 28 | typename ToFieldType::NativeType max_result = | 726 | 28 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 727 | 28 | typename ToFieldType::NativeType min_result = -max_result; | 728 | | | 729 | 28 | ColumnUInt8::MutablePtr col_null_map_to; | 730 | 28 | NullMap::value_type* null_map_data = nullptr; | 731 | 28 | if (narrow_integral) { | 732 | 28 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 733 | 28 | null_map_data = col_null_map_to->get_data().data(); | 734 | 28 | } | 735 | | | 736 | 28 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 737 | 28 | const auto& vec_from = col_from->get_data(); | 738 | 28 | const auto* vec_from_data = vec_from.data(); | 739 | 28 | auto& vec_to = col_to->get_data(); | 740 | 28 | auto* vec_to_data = vec_to.data(); | 741 | | | 742 | 28 | CastParameters params; | 743 | 28 | params.is_strict = (CastMode == CastModeType::StrictMode); | 744 | 28 | size_t size = vec_from.size(); | 745 | | | 746 | 28 | RETURN_IF_ERROR(std::visit( | 747 | 28 | [&](auto multiply_may_overflow, auto narrow_integral) { | 748 | 28 | for (size_t i = 0; i < size; i++) { | 749 | 28 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 750 | 28 | typename ToDataType::FieldType, | 751 | 28 | multiply_may_overflow, narrow_integral>( | 752 | 28 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 753 | 28 | scale_multiplier, min_result, max_result, params)) { | 754 | 28 | if (set_nullable) { | 755 | 28 | null_map_data[i] = 1; | 756 | 28 | } else { | 757 | 28 | return params.status; | 758 | 28 | } | 759 | 28 | } | 760 | 28 | } | 761 | 28 | return Status::OK(); | 762 | 28 | }, | 763 | 28 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 764 | | | 765 | 28 | if (narrow_integral) { | 766 | 28 | block.get_by_position(result).column = | 767 | 28 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 768 | 28 | } else { | 769 | 0 | block.get_by_position(result).column = std::move(col_to); | 770 | 0 | } | 771 | 28 | return Status::OK(); | 772 | 28 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE7EEENS_15DataTypeDecimalILS3_28EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 686 | 70 | const NullMap::value_type* null_map = nullptr) const override { | 687 | 70 | using FromFieldType = typename FromDataType::FieldType; | 688 | 70 | using ToFieldType = typename ToDataType::FieldType; | 689 | 70 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 690 | 70 | const auto* col_from = | 691 | 70 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 692 | 70 | if (!col_from) { | 693 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 694 | 0 | named_from.column->get_name()); | 695 | 0 | } | 696 | | | 697 | 70 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 698 | 70 | constexpr UInt32 from_scale = 0; | 699 | | | 700 | 70 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 701 | 70 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 702 | 70 | UInt32 to_precision = to_decimal_type.get_precision(); | 703 | 70 | ToDataType::check_type_precision(to_precision); | 704 | 70 | UInt32 to_scale = to_decimal_type.get_scale(); | 705 | 70 | ToDataType::check_type_scale(to_scale); | 706 | | | 707 | 70 | auto from_max_int_digit_count = from_precision - from_scale; | 708 | 70 | auto to_max_int_digit_count = to_precision - to_scale; | 709 | | // may overflow. nullable result column. | 710 | 70 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 711 | | // only in non-strict mode and may overflow, we set nullable | 712 | 70 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 713 | | | 714 | 70 | constexpr UInt32 to_max_digits = | 715 | 70 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 716 | 70 | bool multiply_may_overflow = false; | 717 | 70 | if (to_scale > from_scale) { | 718 | 40 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 719 | 40 | } | 720 | 70 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 721 | 70 | sizeof(typename ToFieldType::NativeType)), | 722 | 70 | FromFieldType, typename ToFieldType::NativeType>; | 723 | 70 | MaxNativeType scale_multiplier = | 724 | 70 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 725 | 70 | typename ToFieldType::NativeType max_result = | 726 | 70 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 727 | 70 | typename ToFieldType::NativeType min_result = -max_result; | 728 | | | 729 | 70 | ColumnUInt8::MutablePtr col_null_map_to; | 730 | 70 | NullMap::value_type* null_map_data = nullptr; | 731 | 70 | if (narrow_integral) { | 732 | 70 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 733 | 70 | null_map_data = col_null_map_to->get_data().data(); | 734 | 70 | } | 735 | | | 736 | 70 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 737 | 70 | const auto& vec_from = col_from->get_data(); | 738 | 70 | const auto* vec_from_data = vec_from.data(); | 739 | 70 | auto& vec_to = col_to->get_data(); | 740 | 70 | auto* vec_to_data = vec_to.data(); | 741 | | | 742 | 70 | CastParameters params; | 743 | 70 | params.is_strict = (CastMode == CastModeType::StrictMode); | 744 | 70 | size_t size = vec_from.size(); | 745 | | | 746 | 70 | RETURN_IF_ERROR(std::visit( | 747 | 70 | [&](auto multiply_may_overflow, auto narrow_integral) { | 748 | 70 | for (size_t i = 0; i < size; i++) { | 749 | 70 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 750 | 70 | typename ToDataType::FieldType, | 751 | 70 | multiply_may_overflow, narrow_integral>( | 752 | 70 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 753 | 70 | scale_multiplier, min_result, max_result, params)) { | 754 | 70 | if (set_nullable) { | 755 | 70 | null_map_data[i] = 1; | 756 | 70 | } else { | 757 | 70 | return params.status; | 758 | 70 | } | 759 | 70 | } | 760 | 70 | } | 761 | 70 | return Status::OK(); | 762 | 70 | }, | 763 | 70 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 764 | | | 765 | 14 | if (narrow_integral) { | 766 | 14 | block.get_by_position(result).column = | 767 | 14 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 768 | 14 | } else { | 769 | 0 | block.get_by_position(result).column = std::move(col_to); | 770 | 0 | } | 771 | 14 | return Status::OK(); | 772 | 70 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE7EEENS_15DataTypeDecimalILS3_28EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 686 | 28 | const NullMap::value_type* null_map = nullptr) const override { | 687 | 28 | using FromFieldType = typename FromDataType::FieldType; | 688 | 28 | using ToFieldType = typename ToDataType::FieldType; | 689 | 28 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 690 | 28 | const auto* col_from = | 691 | 28 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 692 | 28 | if (!col_from) { | 693 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 694 | 0 | named_from.column->get_name()); | 695 | 0 | } | 696 | | | 697 | 28 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 698 | 28 | constexpr UInt32 from_scale = 0; | 699 | | | 700 | 28 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 701 | 28 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 702 | 28 | UInt32 to_precision = to_decimal_type.get_precision(); | 703 | 28 | ToDataType::check_type_precision(to_precision); | 704 | 28 | UInt32 to_scale = to_decimal_type.get_scale(); | 705 | 28 | ToDataType::check_type_scale(to_scale); | 706 | | | 707 | 28 | auto from_max_int_digit_count = from_precision - from_scale; | 708 | 28 | auto to_max_int_digit_count = to_precision - to_scale; | 709 | | // may overflow. nullable result column. | 710 | 28 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 711 | | // only in non-strict mode and may overflow, we set nullable | 712 | 28 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 713 | | | 714 | 28 | constexpr UInt32 to_max_digits = | 715 | 28 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 716 | 28 | bool multiply_may_overflow = false; | 717 | 28 | if (to_scale > from_scale) { | 718 | 16 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 719 | 16 | } | 720 | 28 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 721 | 28 | sizeof(typename ToFieldType::NativeType)), | 722 | 28 | FromFieldType, typename ToFieldType::NativeType>; | 723 | 28 | MaxNativeType scale_multiplier = | 724 | 28 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 725 | 28 | typename ToFieldType::NativeType max_result = | 726 | 28 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 727 | 28 | typename ToFieldType::NativeType min_result = -max_result; | 728 | | | 729 | 28 | ColumnUInt8::MutablePtr col_null_map_to; | 730 | 28 | NullMap::value_type* null_map_data = nullptr; | 731 | 28 | if (narrow_integral) { | 732 | 28 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 733 | 28 | null_map_data = col_null_map_to->get_data().data(); | 734 | 28 | } | 735 | | | 736 | 28 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 737 | 28 | const auto& vec_from = col_from->get_data(); | 738 | 28 | const auto* vec_from_data = vec_from.data(); | 739 | 28 | auto& vec_to = col_to->get_data(); | 740 | 28 | auto* vec_to_data = vec_to.data(); | 741 | | | 742 | 28 | CastParameters params; | 743 | 28 | params.is_strict = (CastMode == CastModeType::StrictMode); | 744 | 28 | size_t size = vec_from.size(); | 745 | | | 746 | 28 | RETURN_IF_ERROR(std::visit( | 747 | 28 | [&](auto multiply_may_overflow, auto narrow_integral) { | 748 | 28 | for (size_t i = 0; i < size; i++) { | 749 | 28 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 750 | 28 | typename ToDataType::FieldType, | 751 | 28 | multiply_may_overflow, narrow_integral>( | 752 | 28 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 753 | 28 | scale_multiplier, min_result, max_result, params)) { | 754 | 28 | if (set_nullable) { | 755 | 28 | null_map_data[i] = 1; | 756 | 28 | } else { | 757 | 28 | return params.status; | 758 | 28 | } | 759 | 28 | } | 760 | 28 | } | 761 | 28 | return Status::OK(); | 762 | 28 | }, | 763 | 28 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 764 | | | 765 | 28 | if (narrow_integral) { | 766 | 28 | block.get_by_position(result).column = | 767 | 28 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 768 | 28 | } else { | 769 | 0 | block.get_by_position(result).column = std::move(col_to); | 770 | 0 | } | 771 | 28 | return Status::OK(); | 772 | 28 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE2EEENS_15DataTypeDecimalILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 686 | 4 | const NullMap::value_type* null_map = nullptr) const override { | 687 | 4 | using FromFieldType = typename FromDataType::FieldType; | 688 | 4 | using ToFieldType = typename ToDataType::FieldType; | 689 | 4 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 690 | 4 | const auto* col_from = | 691 | 4 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 692 | 4 | if (!col_from) { | 693 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 694 | 0 | named_from.column->get_name()); | 695 | 0 | } | 696 | | | 697 | 4 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 698 | 4 | constexpr UInt32 from_scale = 0; | 699 | | | 700 | 4 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 701 | 4 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 702 | 4 | UInt32 to_precision = to_decimal_type.get_precision(); | 703 | 4 | ToDataType::check_type_precision(to_precision); | 704 | 4 | UInt32 to_scale = to_decimal_type.get_scale(); | 705 | 4 | ToDataType::check_type_scale(to_scale); | 706 | | | 707 | 4 | auto from_max_int_digit_count = from_precision - from_scale; | 708 | 4 | auto to_max_int_digit_count = to_precision - to_scale; | 709 | | // may overflow. nullable result column. | 710 | 4 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 711 | | // only in non-strict mode and may overflow, we set nullable | 712 | 4 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 713 | | | 714 | 4 | constexpr UInt32 to_max_digits = | 715 | 4 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 716 | 4 | bool multiply_may_overflow = false; | 717 | 4 | if (to_scale > from_scale) { | 718 | 4 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 719 | 4 | } | 720 | 4 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 721 | 4 | sizeof(typename ToFieldType::NativeType)), | 722 | 4 | FromFieldType, typename ToFieldType::NativeType>; | 723 | 4 | MaxNativeType scale_multiplier = | 724 | 4 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 725 | 4 | typename ToFieldType::NativeType max_result = | 726 | 4 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 727 | 4 | typename ToFieldType::NativeType min_result = -max_result; | 728 | | | 729 | 4 | ColumnUInt8::MutablePtr col_null_map_to; | 730 | 4 | NullMap::value_type* null_map_data = nullptr; | 731 | 4 | if (narrow_integral) { | 732 | 4 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 733 | 4 | null_map_data = col_null_map_to->get_data().data(); | 734 | 4 | } | 735 | | | 736 | 4 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 737 | 4 | const auto& vec_from = col_from->get_data(); | 738 | 4 | const auto* vec_from_data = vec_from.data(); | 739 | 4 | auto& vec_to = col_to->get_data(); | 740 | 4 | auto* vec_to_data = vec_to.data(); | 741 | | | 742 | 4 | CastParameters params; | 743 | 4 | params.is_strict = (CastMode == CastModeType::StrictMode); | 744 | 4 | size_t size = vec_from.size(); | 745 | | | 746 | 4 | RETURN_IF_ERROR(std::visit( | 747 | 4 | [&](auto multiply_may_overflow, auto narrow_integral) { | 748 | 4 | for (size_t i = 0; i < size; i++) { | 749 | 4 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 750 | 4 | typename ToDataType::FieldType, | 751 | 4 | multiply_may_overflow, narrow_integral>( | 752 | 4 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 753 | 4 | scale_multiplier, min_result, max_result, params)) { | 754 | 4 | if (set_nullable) { | 755 | 4 | null_map_data[i] = 1; | 756 | 4 | } else { | 757 | 4 | return params.status; | 758 | 4 | } | 759 | 4 | } | 760 | 4 | } | 761 | 4 | return Status::OK(); | 762 | 4 | }, | 763 | 4 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 764 | | | 765 | 2 | if (narrow_integral) { | 766 | 2 | block.get_by_position(result).column = | 767 | 2 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 768 | 2 | } else { | 769 | 0 | block.get_by_position(result).column = std::move(col_to); | 770 | 0 | } | 771 | 2 | return Status::OK(); | 772 | 4 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE2EEENS_15DataTypeDecimalILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 686 | 10 | const NullMap::value_type* null_map = nullptr) const override { | 687 | 10 | using FromFieldType = typename FromDataType::FieldType; | 688 | 10 | using ToFieldType = typename ToDataType::FieldType; | 689 | 10 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 690 | 10 | const auto* col_from = | 691 | 10 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 692 | 10 | if (!col_from) { | 693 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 694 | 0 | named_from.column->get_name()); | 695 | 0 | } | 696 | | | 697 | 10 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 698 | 10 | constexpr UInt32 from_scale = 0; | 699 | | | 700 | 10 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 701 | 10 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 702 | 10 | UInt32 to_precision = to_decimal_type.get_precision(); | 703 | 10 | ToDataType::check_type_precision(to_precision); | 704 | 10 | UInt32 to_scale = to_decimal_type.get_scale(); | 705 | 10 | ToDataType::check_type_scale(to_scale); | 706 | | | 707 | 10 | auto from_max_int_digit_count = from_precision - from_scale; | 708 | 10 | auto to_max_int_digit_count = to_precision - to_scale; | 709 | | // may overflow. nullable result column. | 710 | 10 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 711 | | // only in non-strict mode and may overflow, we set nullable | 712 | 10 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 713 | | | 714 | 10 | constexpr UInt32 to_max_digits = | 715 | 10 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 716 | 10 | bool multiply_may_overflow = false; | 717 | 10 | if (to_scale > from_scale) { | 718 | 8 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 719 | 8 | } | 720 | 10 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 721 | 10 | sizeof(typename ToFieldType::NativeType)), | 722 | 10 | FromFieldType, typename ToFieldType::NativeType>; | 723 | 10 | MaxNativeType scale_multiplier = | 724 | 10 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 725 | 10 | typename ToFieldType::NativeType max_result = | 726 | 10 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 727 | 10 | typename ToFieldType::NativeType min_result = -max_result; | 728 | | | 729 | 10 | ColumnUInt8::MutablePtr col_null_map_to; | 730 | 10 | NullMap::value_type* null_map_data = nullptr; | 731 | 10 | if (narrow_integral) { | 732 | 2 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 733 | 2 | null_map_data = col_null_map_to->get_data().data(); | 734 | 2 | } | 735 | | | 736 | 10 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 737 | 10 | const auto& vec_from = col_from->get_data(); | 738 | 10 | const auto* vec_from_data = vec_from.data(); | 739 | 10 | auto& vec_to = col_to->get_data(); | 740 | 10 | auto* vec_to_data = vec_to.data(); | 741 | | | 742 | 10 | CastParameters params; | 743 | 10 | params.is_strict = (CastMode == CastModeType::StrictMode); | 744 | 10 | size_t size = vec_from.size(); | 745 | | | 746 | 10 | RETURN_IF_ERROR(std::visit( | 747 | 10 | [&](auto multiply_may_overflow, auto narrow_integral) { | 748 | 10 | for (size_t i = 0; i < size; i++) { | 749 | 10 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 750 | 10 | typename ToDataType::FieldType, | 751 | 10 | multiply_may_overflow, narrow_integral>( | 752 | 10 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 753 | 10 | scale_multiplier, min_result, max_result, params)) { | 754 | 10 | if (set_nullable) { | 755 | 10 | null_map_data[i] = 1; | 756 | 10 | } else { | 757 | 10 | return params.status; | 758 | 10 | } | 759 | 10 | } | 760 | 10 | } | 761 | 10 | return Status::OK(); | 762 | 10 | }, | 763 | 10 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 764 | | | 765 | 10 | if (narrow_integral) { | 766 | 2 | block.get_by_position(result).column = | 767 | 2 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 768 | 8 | } else { | 769 | 8 | block.get_by_position(result).column = std::move(col_to); | 770 | 8 | } | 771 | 10 | return Status::OK(); | 772 | 10 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE3EEENS_15DataTypeDecimalILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 686 | 38 | const NullMap::value_type* null_map = nullptr) const override { | 687 | 38 | using FromFieldType = typename FromDataType::FieldType; | 688 | 38 | using ToFieldType = typename ToDataType::FieldType; | 689 | 38 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 690 | 38 | const auto* col_from = | 691 | 38 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 692 | 38 | if (!col_from) { | 693 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 694 | 0 | named_from.column->get_name()); | 695 | 0 | } | 696 | | | 697 | 38 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 698 | 38 | constexpr UInt32 from_scale = 0; | 699 | | | 700 | 38 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 701 | 38 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 702 | 38 | UInt32 to_precision = to_decimal_type.get_precision(); | 703 | 38 | ToDataType::check_type_precision(to_precision); | 704 | 38 | UInt32 to_scale = to_decimal_type.get_scale(); | 705 | 38 | ToDataType::check_type_scale(to_scale); | 706 | | | 707 | 38 | auto from_max_int_digit_count = from_precision - from_scale; | 708 | 38 | auto to_max_int_digit_count = to_precision - to_scale; | 709 | | // may overflow. nullable result column. | 710 | 38 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 711 | | // only in non-strict mode and may overflow, we set nullable | 712 | 38 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 713 | | | 714 | 38 | constexpr UInt32 to_max_digits = | 715 | 38 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 716 | 38 | bool multiply_may_overflow = false; | 717 | 38 | if (to_scale > from_scale) { | 718 | 24 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 719 | 24 | } | 720 | 38 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 721 | 38 | sizeof(typename ToFieldType::NativeType)), | 722 | 38 | FromFieldType, typename ToFieldType::NativeType>; | 723 | 38 | MaxNativeType scale_multiplier = | 724 | 38 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 725 | 38 | typename ToFieldType::NativeType max_result = | 726 | 38 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 727 | 38 | typename ToFieldType::NativeType min_result = -max_result; | 728 | | | 729 | 38 | ColumnUInt8::MutablePtr col_null_map_to; | 730 | 38 | NullMap::value_type* null_map_data = nullptr; | 731 | 38 | if (narrow_integral) { | 732 | 30 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 733 | 30 | null_map_data = col_null_map_to->get_data().data(); | 734 | 30 | } | 735 | | | 736 | 38 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 737 | 38 | const auto& vec_from = col_from->get_data(); | 738 | 38 | const auto* vec_from_data = vec_from.data(); | 739 | 38 | auto& vec_to = col_to->get_data(); | 740 | 38 | auto* vec_to_data = vec_to.data(); | 741 | | | 742 | 38 | CastParameters params; | 743 | 38 | params.is_strict = (CastMode == CastModeType::StrictMode); | 744 | 38 | size_t size = vec_from.size(); | 745 | | | 746 | 38 | RETURN_IF_ERROR(std::visit( | 747 | 38 | [&](auto multiply_may_overflow, auto narrow_integral) { | 748 | 38 | for (size_t i = 0; i < size; i++) { | 749 | 38 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 750 | 38 | typename ToDataType::FieldType, | 751 | 38 | multiply_may_overflow, narrow_integral>( | 752 | 38 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 753 | 38 | scale_multiplier, min_result, max_result, params)) { | 754 | 38 | if (set_nullable) { | 755 | 38 | null_map_data[i] = 1; | 756 | 38 | } else { | 757 | 38 | return params.status; | 758 | 38 | } | 759 | 38 | } | 760 | 38 | } | 761 | 38 | return Status::OK(); | 762 | 38 | }, | 763 | 38 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 764 | | | 765 | 14 | if (narrow_integral) { | 766 | 6 | block.get_by_position(result).column = | 767 | 6 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 768 | 8 | } else { | 769 | 8 | block.get_by_position(result).column = std::move(col_to); | 770 | 8 | } | 771 | 14 | return Status::OK(); | 772 | 38 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE3EEENS_15DataTypeDecimalILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 686 | 20 | const NullMap::value_type* null_map = nullptr) const override { | 687 | 20 | using FromFieldType = typename FromDataType::FieldType; | 688 | 20 | using ToFieldType = typename ToDataType::FieldType; | 689 | 20 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 690 | 20 | const auto* col_from = | 691 | 20 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 692 | 20 | if (!col_from) { | 693 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 694 | 0 | named_from.column->get_name()); | 695 | 0 | } | 696 | | | 697 | 20 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 698 | 20 | constexpr UInt32 from_scale = 0; | 699 | | | 700 | 20 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 701 | 20 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 702 | 20 | UInt32 to_precision = to_decimal_type.get_precision(); | 703 | 20 | ToDataType::check_type_precision(to_precision); | 704 | 20 | UInt32 to_scale = to_decimal_type.get_scale(); | 705 | 20 | ToDataType::check_type_scale(to_scale); | 706 | | | 707 | 20 | auto from_max_int_digit_count = from_precision - from_scale; | 708 | 20 | auto to_max_int_digit_count = to_precision - to_scale; | 709 | | // may overflow. nullable result column. | 710 | 20 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 711 | | // only in non-strict mode and may overflow, we set nullable | 712 | 20 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 713 | | | 714 | 20 | constexpr UInt32 to_max_digits = | 715 | 20 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 716 | 20 | bool multiply_may_overflow = false; | 717 | 20 | if (to_scale > from_scale) { | 718 | 12 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 719 | 12 | } | 720 | 20 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 721 | 20 | sizeof(typename ToFieldType::NativeType)), | 722 | 20 | FromFieldType, typename ToFieldType::NativeType>; | 723 | 20 | MaxNativeType scale_multiplier = | 724 | 20 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 725 | 20 | typename ToFieldType::NativeType max_result = | 726 | 20 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 727 | 20 | typename ToFieldType::NativeType min_result = -max_result; | 728 | | | 729 | 20 | ColumnUInt8::MutablePtr col_null_map_to; | 730 | 20 | NullMap::value_type* null_map_data = nullptr; | 731 | 20 | if (narrow_integral) { | 732 | 12 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 733 | 12 | null_map_data = col_null_map_to->get_data().data(); | 734 | 12 | } | 735 | | | 736 | 20 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 737 | 20 | const auto& vec_from = col_from->get_data(); | 738 | 20 | const auto* vec_from_data = vec_from.data(); | 739 | 20 | auto& vec_to = col_to->get_data(); | 740 | 20 | auto* vec_to_data = vec_to.data(); | 741 | | | 742 | 20 | CastParameters params; | 743 | 20 | params.is_strict = (CastMode == CastModeType::StrictMode); | 744 | 20 | size_t size = vec_from.size(); | 745 | | | 746 | 20 | RETURN_IF_ERROR(std::visit( | 747 | 20 | [&](auto multiply_may_overflow, auto narrow_integral) { | 748 | 20 | for (size_t i = 0; i < size; i++) { | 749 | 20 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 750 | 20 | typename ToDataType::FieldType, | 751 | 20 | multiply_may_overflow, narrow_integral>( | 752 | 20 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 753 | 20 | scale_multiplier, min_result, max_result, params)) { | 754 | 20 | if (set_nullable) { | 755 | 20 | null_map_data[i] = 1; | 756 | 20 | } else { | 757 | 20 | return params.status; | 758 | 20 | } | 759 | 20 | } | 760 | 20 | } | 761 | 20 | return Status::OK(); | 762 | 20 | }, | 763 | 20 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 764 | | | 765 | 20 | if (narrow_integral) { | 766 | 12 | block.get_by_position(result).column = | 767 | 12 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 768 | 12 | } else { | 769 | 8 | block.get_by_position(result).column = std::move(col_to); | 770 | 8 | } | 771 | 20 | return Status::OK(); | 772 | 20 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE4EEENS_15DataTypeDecimalILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 686 | 38 | const NullMap::value_type* null_map = nullptr) const override { | 687 | 38 | using FromFieldType = typename FromDataType::FieldType; | 688 | 38 | using ToFieldType = typename ToDataType::FieldType; | 689 | 38 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 690 | 38 | const auto* col_from = | 691 | 38 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 692 | 38 | if (!col_from) { | 693 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 694 | 0 | named_from.column->get_name()); | 695 | 0 | } | 696 | | | 697 | 38 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 698 | 38 | constexpr UInt32 from_scale = 0; | 699 | | | 700 | 38 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 701 | 38 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 702 | 38 | UInt32 to_precision = to_decimal_type.get_precision(); | 703 | 38 | ToDataType::check_type_precision(to_precision); | 704 | 38 | UInt32 to_scale = to_decimal_type.get_scale(); | 705 | 38 | ToDataType::check_type_scale(to_scale); | 706 | | | 707 | 38 | auto from_max_int_digit_count = from_precision - from_scale; | 708 | 38 | auto to_max_int_digit_count = to_precision - to_scale; | 709 | | // may overflow. nullable result column. | 710 | 38 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 711 | | // only in non-strict mode and may overflow, we set nullable | 712 | 38 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 713 | | | 714 | 38 | constexpr UInt32 to_max_digits = | 715 | 38 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 716 | 38 | bool multiply_may_overflow = false; | 717 | 38 | if (to_scale > from_scale) { | 718 | 24 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 719 | 24 | } | 720 | 38 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 721 | 38 | sizeof(typename ToFieldType::NativeType)), | 722 | 38 | FromFieldType, typename ToFieldType::NativeType>; | 723 | 38 | MaxNativeType scale_multiplier = | 724 | 38 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 725 | 38 | typename ToFieldType::NativeType max_result = | 726 | 38 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 727 | 38 | typename ToFieldType::NativeType min_result = -max_result; | 728 | | | 729 | 38 | ColumnUInt8::MutablePtr col_null_map_to; | 730 | 38 | NullMap::value_type* null_map_data = nullptr; | 731 | 38 | if (narrow_integral) { | 732 | 30 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 733 | 30 | null_map_data = col_null_map_to->get_data().data(); | 734 | 30 | } | 735 | | | 736 | 38 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 737 | 38 | const auto& vec_from = col_from->get_data(); | 738 | 38 | const auto* vec_from_data = vec_from.data(); | 739 | 38 | auto& vec_to = col_to->get_data(); | 740 | 38 | auto* vec_to_data = vec_to.data(); | 741 | | | 742 | 38 | CastParameters params; | 743 | 38 | params.is_strict = (CastMode == CastModeType::StrictMode); | 744 | 38 | size_t size = vec_from.size(); | 745 | | | 746 | 38 | RETURN_IF_ERROR(std::visit( | 747 | 38 | [&](auto multiply_may_overflow, auto narrow_integral) { | 748 | 38 | for (size_t i = 0; i < size; i++) { | 749 | 38 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 750 | 38 | typename ToDataType::FieldType, | 751 | 38 | multiply_may_overflow, narrow_integral>( | 752 | 38 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 753 | 38 | scale_multiplier, min_result, max_result, params)) { | 754 | 38 | if (set_nullable) { | 755 | 38 | null_map_data[i] = 1; | 756 | 38 | } else { | 757 | 38 | return params.status; | 758 | 38 | } | 759 | 38 | } | 760 | 38 | } | 761 | 38 | return Status::OK(); | 762 | 38 | }, | 763 | 38 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 764 | | | 765 | 14 | if (narrow_integral) { | 766 | 6 | block.get_by_position(result).column = | 767 | 6 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 768 | 8 | } else { | 769 | 8 | block.get_by_position(result).column = std::move(col_to); | 770 | 8 | } | 771 | 14 | return Status::OK(); | 772 | 38 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE4EEENS_15DataTypeDecimalILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 686 | 20 | const NullMap::value_type* null_map = nullptr) const override { | 687 | 20 | using FromFieldType = typename FromDataType::FieldType; | 688 | 20 | using ToFieldType = typename ToDataType::FieldType; | 689 | 20 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 690 | 20 | const auto* col_from = | 691 | 20 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 692 | 20 | if (!col_from) { | 693 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 694 | 0 | named_from.column->get_name()); | 695 | 0 | } | 696 | | | 697 | 20 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 698 | 20 | constexpr UInt32 from_scale = 0; | 699 | | | 700 | 20 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 701 | 20 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 702 | 20 | UInt32 to_precision = to_decimal_type.get_precision(); | 703 | 20 | ToDataType::check_type_precision(to_precision); | 704 | 20 | UInt32 to_scale = to_decimal_type.get_scale(); | 705 | 20 | ToDataType::check_type_scale(to_scale); | 706 | | | 707 | 20 | auto from_max_int_digit_count = from_precision - from_scale; | 708 | 20 | auto to_max_int_digit_count = to_precision - to_scale; | 709 | | // may overflow. nullable result column. | 710 | 20 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 711 | | // only in non-strict mode and may overflow, we set nullable | 712 | 20 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 713 | | | 714 | 20 | constexpr UInt32 to_max_digits = | 715 | 20 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 716 | 20 | bool multiply_may_overflow = false; | 717 | 20 | if (to_scale > from_scale) { | 718 | 12 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 719 | 12 | } | 720 | 20 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 721 | 20 | sizeof(typename ToFieldType::NativeType)), | 722 | 20 | FromFieldType, typename ToFieldType::NativeType>; | 723 | 20 | MaxNativeType scale_multiplier = | 724 | 20 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 725 | 20 | typename ToFieldType::NativeType max_result = | 726 | 20 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 727 | 20 | typename ToFieldType::NativeType min_result = -max_result; | 728 | | | 729 | 20 | ColumnUInt8::MutablePtr col_null_map_to; | 730 | 20 | NullMap::value_type* null_map_data = nullptr; | 731 | 20 | if (narrow_integral) { | 732 | 12 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 733 | 12 | null_map_data = col_null_map_to->get_data().data(); | 734 | 12 | } | 735 | | | 736 | 20 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 737 | 20 | const auto& vec_from = col_from->get_data(); | 738 | 20 | const auto* vec_from_data = vec_from.data(); | 739 | 20 | auto& vec_to = col_to->get_data(); | 740 | 20 | auto* vec_to_data = vec_to.data(); | 741 | | | 742 | 20 | CastParameters params; | 743 | 20 | params.is_strict = (CastMode == CastModeType::StrictMode); | 744 | 20 | size_t size = vec_from.size(); | 745 | | | 746 | 20 | RETURN_IF_ERROR(std::visit( | 747 | 20 | [&](auto multiply_may_overflow, auto narrow_integral) { | 748 | 20 | for (size_t i = 0; i < size; i++) { | 749 | 20 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 750 | 20 | typename ToDataType::FieldType, | 751 | 20 | multiply_may_overflow, narrow_integral>( | 752 | 20 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 753 | 20 | scale_multiplier, min_result, max_result, params)) { | 754 | 20 | if (set_nullable) { | 755 | 20 | null_map_data[i] = 1; | 756 | 20 | } else { | 757 | 20 | return params.status; | 758 | 20 | } | 759 | 20 | } | 760 | 20 | } | 761 | 20 | return Status::OK(); | 762 | 20 | }, | 763 | 20 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 764 | | | 765 | 20 | if (narrow_integral) { | 766 | 12 | block.get_by_position(result).column = | 767 | 12 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 768 | 12 | } else { | 769 | 8 | block.get_by_position(result).column = std::move(col_to); | 770 | 8 | } | 771 | 20 | return Status::OK(); | 772 | 20 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE5EEENS_15DataTypeDecimalILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 686 | 62 | const NullMap::value_type* null_map = nullptr) const override { | 687 | 62 | using FromFieldType = typename FromDataType::FieldType; | 688 | 62 | using ToFieldType = typename ToDataType::FieldType; | 689 | 62 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 690 | 62 | const auto* col_from = | 691 | 62 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 692 | 62 | if (!col_from) { | 693 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 694 | 0 | named_from.column->get_name()); | 695 | 0 | } | 696 | | | 697 | 62 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 698 | 62 | constexpr UInt32 from_scale = 0; | 699 | | | 700 | 62 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 701 | 62 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 702 | 62 | UInt32 to_precision = to_decimal_type.get_precision(); | 703 | 62 | ToDataType::check_type_precision(to_precision); | 704 | 62 | UInt32 to_scale = to_decimal_type.get_scale(); | 705 | 62 | ToDataType::check_type_scale(to_scale); | 706 | | | 707 | 62 | auto from_max_int_digit_count = from_precision - from_scale; | 708 | 62 | auto to_max_int_digit_count = to_precision - to_scale; | 709 | | // may overflow. nullable result column. | 710 | 62 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 711 | | // only in non-strict mode and may overflow, we set nullable | 712 | 62 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 713 | | | 714 | 62 | constexpr UInt32 to_max_digits = | 715 | 62 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 716 | 62 | bool multiply_may_overflow = false; | 717 | 62 | if (to_scale > from_scale) { | 718 | 40 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 719 | 40 | } | 720 | 62 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 721 | 62 | sizeof(typename ToFieldType::NativeType)), | 722 | 62 | FromFieldType, typename ToFieldType::NativeType>; | 723 | 62 | MaxNativeType scale_multiplier = | 724 | 62 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 725 | 62 | typename ToFieldType::NativeType max_result = | 726 | 62 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 727 | 62 | typename ToFieldType::NativeType min_result = -max_result; | 728 | | | 729 | 62 | ColumnUInt8::MutablePtr col_null_map_to; | 730 | 62 | NullMap::value_type* null_map_data = nullptr; | 731 | 62 | if (narrow_integral) { | 732 | 60 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 733 | 60 | null_map_data = col_null_map_to->get_data().data(); | 734 | 60 | } | 735 | | | 736 | 62 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 737 | 62 | const auto& vec_from = col_from->get_data(); | 738 | 62 | const auto* vec_from_data = vec_from.data(); | 739 | 62 | auto& vec_to = col_to->get_data(); | 740 | 62 | auto* vec_to_data = vec_to.data(); | 741 | | | 742 | 62 | CastParameters params; | 743 | 62 | params.is_strict = (CastMode == CastModeType::StrictMode); | 744 | 62 | size_t size = vec_from.size(); | 745 | | | 746 | 62 | RETURN_IF_ERROR(std::visit( | 747 | 62 | [&](auto multiply_may_overflow, auto narrow_integral) { | 748 | 62 | for (size_t i = 0; i < size; i++) { | 749 | 62 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 750 | 62 | typename ToDataType::FieldType, | 751 | 62 | multiply_may_overflow, narrow_integral>( | 752 | 62 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 753 | 62 | scale_multiplier, min_result, max_result, params)) { | 754 | 62 | if (set_nullable) { | 755 | 62 | null_map_data[i] = 1; | 756 | 62 | } else { | 757 | 62 | return params.status; | 758 | 62 | } | 759 | 62 | } | 760 | 62 | } | 761 | 62 | return Status::OK(); | 762 | 62 | }, | 763 | 62 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 764 | | | 765 | 14 | if (narrow_integral) { | 766 | 12 | block.get_by_position(result).column = | 767 | 12 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 768 | 12 | } else { | 769 | 2 | block.get_by_position(result).column = std::move(col_to); | 770 | 2 | } | 771 | 14 | return Status::OK(); | 772 | 62 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE5EEENS_15DataTypeDecimalILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 686 | 26 | const NullMap::value_type* null_map = nullptr) const override { | 687 | 26 | using FromFieldType = typename FromDataType::FieldType; | 688 | 26 | using ToFieldType = typename ToDataType::FieldType; | 689 | 26 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 690 | 26 | const auto* col_from = | 691 | 26 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 692 | 26 | if (!col_from) { | 693 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 694 | 0 | named_from.column->get_name()); | 695 | 0 | } | 696 | | | 697 | 26 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 698 | 26 | constexpr UInt32 from_scale = 0; | 699 | | | 700 | 26 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 701 | 26 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 702 | 26 | UInt32 to_precision = to_decimal_type.get_precision(); | 703 | 26 | ToDataType::check_type_precision(to_precision); | 704 | 26 | UInt32 to_scale = to_decimal_type.get_scale(); | 705 | 26 | ToDataType::check_type_scale(to_scale); | 706 | | | 707 | 26 | auto from_max_int_digit_count = from_precision - from_scale; | 708 | 26 | auto to_max_int_digit_count = to_precision - to_scale; | 709 | | // may overflow. nullable result column. | 710 | 26 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 711 | | // only in non-strict mode and may overflow, we set nullable | 712 | 26 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 713 | | | 714 | 26 | constexpr UInt32 to_max_digits = | 715 | 26 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 716 | 26 | bool multiply_may_overflow = false; | 717 | 26 | if (to_scale > from_scale) { | 718 | 16 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 719 | 16 | } | 720 | 26 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 721 | 26 | sizeof(typename ToFieldType::NativeType)), | 722 | 26 | FromFieldType, typename ToFieldType::NativeType>; | 723 | 26 | MaxNativeType scale_multiplier = | 724 | 26 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 725 | 26 | typename ToFieldType::NativeType max_result = | 726 | 26 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 727 | 26 | typename ToFieldType::NativeType min_result = -max_result; | 728 | | | 729 | 26 | ColumnUInt8::MutablePtr col_null_map_to; | 730 | 26 | NullMap::value_type* null_map_data = nullptr; | 731 | 26 | if (narrow_integral) { | 732 | 24 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 733 | 24 | null_map_data = col_null_map_to->get_data().data(); | 734 | 24 | } | 735 | | | 736 | 26 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 737 | 26 | const auto& vec_from = col_from->get_data(); | 738 | 26 | const auto* vec_from_data = vec_from.data(); | 739 | 26 | auto& vec_to = col_to->get_data(); | 740 | 26 | auto* vec_to_data = vec_to.data(); | 741 | | | 742 | 26 | CastParameters params; | 743 | 26 | params.is_strict = (CastMode == CastModeType::StrictMode); | 744 | 26 | size_t size = vec_from.size(); | 745 | | | 746 | 26 | RETURN_IF_ERROR(std::visit( | 747 | 26 | [&](auto multiply_may_overflow, auto narrow_integral) { | 748 | 26 | for (size_t i = 0; i < size; i++) { | 749 | 26 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 750 | 26 | typename ToDataType::FieldType, | 751 | 26 | multiply_may_overflow, narrow_integral>( | 752 | 26 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 753 | 26 | scale_multiplier, min_result, max_result, params)) { | 754 | 26 | if (set_nullable) { | 755 | 26 | null_map_data[i] = 1; | 756 | 26 | } else { | 757 | 26 | return params.status; | 758 | 26 | } | 759 | 26 | } | 760 | 26 | } | 761 | 26 | return Status::OK(); | 762 | 26 | }, | 763 | 26 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 764 | | | 765 | 26 | if (narrow_integral) { | 766 | 24 | block.get_by_position(result).column = | 767 | 24 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 768 | 24 | } else { | 769 | 2 | block.get_by_position(result).column = std::move(col_to); | 770 | 2 | } | 771 | 26 | return Status::OK(); | 772 | 26 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE6EEENS_15DataTypeDecimalILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 686 | 70 | const NullMap::value_type* null_map = nullptr) const override { | 687 | 70 | using FromFieldType = typename FromDataType::FieldType; | 688 | 70 | using ToFieldType = typename ToDataType::FieldType; | 689 | 70 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 690 | 70 | const auto* col_from = | 691 | 70 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 692 | 70 | if (!col_from) { | 693 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 694 | 0 | named_from.column->get_name()); | 695 | 0 | } | 696 | | | 697 | 70 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 698 | 70 | constexpr UInt32 from_scale = 0; | 699 | | | 700 | 70 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 701 | 70 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 702 | 70 | UInt32 to_precision = to_decimal_type.get_precision(); | 703 | 70 | ToDataType::check_type_precision(to_precision); | 704 | 70 | UInt32 to_scale = to_decimal_type.get_scale(); | 705 | 70 | ToDataType::check_type_scale(to_scale); | 706 | | | 707 | 70 | auto from_max_int_digit_count = from_precision - from_scale; | 708 | 70 | auto to_max_int_digit_count = to_precision - to_scale; | 709 | | // may overflow. nullable result column. | 710 | 70 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 711 | | // only in non-strict mode and may overflow, we set nullable | 712 | 70 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 713 | | | 714 | 70 | constexpr UInt32 to_max_digits = | 715 | 70 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 716 | 70 | bool multiply_may_overflow = false; | 717 | 70 | if (to_scale > from_scale) { | 718 | 40 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 719 | 40 | } | 720 | 70 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 721 | 70 | sizeof(typename ToFieldType::NativeType)), | 722 | 70 | FromFieldType, typename ToFieldType::NativeType>; | 723 | 70 | MaxNativeType scale_multiplier = | 724 | 70 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 725 | 70 | typename ToFieldType::NativeType max_result = | 726 | 70 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 727 | 70 | typename ToFieldType::NativeType min_result = -max_result; | 728 | | | 729 | 70 | ColumnUInt8::MutablePtr col_null_map_to; | 730 | 70 | NullMap::value_type* null_map_data = nullptr; | 731 | 70 | if (narrow_integral) { | 732 | 70 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 733 | 70 | null_map_data = col_null_map_to->get_data().data(); | 734 | 70 | } | 735 | | | 736 | 70 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 737 | 70 | const auto& vec_from = col_from->get_data(); | 738 | 70 | const auto* vec_from_data = vec_from.data(); | 739 | 70 | auto& vec_to = col_to->get_data(); | 740 | 70 | auto* vec_to_data = vec_to.data(); | 741 | | | 742 | 70 | CastParameters params; | 743 | 70 | params.is_strict = (CastMode == CastModeType::StrictMode); | 744 | 70 | size_t size = vec_from.size(); | 745 | | | 746 | 70 | RETURN_IF_ERROR(std::visit( | 747 | 70 | [&](auto multiply_may_overflow, auto narrow_integral) { | 748 | 70 | for (size_t i = 0; i < size; i++) { | 749 | 70 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 750 | 70 | typename ToDataType::FieldType, | 751 | 70 | multiply_may_overflow, narrow_integral>( | 752 | 70 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 753 | 70 | scale_multiplier, min_result, max_result, params)) { | 754 | 70 | if (set_nullable) { | 755 | 70 | null_map_data[i] = 1; | 756 | 70 | } else { | 757 | 70 | return params.status; | 758 | 70 | } | 759 | 70 | } | 760 | 70 | } | 761 | 70 | return Status::OK(); | 762 | 70 | }, | 763 | 70 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 764 | | | 765 | 14 | if (narrow_integral) { | 766 | 14 | block.get_by_position(result).column = | 767 | 14 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 768 | 14 | } else { | 769 | 0 | block.get_by_position(result).column = std::move(col_to); | 770 | 0 | } | 771 | 14 | return Status::OK(); | 772 | 70 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE6EEENS_15DataTypeDecimalILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 686 | 28 | const NullMap::value_type* null_map = nullptr) const override { | 687 | 28 | using FromFieldType = typename FromDataType::FieldType; | 688 | 28 | using ToFieldType = typename ToDataType::FieldType; | 689 | 28 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 690 | 28 | const auto* col_from = | 691 | 28 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 692 | 28 | if (!col_from) { | 693 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 694 | 0 | named_from.column->get_name()); | 695 | 0 | } | 696 | | | 697 | 28 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 698 | 28 | constexpr UInt32 from_scale = 0; | 699 | | | 700 | 28 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 701 | 28 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 702 | 28 | UInt32 to_precision = to_decimal_type.get_precision(); | 703 | 28 | ToDataType::check_type_precision(to_precision); | 704 | 28 | UInt32 to_scale = to_decimal_type.get_scale(); | 705 | 28 | ToDataType::check_type_scale(to_scale); | 706 | | | 707 | 28 | auto from_max_int_digit_count = from_precision - from_scale; | 708 | 28 | auto to_max_int_digit_count = to_precision - to_scale; | 709 | | // may overflow. nullable result column. | 710 | 28 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 711 | | // only in non-strict mode and may overflow, we set nullable | 712 | 28 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 713 | | | 714 | 28 | constexpr UInt32 to_max_digits = | 715 | 28 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 716 | 28 | bool multiply_may_overflow = false; | 717 | 28 | if (to_scale > from_scale) { | 718 | 16 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 719 | 16 | } | 720 | 28 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 721 | 28 | sizeof(typename ToFieldType::NativeType)), | 722 | 28 | FromFieldType, typename ToFieldType::NativeType>; | 723 | 28 | MaxNativeType scale_multiplier = | 724 | 28 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 725 | 28 | typename ToFieldType::NativeType max_result = | 726 | 28 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 727 | 28 | typename ToFieldType::NativeType min_result = -max_result; | 728 | | | 729 | 28 | ColumnUInt8::MutablePtr col_null_map_to; | 730 | 28 | NullMap::value_type* null_map_data = nullptr; | 731 | 28 | if (narrow_integral) { | 732 | 28 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 733 | 28 | null_map_data = col_null_map_to->get_data().data(); | 734 | 28 | } | 735 | | | 736 | 28 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 737 | 28 | const auto& vec_from = col_from->get_data(); | 738 | 28 | const auto* vec_from_data = vec_from.data(); | 739 | 28 | auto& vec_to = col_to->get_data(); | 740 | 28 | auto* vec_to_data = vec_to.data(); | 741 | | | 742 | 28 | CastParameters params; | 743 | 28 | params.is_strict = (CastMode == CastModeType::StrictMode); | 744 | 28 | size_t size = vec_from.size(); | 745 | | | 746 | 28 | RETURN_IF_ERROR(std::visit( | 747 | 28 | [&](auto multiply_may_overflow, auto narrow_integral) { | 748 | 28 | for (size_t i = 0; i < size; i++) { | 749 | 28 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 750 | 28 | typename ToDataType::FieldType, | 751 | 28 | multiply_may_overflow, narrow_integral>( | 752 | 28 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 753 | 28 | scale_multiplier, min_result, max_result, params)) { | 754 | 28 | if (set_nullable) { | 755 | 28 | null_map_data[i] = 1; | 756 | 28 | } else { | 757 | 28 | return params.status; | 758 | 28 | } | 759 | 28 | } | 760 | 28 | } | 761 | 28 | return Status::OK(); | 762 | 28 | }, | 763 | 28 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 764 | | | 765 | 28 | if (narrow_integral) { | 766 | 28 | block.get_by_position(result).column = | 767 | 28 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 768 | 28 | } else { | 769 | 0 | block.get_by_position(result).column = std::move(col_to); | 770 | 0 | } | 771 | 28 | return Status::OK(); | 772 | 28 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE7EEENS_15DataTypeDecimalILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 686 | 70 | const NullMap::value_type* null_map = nullptr) const override { | 687 | 70 | using FromFieldType = typename FromDataType::FieldType; | 688 | 70 | using ToFieldType = typename ToDataType::FieldType; | 689 | 70 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 690 | 70 | const auto* col_from = | 691 | 70 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 692 | 70 | if (!col_from) { | 693 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 694 | 0 | named_from.column->get_name()); | 695 | 0 | } | 696 | | | 697 | 70 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 698 | 70 | constexpr UInt32 from_scale = 0; | 699 | | | 700 | 70 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 701 | 70 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 702 | 70 | UInt32 to_precision = to_decimal_type.get_precision(); | 703 | 70 | ToDataType::check_type_precision(to_precision); | 704 | 70 | UInt32 to_scale = to_decimal_type.get_scale(); | 705 | 70 | ToDataType::check_type_scale(to_scale); | 706 | | | 707 | 70 | auto from_max_int_digit_count = from_precision - from_scale; | 708 | 70 | auto to_max_int_digit_count = to_precision - to_scale; | 709 | | // may overflow. nullable result column. | 710 | 70 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 711 | | // only in non-strict mode and may overflow, we set nullable | 712 | 70 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 713 | | | 714 | 70 | constexpr UInt32 to_max_digits = | 715 | 70 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 716 | 70 | bool multiply_may_overflow = false; | 717 | 70 | if (to_scale > from_scale) { | 718 | 40 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 719 | 40 | } | 720 | 70 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 721 | 70 | sizeof(typename ToFieldType::NativeType)), | 722 | 70 | FromFieldType, typename ToFieldType::NativeType>; | 723 | 70 | MaxNativeType scale_multiplier = | 724 | 70 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 725 | 70 | typename ToFieldType::NativeType max_result = | 726 | 70 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 727 | 70 | typename ToFieldType::NativeType min_result = -max_result; | 728 | | | 729 | 70 | ColumnUInt8::MutablePtr col_null_map_to; | 730 | 70 | NullMap::value_type* null_map_data = nullptr; | 731 | 70 | if (narrow_integral) { | 732 | 70 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 733 | 70 | null_map_data = col_null_map_to->get_data().data(); | 734 | 70 | } | 735 | | | 736 | 70 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 737 | 70 | const auto& vec_from = col_from->get_data(); | 738 | 70 | const auto* vec_from_data = vec_from.data(); | 739 | 70 | auto& vec_to = col_to->get_data(); | 740 | 70 | auto* vec_to_data = vec_to.data(); | 741 | | | 742 | 70 | CastParameters params; | 743 | 70 | params.is_strict = (CastMode == CastModeType::StrictMode); | 744 | 70 | size_t size = vec_from.size(); | 745 | | | 746 | 70 | RETURN_IF_ERROR(std::visit( | 747 | 70 | [&](auto multiply_may_overflow, auto narrow_integral) { | 748 | 70 | for (size_t i = 0; i < size; i++) { | 749 | 70 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 750 | 70 | typename ToDataType::FieldType, | 751 | 70 | multiply_may_overflow, narrow_integral>( | 752 | 70 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 753 | 70 | scale_multiplier, min_result, max_result, params)) { | 754 | 70 | if (set_nullable) { | 755 | 70 | null_map_data[i] = 1; | 756 | 70 | } else { | 757 | 70 | return params.status; | 758 | 70 | } | 759 | 70 | } | 760 | 70 | } | 761 | 70 | return Status::OK(); | 762 | 70 | }, | 763 | 70 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 764 | | | 765 | 14 | if (narrow_integral) { | 766 | 14 | block.get_by_position(result).column = | 767 | 14 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 768 | 14 | } else { | 769 | 0 | block.get_by_position(result).column = std::move(col_to); | 770 | 0 | } | 771 | 14 | return Status::OK(); | 772 | 70 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE7EEENS_15DataTypeDecimalILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 686 | 28 | const NullMap::value_type* null_map = nullptr) const override { | 687 | 28 | using FromFieldType = typename FromDataType::FieldType; | 688 | 28 | using ToFieldType = typename ToDataType::FieldType; | 689 | 28 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 690 | 28 | const auto* col_from = | 691 | 28 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 692 | 28 | if (!col_from) { | 693 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 694 | 0 | named_from.column->get_name()); | 695 | 0 | } | 696 | | | 697 | 28 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 698 | 28 | constexpr UInt32 from_scale = 0; | 699 | | | 700 | 28 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 701 | 28 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 702 | 28 | UInt32 to_precision = to_decimal_type.get_precision(); | 703 | 28 | ToDataType::check_type_precision(to_precision); | 704 | 28 | UInt32 to_scale = to_decimal_type.get_scale(); | 705 | 28 | ToDataType::check_type_scale(to_scale); | 706 | | | 707 | 28 | auto from_max_int_digit_count = from_precision - from_scale; | 708 | 28 | auto to_max_int_digit_count = to_precision - to_scale; | 709 | | // may overflow. nullable result column. | 710 | 28 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 711 | | // only in non-strict mode and may overflow, we set nullable | 712 | 28 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 713 | | | 714 | 28 | constexpr UInt32 to_max_digits = | 715 | 28 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 716 | 28 | bool multiply_may_overflow = false; | 717 | 28 | if (to_scale > from_scale) { | 718 | 16 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 719 | 16 | } | 720 | 28 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 721 | 28 | sizeof(typename ToFieldType::NativeType)), | 722 | 28 | FromFieldType, typename ToFieldType::NativeType>; | 723 | 28 | MaxNativeType scale_multiplier = | 724 | 28 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 725 | 28 | typename ToFieldType::NativeType max_result = | 726 | 28 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 727 | 28 | typename ToFieldType::NativeType min_result = -max_result; | 728 | | | 729 | 28 | ColumnUInt8::MutablePtr col_null_map_to; | 730 | 28 | NullMap::value_type* null_map_data = nullptr; | 731 | 28 | if (narrow_integral) { | 732 | 28 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 733 | 28 | null_map_data = col_null_map_to->get_data().data(); | 734 | 28 | } | 735 | | | 736 | 28 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 737 | 28 | const auto& vec_from = col_from->get_data(); | 738 | 28 | const auto* vec_from_data = vec_from.data(); | 739 | 28 | auto& vec_to = col_to->get_data(); | 740 | 28 | auto* vec_to_data = vec_to.data(); | 741 | | | 742 | 28 | CastParameters params; | 743 | 28 | params.is_strict = (CastMode == CastModeType::StrictMode); | 744 | 28 | size_t size = vec_from.size(); | 745 | | | 746 | 28 | RETURN_IF_ERROR(std::visit( | 747 | 28 | [&](auto multiply_may_overflow, auto narrow_integral) { | 748 | 28 | for (size_t i = 0; i < size; i++) { | 749 | 28 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 750 | 28 | typename ToDataType::FieldType, | 751 | 28 | multiply_may_overflow, narrow_integral>( | 752 | 28 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 753 | 28 | scale_multiplier, min_result, max_result, params)) { | 754 | 28 | if (set_nullable) { | 755 | 28 | null_map_data[i] = 1; | 756 | 28 | } else { | 757 | 28 | return params.status; | 758 | 28 | } | 759 | 28 | } | 760 | 28 | } | 761 | 28 | return Status::OK(); | 762 | 28 | }, | 763 | 28 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 764 | | | 765 | 28 | if (narrow_integral) { | 766 | 28 | block.get_by_position(result).column = | 767 | 28 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 768 | 28 | } else { | 769 | 0 | block.get_by_position(result).column = std::move(col_to); | 770 | 0 | } | 771 | 28 | return Status::OK(); | 772 | 28 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE2EEENS_15DataTypeDecimalILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 686 | 4 | const NullMap::value_type* null_map = nullptr) const override { | 687 | 4 | using FromFieldType = typename FromDataType::FieldType; | 688 | 4 | using ToFieldType = typename ToDataType::FieldType; | 689 | 4 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 690 | 4 | const auto* col_from = | 691 | 4 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 692 | 4 | if (!col_from) { | 693 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 694 | 0 | named_from.column->get_name()); | 695 | 0 | } | 696 | | | 697 | 4 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 698 | 4 | constexpr UInt32 from_scale = 0; | 699 | | | 700 | 4 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 701 | 4 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 702 | 4 | UInt32 to_precision = to_decimal_type.get_precision(); | 703 | 4 | ToDataType::check_type_precision(to_precision); | 704 | 4 | UInt32 to_scale = to_decimal_type.get_scale(); | 705 | 4 | ToDataType::check_type_scale(to_scale); | 706 | | | 707 | 4 | auto from_max_int_digit_count = from_precision - from_scale; | 708 | 4 | auto to_max_int_digit_count = to_precision - to_scale; | 709 | | // may overflow. nullable result column. | 710 | 4 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 711 | | // only in non-strict mode and may overflow, we set nullable | 712 | 4 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 713 | | | 714 | 4 | constexpr UInt32 to_max_digits = | 715 | 4 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 716 | 4 | bool multiply_may_overflow = false; | 717 | 4 | if (to_scale > from_scale) { | 718 | 4 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 719 | 4 | } | 720 | 4 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 721 | 4 | sizeof(typename ToFieldType::NativeType)), | 722 | 4 | FromFieldType, typename ToFieldType::NativeType>; | 723 | 4 | MaxNativeType scale_multiplier = | 724 | 4 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 725 | 4 | typename ToFieldType::NativeType max_result = | 726 | 4 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 727 | 4 | typename ToFieldType::NativeType min_result = -max_result; | 728 | | | 729 | 4 | ColumnUInt8::MutablePtr col_null_map_to; | 730 | 4 | NullMap::value_type* null_map_data = nullptr; | 731 | 4 | if (narrow_integral) { | 732 | 4 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 733 | 4 | null_map_data = col_null_map_to->get_data().data(); | 734 | 4 | } | 735 | | | 736 | 4 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 737 | 4 | const auto& vec_from = col_from->get_data(); | 738 | 4 | const auto* vec_from_data = vec_from.data(); | 739 | 4 | auto& vec_to = col_to->get_data(); | 740 | 4 | auto* vec_to_data = vec_to.data(); | 741 | | | 742 | 4 | CastParameters params; | 743 | 4 | params.is_strict = (CastMode == CastModeType::StrictMode); | 744 | 4 | size_t size = vec_from.size(); | 745 | | | 746 | 4 | RETURN_IF_ERROR(std::visit( | 747 | 4 | [&](auto multiply_may_overflow, auto narrow_integral) { | 748 | 4 | for (size_t i = 0; i < size; i++) { | 749 | 4 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 750 | 4 | typename ToDataType::FieldType, | 751 | 4 | multiply_may_overflow, narrow_integral>( | 752 | 4 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 753 | 4 | scale_multiplier, min_result, max_result, params)) { | 754 | 4 | if (set_nullable) { | 755 | 4 | null_map_data[i] = 1; | 756 | 4 | } else { | 757 | 4 | return params.status; | 758 | 4 | } | 759 | 4 | } | 760 | 4 | } | 761 | 4 | return Status::OK(); | 762 | 4 | }, | 763 | 4 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 764 | | | 765 | 2 | if (narrow_integral) { | 766 | 2 | block.get_by_position(result).column = | 767 | 2 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 768 | 2 | } else { | 769 | 0 | block.get_by_position(result).column = std::move(col_to); | 770 | 0 | } | 771 | 2 | return Status::OK(); | 772 | 4 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE2EEENS_15DataTypeDecimalILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 686 | 10 | const NullMap::value_type* null_map = nullptr) const override { | 687 | 10 | using FromFieldType = typename FromDataType::FieldType; | 688 | 10 | using ToFieldType = typename ToDataType::FieldType; | 689 | 10 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 690 | 10 | const auto* col_from = | 691 | 10 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 692 | 10 | if (!col_from) { | 693 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 694 | 0 | named_from.column->get_name()); | 695 | 0 | } | 696 | | | 697 | 10 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 698 | 10 | constexpr UInt32 from_scale = 0; | 699 | | | 700 | 10 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 701 | 10 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 702 | 10 | UInt32 to_precision = to_decimal_type.get_precision(); | 703 | 10 | ToDataType::check_type_precision(to_precision); | 704 | 10 | UInt32 to_scale = to_decimal_type.get_scale(); | 705 | 10 | ToDataType::check_type_scale(to_scale); | 706 | | | 707 | 10 | auto from_max_int_digit_count = from_precision - from_scale; | 708 | 10 | auto to_max_int_digit_count = to_precision - to_scale; | 709 | | // may overflow. nullable result column. | 710 | 10 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 711 | | // only in non-strict mode and may overflow, we set nullable | 712 | 10 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 713 | | | 714 | 10 | constexpr UInt32 to_max_digits = | 715 | 10 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 716 | 10 | bool multiply_may_overflow = false; | 717 | 10 | if (to_scale > from_scale) { | 718 | 8 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 719 | 8 | } | 720 | 10 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 721 | 10 | sizeof(typename ToFieldType::NativeType)), | 722 | 10 | FromFieldType, typename ToFieldType::NativeType>; | 723 | 10 | MaxNativeType scale_multiplier = | 724 | 10 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 725 | 10 | typename ToFieldType::NativeType max_result = | 726 | 10 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 727 | 10 | typename ToFieldType::NativeType min_result = -max_result; | 728 | | | 729 | 10 | ColumnUInt8::MutablePtr col_null_map_to; | 730 | 10 | NullMap::value_type* null_map_data = nullptr; | 731 | 10 | if (narrow_integral) { | 732 | 2 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 733 | 2 | null_map_data = col_null_map_to->get_data().data(); | 734 | 2 | } | 735 | | | 736 | 10 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 737 | 10 | const auto& vec_from = col_from->get_data(); | 738 | 10 | const auto* vec_from_data = vec_from.data(); | 739 | 10 | auto& vec_to = col_to->get_data(); | 740 | 10 | auto* vec_to_data = vec_to.data(); | 741 | | | 742 | 10 | CastParameters params; | 743 | 10 | params.is_strict = (CastMode == CastModeType::StrictMode); | 744 | 10 | size_t size = vec_from.size(); | 745 | | | 746 | 10 | RETURN_IF_ERROR(std::visit( | 747 | 10 | [&](auto multiply_may_overflow, auto narrow_integral) { | 748 | 10 | for (size_t i = 0; i < size; i++) { | 749 | 10 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 750 | 10 | typename ToDataType::FieldType, | 751 | 10 | multiply_may_overflow, narrow_integral>( | 752 | 10 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 753 | 10 | scale_multiplier, min_result, max_result, params)) { | 754 | 10 | if (set_nullable) { | 755 | 10 | null_map_data[i] = 1; | 756 | 10 | } else { | 757 | 10 | return params.status; | 758 | 10 | } | 759 | 10 | } | 760 | 10 | } | 761 | 10 | return Status::OK(); | 762 | 10 | }, | 763 | 10 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 764 | | | 765 | 10 | if (narrow_integral) { | 766 | 2 | block.get_by_position(result).column = | 767 | 2 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 768 | 8 | } else { | 769 | 8 | block.get_by_position(result).column = std::move(col_to); | 770 | 8 | } | 771 | 10 | return Status::OK(); | 772 | 10 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE3EEENS_15DataTypeDecimalILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 686 | 38 | const NullMap::value_type* null_map = nullptr) const override { | 687 | 38 | using FromFieldType = typename FromDataType::FieldType; | 688 | 38 | using ToFieldType = typename ToDataType::FieldType; | 689 | 38 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 690 | 38 | const auto* col_from = | 691 | 38 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 692 | 38 | if (!col_from) { | 693 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 694 | 0 | named_from.column->get_name()); | 695 | 0 | } | 696 | | | 697 | 38 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 698 | 38 | constexpr UInt32 from_scale = 0; | 699 | | | 700 | 38 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 701 | 38 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 702 | 38 | UInt32 to_precision = to_decimal_type.get_precision(); | 703 | 38 | ToDataType::check_type_precision(to_precision); | 704 | 38 | UInt32 to_scale = to_decimal_type.get_scale(); | 705 | 38 | ToDataType::check_type_scale(to_scale); | 706 | | | 707 | 38 | auto from_max_int_digit_count = from_precision - from_scale; | 708 | 38 | auto to_max_int_digit_count = to_precision - to_scale; | 709 | | // may overflow. nullable result column. | 710 | 38 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 711 | | // only in non-strict mode and may overflow, we set nullable | 712 | 38 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 713 | | | 714 | 38 | constexpr UInt32 to_max_digits = | 715 | 38 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 716 | 38 | bool multiply_may_overflow = false; | 717 | 38 | if (to_scale > from_scale) { | 718 | 24 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 719 | 24 | } | 720 | 38 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 721 | 38 | sizeof(typename ToFieldType::NativeType)), | 722 | 38 | FromFieldType, typename ToFieldType::NativeType>; | 723 | 38 | MaxNativeType scale_multiplier = | 724 | 38 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 725 | 38 | typename ToFieldType::NativeType max_result = | 726 | 38 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 727 | 38 | typename ToFieldType::NativeType min_result = -max_result; | 728 | | | 729 | 38 | ColumnUInt8::MutablePtr col_null_map_to; | 730 | 38 | NullMap::value_type* null_map_data = nullptr; | 731 | 38 | if (narrow_integral) { | 732 | 30 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 733 | 30 | null_map_data = col_null_map_to->get_data().data(); | 734 | 30 | } | 735 | | | 736 | 38 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 737 | 38 | const auto& vec_from = col_from->get_data(); | 738 | 38 | const auto* vec_from_data = vec_from.data(); | 739 | 38 | auto& vec_to = col_to->get_data(); | 740 | 38 | auto* vec_to_data = vec_to.data(); | 741 | | | 742 | 38 | CastParameters params; | 743 | 38 | params.is_strict = (CastMode == CastModeType::StrictMode); | 744 | 38 | size_t size = vec_from.size(); | 745 | | | 746 | 38 | RETURN_IF_ERROR(std::visit( | 747 | 38 | [&](auto multiply_may_overflow, auto narrow_integral) { | 748 | 38 | for (size_t i = 0; i < size; i++) { | 749 | 38 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 750 | 38 | typename ToDataType::FieldType, | 751 | 38 | multiply_may_overflow, narrow_integral>( | 752 | 38 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 753 | 38 | scale_multiplier, min_result, max_result, params)) { | 754 | 38 | if (set_nullable) { | 755 | 38 | null_map_data[i] = 1; | 756 | 38 | } else { | 757 | 38 | return params.status; | 758 | 38 | } | 759 | 38 | } | 760 | 38 | } | 761 | 38 | return Status::OK(); | 762 | 38 | }, | 763 | 38 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 764 | | | 765 | 14 | if (narrow_integral) { | 766 | 6 | block.get_by_position(result).column = | 767 | 6 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 768 | 8 | } else { | 769 | 8 | block.get_by_position(result).column = std::move(col_to); | 770 | 8 | } | 771 | 14 | return Status::OK(); | 772 | 38 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE3EEENS_15DataTypeDecimalILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 686 | 20 | const NullMap::value_type* null_map = nullptr) const override { | 687 | 20 | using FromFieldType = typename FromDataType::FieldType; | 688 | 20 | using ToFieldType = typename ToDataType::FieldType; | 689 | 20 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 690 | 20 | const auto* col_from = | 691 | 20 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 692 | 20 | if (!col_from) { | 693 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 694 | 0 | named_from.column->get_name()); | 695 | 0 | } | 696 | | | 697 | 20 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 698 | 20 | constexpr UInt32 from_scale = 0; | 699 | | | 700 | 20 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 701 | 20 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 702 | 20 | UInt32 to_precision = to_decimal_type.get_precision(); | 703 | 20 | ToDataType::check_type_precision(to_precision); | 704 | 20 | UInt32 to_scale = to_decimal_type.get_scale(); | 705 | 20 | ToDataType::check_type_scale(to_scale); | 706 | | | 707 | 20 | auto from_max_int_digit_count = from_precision - from_scale; | 708 | 20 | auto to_max_int_digit_count = to_precision - to_scale; | 709 | | // may overflow. nullable result column. | 710 | 20 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 711 | | // only in non-strict mode and may overflow, we set nullable | 712 | 20 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 713 | | | 714 | 20 | constexpr UInt32 to_max_digits = | 715 | 20 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 716 | 20 | bool multiply_may_overflow = false; | 717 | 20 | if (to_scale > from_scale) { | 718 | 12 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 719 | 12 | } | 720 | 20 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 721 | 20 | sizeof(typename ToFieldType::NativeType)), | 722 | 20 | FromFieldType, typename ToFieldType::NativeType>; | 723 | 20 | MaxNativeType scale_multiplier = | 724 | 20 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 725 | 20 | typename ToFieldType::NativeType max_result = | 726 | 20 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 727 | 20 | typename ToFieldType::NativeType min_result = -max_result; | 728 | | | 729 | 20 | ColumnUInt8::MutablePtr col_null_map_to; | 730 | 20 | NullMap::value_type* null_map_data = nullptr; | 731 | 20 | if (narrow_integral) { | 732 | 12 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 733 | 12 | null_map_data = col_null_map_to->get_data().data(); | 734 | 12 | } | 735 | | | 736 | 20 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 737 | 20 | const auto& vec_from = col_from->get_data(); | 738 | 20 | const auto* vec_from_data = vec_from.data(); | 739 | 20 | auto& vec_to = col_to->get_data(); | 740 | 20 | auto* vec_to_data = vec_to.data(); | 741 | | | 742 | 20 | CastParameters params; | 743 | 20 | params.is_strict = (CastMode == CastModeType::StrictMode); | 744 | 20 | size_t size = vec_from.size(); | 745 | | | 746 | 20 | RETURN_IF_ERROR(std::visit( | 747 | 20 | [&](auto multiply_may_overflow, auto narrow_integral) { | 748 | 20 | for (size_t i = 0; i < size; i++) { | 749 | 20 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 750 | 20 | typename ToDataType::FieldType, | 751 | 20 | multiply_may_overflow, narrow_integral>( | 752 | 20 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 753 | 20 | scale_multiplier, min_result, max_result, params)) { | 754 | 20 | if (set_nullable) { | 755 | 20 | null_map_data[i] = 1; | 756 | 20 | } else { | 757 | 20 | return params.status; | 758 | 20 | } | 759 | 20 | } | 760 | 20 | } | 761 | 20 | return Status::OK(); | 762 | 20 | }, | 763 | 20 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 764 | | | 765 | 20 | if (narrow_integral) { | 766 | 12 | block.get_by_position(result).column = | 767 | 12 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 768 | 12 | } else { | 769 | 8 | block.get_by_position(result).column = std::move(col_to); | 770 | 8 | } | 771 | 20 | return Status::OK(); | 772 | 20 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE4EEENS_15DataTypeDecimalILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 686 | 38 | const NullMap::value_type* null_map = nullptr) const override { | 687 | 38 | using FromFieldType = typename FromDataType::FieldType; | 688 | 38 | using ToFieldType = typename ToDataType::FieldType; | 689 | 38 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 690 | 38 | const auto* col_from = | 691 | 38 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 692 | 38 | if (!col_from) { | 693 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 694 | 0 | named_from.column->get_name()); | 695 | 0 | } | 696 | | | 697 | 38 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 698 | 38 | constexpr UInt32 from_scale = 0; | 699 | | | 700 | 38 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 701 | 38 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 702 | 38 | UInt32 to_precision = to_decimal_type.get_precision(); | 703 | 38 | ToDataType::check_type_precision(to_precision); | 704 | 38 | UInt32 to_scale = to_decimal_type.get_scale(); | 705 | 38 | ToDataType::check_type_scale(to_scale); | 706 | | | 707 | 38 | auto from_max_int_digit_count = from_precision - from_scale; | 708 | 38 | auto to_max_int_digit_count = to_precision - to_scale; | 709 | | // may overflow. nullable result column. | 710 | 38 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 711 | | // only in non-strict mode and may overflow, we set nullable | 712 | 38 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 713 | | | 714 | 38 | constexpr UInt32 to_max_digits = | 715 | 38 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 716 | 38 | bool multiply_may_overflow = false; | 717 | 38 | if (to_scale > from_scale) { | 718 | 24 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 719 | 24 | } | 720 | 38 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 721 | 38 | sizeof(typename ToFieldType::NativeType)), | 722 | 38 | FromFieldType, typename ToFieldType::NativeType>; | 723 | 38 | MaxNativeType scale_multiplier = | 724 | 38 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 725 | 38 | typename ToFieldType::NativeType max_result = | 726 | 38 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 727 | 38 | typename ToFieldType::NativeType min_result = -max_result; | 728 | | | 729 | 38 | ColumnUInt8::MutablePtr col_null_map_to; | 730 | 38 | NullMap::value_type* null_map_data = nullptr; | 731 | 38 | if (narrow_integral) { | 732 | 30 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 733 | 30 | null_map_data = col_null_map_to->get_data().data(); | 734 | 30 | } | 735 | | | 736 | 38 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 737 | 38 | const auto& vec_from = col_from->get_data(); | 738 | 38 | const auto* vec_from_data = vec_from.data(); | 739 | 38 | auto& vec_to = col_to->get_data(); | 740 | 38 | auto* vec_to_data = vec_to.data(); | 741 | | | 742 | 38 | CastParameters params; | 743 | 38 | params.is_strict = (CastMode == CastModeType::StrictMode); | 744 | 38 | size_t size = vec_from.size(); | 745 | | | 746 | 38 | RETURN_IF_ERROR(std::visit( | 747 | 38 | [&](auto multiply_may_overflow, auto narrow_integral) { | 748 | 38 | for (size_t i = 0; i < size; i++) { | 749 | 38 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 750 | 38 | typename ToDataType::FieldType, | 751 | 38 | multiply_may_overflow, narrow_integral>( | 752 | 38 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 753 | 38 | scale_multiplier, min_result, max_result, params)) { | 754 | 38 | if (set_nullable) { | 755 | 38 | null_map_data[i] = 1; | 756 | 38 | } else { | 757 | 38 | return params.status; | 758 | 38 | } | 759 | 38 | } | 760 | 38 | } | 761 | 38 | return Status::OK(); | 762 | 38 | }, | 763 | 38 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 764 | | | 765 | 14 | if (narrow_integral) { | 766 | 6 | block.get_by_position(result).column = | 767 | 6 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 768 | 8 | } else { | 769 | 8 | block.get_by_position(result).column = std::move(col_to); | 770 | 8 | } | 771 | 14 | return Status::OK(); | 772 | 38 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE4EEENS_15DataTypeDecimalILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 686 | 20 | const NullMap::value_type* null_map = nullptr) const override { | 687 | 20 | using FromFieldType = typename FromDataType::FieldType; | 688 | 20 | using ToFieldType = typename ToDataType::FieldType; | 689 | 20 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 690 | 20 | const auto* col_from = | 691 | 20 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 692 | 20 | if (!col_from) { | 693 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 694 | 0 | named_from.column->get_name()); | 695 | 0 | } | 696 | | | 697 | 20 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 698 | 20 | constexpr UInt32 from_scale = 0; | 699 | | | 700 | 20 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 701 | 20 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 702 | 20 | UInt32 to_precision = to_decimal_type.get_precision(); | 703 | 20 | ToDataType::check_type_precision(to_precision); | 704 | 20 | UInt32 to_scale = to_decimal_type.get_scale(); | 705 | 20 | ToDataType::check_type_scale(to_scale); | 706 | | | 707 | 20 | auto from_max_int_digit_count = from_precision - from_scale; | 708 | 20 | auto to_max_int_digit_count = to_precision - to_scale; | 709 | | // may overflow. nullable result column. | 710 | 20 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 711 | | // only in non-strict mode and may overflow, we set nullable | 712 | 20 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 713 | | | 714 | 20 | constexpr UInt32 to_max_digits = | 715 | 20 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 716 | 20 | bool multiply_may_overflow = false; | 717 | 20 | if (to_scale > from_scale) { | 718 | 12 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 719 | 12 | } | 720 | 20 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 721 | 20 | sizeof(typename ToFieldType::NativeType)), | 722 | 20 | FromFieldType, typename ToFieldType::NativeType>; | 723 | 20 | MaxNativeType scale_multiplier = | 724 | 20 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 725 | 20 | typename ToFieldType::NativeType max_result = | 726 | 20 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 727 | 20 | typename ToFieldType::NativeType min_result = -max_result; | 728 | | | 729 | 20 | ColumnUInt8::MutablePtr col_null_map_to; | 730 | 20 | NullMap::value_type* null_map_data = nullptr; | 731 | 20 | if (narrow_integral) { | 732 | 12 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 733 | 12 | null_map_data = col_null_map_to->get_data().data(); | 734 | 12 | } | 735 | | | 736 | 20 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 737 | 20 | const auto& vec_from = col_from->get_data(); | 738 | 20 | const auto* vec_from_data = vec_from.data(); | 739 | 20 | auto& vec_to = col_to->get_data(); | 740 | 20 | auto* vec_to_data = vec_to.data(); | 741 | | | 742 | 20 | CastParameters params; | 743 | 20 | params.is_strict = (CastMode == CastModeType::StrictMode); | 744 | 20 | size_t size = vec_from.size(); | 745 | | | 746 | 20 | RETURN_IF_ERROR(std::visit( | 747 | 20 | [&](auto multiply_may_overflow, auto narrow_integral) { | 748 | 20 | for (size_t i = 0; i < size; i++) { | 749 | 20 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 750 | 20 | typename ToDataType::FieldType, | 751 | 20 | multiply_may_overflow, narrow_integral>( | 752 | 20 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 753 | 20 | scale_multiplier, min_result, max_result, params)) { | 754 | 20 | if (set_nullable) { | 755 | 20 | null_map_data[i] = 1; | 756 | 20 | } else { | 757 | 20 | return params.status; | 758 | 20 | } | 759 | 20 | } | 760 | 20 | } | 761 | 20 | return Status::OK(); | 762 | 20 | }, | 763 | 20 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 764 | | | 765 | 20 | if (narrow_integral) { | 766 | 12 | block.get_by_position(result).column = | 767 | 12 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 768 | 12 | } else { | 769 | 8 | block.get_by_position(result).column = std::move(col_to); | 770 | 8 | } | 771 | 20 | return Status::OK(); | 772 | 20 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE5EEENS_15DataTypeDecimalILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 686 | 38 | const NullMap::value_type* null_map = nullptr) const override { | 687 | 38 | using FromFieldType = typename FromDataType::FieldType; | 688 | 38 | using ToFieldType = typename ToDataType::FieldType; | 689 | 38 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 690 | 38 | const auto* col_from = | 691 | 38 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 692 | 38 | if (!col_from) { | 693 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 694 | 0 | named_from.column->get_name()); | 695 | 0 | } | 696 | | | 697 | 38 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 698 | 38 | constexpr UInt32 from_scale = 0; | 699 | | | 700 | 38 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 701 | 38 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 702 | 38 | UInt32 to_precision = to_decimal_type.get_precision(); | 703 | 38 | ToDataType::check_type_precision(to_precision); | 704 | 38 | UInt32 to_scale = to_decimal_type.get_scale(); | 705 | 38 | ToDataType::check_type_scale(to_scale); | 706 | | | 707 | 38 | auto from_max_int_digit_count = from_precision - from_scale; | 708 | 38 | auto to_max_int_digit_count = to_precision - to_scale; | 709 | | // may overflow. nullable result column. | 710 | 38 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 711 | | // only in non-strict mode and may overflow, we set nullable | 712 | 38 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 713 | | | 714 | 38 | constexpr UInt32 to_max_digits = | 715 | 38 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 716 | 38 | bool multiply_may_overflow = false; | 717 | 38 | if (to_scale > from_scale) { | 718 | 24 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 719 | 24 | } | 720 | 38 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 721 | 38 | sizeof(typename ToFieldType::NativeType)), | 722 | 38 | FromFieldType, typename ToFieldType::NativeType>; | 723 | 38 | MaxNativeType scale_multiplier = | 724 | 38 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 725 | 38 | typename ToFieldType::NativeType max_result = | 726 | 38 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 727 | 38 | typename ToFieldType::NativeType min_result = -max_result; | 728 | | | 729 | 38 | ColumnUInt8::MutablePtr col_null_map_to; | 730 | 38 | NullMap::value_type* null_map_data = nullptr; | 731 | 38 | if (narrow_integral) { | 732 | 30 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 733 | 30 | null_map_data = col_null_map_to->get_data().data(); | 734 | 30 | } | 735 | | | 736 | 38 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 737 | 38 | const auto& vec_from = col_from->get_data(); | 738 | 38 | const auto* vec_from_data = vec_from.data(); | 739 | 38 | auto& vec_to = col_to->get_data(); | 740 | 38 | auto* vec_to_data = vec_to.data(); | 741 | | | 742 | 38 | CastParameters params; | 743 | 38 | params.is_strict = (CastMode == CastModeType::StrictMode); | 744 | 38 | size_t size = vec_from.size(); | 745 | | | 746 | 38 | RETURN_IF_ERROR(std::visit( | 747 | 38 | [&](auto multiply_may_overflow, auto narrow_integral) { | 748 | 38 | for (size_t i = 0; i < size; i++) { | 749 | 38 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 750 | 38 | typename ToDataType::FieldType, | 751 | 38 | multiply_may_overflow, narrow_integral>( | 752 | 38 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 753 | 38 | scale_multiplier, min_result, max_result, params)) { | 754 | 38 | if (set_nullable) { | 755 | 38 | null_map_data[i] = 1; | 756 | 38 | } else { | 757 | 38 | return params.status; | 758 | 38 | } | 759 | 38 | } | 760 | 38 | } | 761 | 38 | return Status::OK(); | 762 | 38 | }, | 763 | 38 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 764 | | | 765 | 14 | if (narrow_integral) { | 766 | 6 | block.get_by_position(result).column = | 767 | 6 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 768 | 8 | } else { | 769 | 8 | block.get_by_position(result).column = std::move(col_to); | 770 | 8 | } | 771 | 14 | return Status::OK(); | 772 | 38 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE5EEENS_15DataTypeDecimalILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 686 | 20 | const NullMap::value_type* null_map = nullptr) const override { | 687 | 20 | using FromFieldType = typename FromDataType::FieldType; | 688 | 20 | using ToFieldType = typename ToDataType::FieldType; | 689 | 20 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 690 | 20 | const auto* col_from = | 691 | 20 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 692 | 20 | if (!col_from) { | 693 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 694 | 0 | named_from.column->get_name()); | 695 | 0 | } | 696 | | | 697 | 20 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 698 | 20 | constexpr UInt32 from_scale = 0; | 699 | | | 700 | 20 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 701 | 20 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 702 | 20 | UInt32 to_precision = to_decimal_type.get_precision(); | 703 | 20 | ToDataType::check_type_precision(to_precision); | 704 | 20 | UInt32 to_scale = to_decimal_type.get_scale(); | 705 | 20 | ToDataType::check_type_scale(to_scale); | 706 | | | 707 | 20 | auto from_max_int_digit_count = from_precision - from_scale; | 708 | 20 | auto to_max_int_digit_count = to_precision - to_scale; | 709 | | // may overflow. nullable result column. | 710 | 20 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 711 | | // only in non-strict mode and may overflow, we set nullable | 712 | 20 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 713 | | | 714 | 20 | constexpr UInt32 to_max_digits = | 715 | 20 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 716 | 20 | bool multiply_may_overflow = false; | 717 | 20 | if (to_scale > from_scale) { | 718 | 12 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 719 | 12 | } | 720 | 20 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 721 | 20 | sizeof(typename ToFieldType::NativeType)), | 722 | 20 | FromFieldType, typename ToFieldType::NativeType>; | 723 | 20 | MaxNativeType scale_multiplier = | 724 | 20 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 725 | 20 | typename ToFieldType::NativeType max_result = | 726 | 20 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 727 | 20 | typename ToFieldType::NativeType min_result = -max_result; | 728 | | | 729 | 20 | ColumnUInt8::MutablePtr col_null_map_to; | 730 | 20 | NullMap::value_type* null_map_data = nullptr; | 731 | 20 | if (narrow_integral) { | 732 | 12 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 733 | 12 | null_map_data = col_null_map_to->get_data().data(); | 734 | 12 | } | 735 | | | 736 | 20 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 737 | 20 | const auto& vec_from = col_from->get_data(); | 738 | 20 | const auto* vec_from_data = vec_from.data(); | 739 | 20 | auto& vec_to = col_to->get_data(); | 740 | 20 | auto* vec_to_data = vec_to.data(); | 741 | | | 742 | 20 | CastParameters params; | 743 | 20 | params.is_strict = (CastMode == CastModeType::StrictMode); | 744 | 20 | size_t size = vec_from.size(); | 745 | | | 746 | 20 | RETURN_IF_ERROR(std::visit( | 747 | 20 | [&](auto multiply_may_overflow, auto narrow_integral) { | 748 | 20 | for (size_t i = 0; i < size; i++) { | 749 | 20 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 750 | 20 | typename ToDataType::FieldType, | 751 | 20 | multiply_may_overflow, narrow_integral>( | 752 | 20 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 753 | 20 | scale_multiplier, min_result, max_result, params)) { | 754 | 20 | if (set_nullable) { | 755 | 20 | null_map_data[i] = 1; | 756 | 20 | } else { | 757 | 20 | return params.status; | 758 | 20 | } | 759 | 20 | } | 760 | 20 | } | 761 | 20 | return Status::OK(); | 762 | 20 | }, | 763 | 20 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 764 | | | 765 | 20 | if (narrow_integral) { | 766 | 12 | block.get_by_position(result).column = | 767 | 12 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 768 | 12 | } else { | 769 | 8 | block.get_by_position(result).column = std::move(col_to); | 770 | 8 | } | 771 | 20 | return Status::OK(); | 772 | 20 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE6EEENS_15DataTypeDecimalILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 686 | 46 | const NullMap::value_type* null_map = nullptr) const override { | 687 | 46 | using FromFieldType = typename FromDataType::FieldType; | 688 | 46 | using ToFieldType = typename ToDataType::FieldType; | 689 | 46 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 690 | 46 | const auto* col_from = | 691 | 46 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 692 | 46 | if (!col_from) { | 693 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 694 | 0 | named_from.column->get_name()); | 695 | 0 | } | 696 | | | 697 | 46 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 698 | 46 | constexpr UInt32 from_scale = 0; | 699 | | | 700 | 46 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 701 | 46 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 702 | 46 | UInt32 to_precision = to_decimal_type.get_precision(); | 703 | 46 | ToDataType::check_type_precision(to_precision); | 704 | 46 | UInt32 to_scale = to_decimal_type.get_scale(); | 705 | 46 | ToDataType::check_type_scale(to_scale); | 706 | | | 707 | 46 | auto from_max_int_digit_count = from_precision - from_scale; | 708 | 46 | auto to_max_int_digit_count = to_precision - to_scale; | 709 | | // may overflow. nullable result column. | 710 | 46 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 711 | | // only in non-strict mode and may overflow, we set nullable | 712 | 46 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 713 | | | 714 | 46 | constexpr UInt32 to_max_digits = | 715 | 46 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 716 | 46 | bool multiply_may_overflow = false; | 717 | 46 | if (to_scale > from_scale) { | 718 | 32 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 719 | 32 | } | 720 | 46 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 721 | 46 | sizeof(typename ToFieldType::NativeType)), | 722 | 46 | FromFieldType, typename ToFieldType::NativeType>; | 723 | 46 | MaxNativeType scale_multiplier = | 724 | 46 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 725 | 46 | typename ToFieldType::NativeType max_result = | 726 | 46 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 727 | 46 | typename ToFieldType::NativeType min_result = -max_result; | 728 | | | 729 | 46 | ColumnUInt8::MutablePtr col_null_map_to; | 730 | 46 | NullMap::value_type* null_map_data = nullptr; | 731 | 46 | if (narrow_integral) { | 732 | 40 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 733 | 40 | null_map_data = col_null_map_to->get_data().data(); | 734 | 40 | } | 735 | | | 736 | 46 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 737 | 46 | const auto& vec_from = col_from->get_data(); | 738 | 46 | const auto* vec_from_data = vec_from.data(); | 739 | 46 | auto& vec_to = col_to->get_data(); | 740 | 46 | auto* vec_to_data = vec_to.data(); | 741 | | | 742 | 46 | CastParameters params; | 743 | 46 | params.is_strict = (CastMode == CastModeType::StrictMode); | 744 | 46 | size_t size = vec_from.size(); | 745 | | | 746 | 46 | RETURN_IF_ERROR(std::visit( | 747 | 46 | [&](auto multiply_may_overflow, auto narrow_integral) { | 748 | 46 | for (size_t i = 0; i < size; i++) { | 749 | 46 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 750 | 46 | typename ToDataType::FieldType, | 751 | 46 | multiply_may_overflow, narrow_integral>( | 752 | 46 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 753 | 46 | scale_multiplier, min_result, max_result, params)) { | 754 | 46 | if (set_nullable) { | 755 | 46 | null_map_data[i] = 1; | 756 | 46 | } else { | 757 | 46 | return params.status; | 758 | 46 | } | 759 | 46 | } | 760 | 46 | } | 761 | 46 | return Status::OK(); | 762 | 46 | }, | 763 | 46 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 764 | | | 765 | 14 | if (narrow_integral) { | 766 | 8 | block.get_by_position(result).column = | 767 | 8 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 768 | 8 | } else { | 769 | 6 | block.get_by_position(result).column = std::move(col_to); | 770 | 6 | } | 771 | 14 | return Status::OK(); | 772 | 46 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE6EEENS_15DataTypeDecimalILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 686 | 22 | const NullMap::value_type* null_map = nullptr) const override { | 687 | 22 | using FromFieldType = typename FromDataType::FieldType; | 688 | 22 | using ToFieldType = typename ToDataType::FieldType; | 689 | 22 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 690 | 22 | const auto* col_from = | 691 | 22 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 692 | 22 | if (!col_from) { | 693 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 694 | 0 | named_from.column->get_name()); | 695 | 0 | } | 696 | | | 697 | 22 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 698 | 22 | constexpr UInt32 from_scale = 0; | 699 | | | 700 | 22 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 701 | 22 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 702 | 22 | UInt32 to_precision = to_decimal_type.get_precision(); | 703 | 22 | ToDataType::check_type_precision(to_precision); | 704 | 22 | UInt32 to_scale = to_decimal_type.get_scale(); | 705 | 22 | ToDataType::check_type_scale(to_scale); | 706 | | | 707 | 22 | auto from_max_int_digit_count = from_precision - from_scale; | 708 | 22 | auto to_max_int_digit_count = to_precision - to_scale; | 709 | | // may overflow. nullable result column. | 710 | 22 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 711 | | // only in non-strict mode and may overflow, we set nullable | 712 | 22 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 713 | | | 714 | 22 | constexpr UInt32 to_max_digits = | 715 | 22 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 716 | 22 | bool multiply_may_overflow = false; | 717 | 22 | if (to_scale > from_scale) { | 718 | 14 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 719 | 14 | } | 720 | 22 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 721 | 22 | sizeof(typename ToFieldType::NativeType)), | 722 | 22 | FromFieldType, typename ToFieldType::NativeType>; | 723 | 22 | MaxNativeType scale_multiplier = | 724 | 22 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 725 | 22 | typename ToFieldType::NativeType max_result = | 726 | 22 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 727 | 22 | typename ToFieldType::NativeType min_result = -max_result; | 728 | | | 729 | 22 | ColumnUInt8::MutablePtr col_null_map_to; | 730 | 22 | NullMap::value_type* null_map_data = nullptr; | 731 | 22 | if (narrow_integral) { | 732 | 16 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 733 | 16 | null_map_data = col_null_map_to->get_data().data(); | 734 | 16 | } | 735 | | | 736 | 22 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 737 | 22 | const auto& vec_from = col_from->get_data(); | 738 | 22 | const auto* vec_from_data = vec_from.data(); | 739 | 22 | auto& vec_to = col_to->get_data(); | 740 | 22 | auto* vec_to_data = vec_to.data(); | 741 | | | 742 | 22 | CastParameters params; | 743 | 22 | params.is_strict = (CastMode == CastModeType::StrictMode); | 744 | 22 | size_t size = vec_from.size(); | 745 | | | 746 | 22 | RETURN_IF_ERROR(std::visit( | 747 | 22 | [&](auto multiply_may_overflow, auto narrow_integral) { | 748 | 22 | for (size_t i = 0; i < size; i++) { | 749 | 22 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 750 | 22 | typename ToDataType::FieldType, | 751 | 22 | multiply_may_overflow, narrow_integral>( | 752 | 22 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 753 | 22 | scale_multiplier, min_result, max_result, params)) { | 754 | 22 | if (set_nullable) { | 755 | 22 | null_map_data[i] = 1; | 756 | 22 | } else { | 757 | 22 | return params.status; | 758 | 22 | } | 759 | 22 | } | 760 | 22 | } | 761 | 22 | return Status::OK(); | 762 | 22 | }, | 763 | 22 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 764 | | | 765 | 22 | if (narrow_integral) { | 766 | 16 | block.get_by_position(result).column = | 767 | 16 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 768 | 16 | } else { | 769 | 6 | block.get_by_position(result).column = std::move(col_to); | 770 | 6 | } | 771 | 22 | return Status::OK(); | 772 | 22 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE7EEENS_15DataTypeDecimalILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 686 | 70 | const NullMap::value_type* null_map = nullptr) const override { | 687 | 70 | using FromFieldType = typename FromDataType::FieldType; | 688 | 70 | using ToFieldType = typename ToDataType::FieldType; | 689 | 70 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 690 | 70 | const auto* col_from = | 691 | 70 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 692 | 70 | if (!col_from) { | 693 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 694 | 0 | named_from.column->get_name()); | 695 | 0 | } | 696 | | | 697 | 70 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 698 | 70 | constexpr UInt32 from_scale = 0; | 699 | | | 700 | 70 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 701 | 70 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 702 | 70 | UInt32 to_precision = to_decimal_type.get_precision(); | 703 | 70 | ToDataType::check_type_precision(to_precision); | 704 | 70 | UInt32 to_scale = to_decimal_type.get_scale(); | 705 | 70 | ToDataType::check_type_scale(to_scale); | 706 | | | 707 | 70 | auto from_max_int_digit_count = from_precision - from_scale; | 708 | 70 | auto to_max_int_digit_count = to_precision - to_scale; | 709 | | // may overflow. nullable result column. | 710 | 70 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 711 | | // only in non-strict mode and may overflow, we set nullable | 712 | 70 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 713 | | | 714 | 70 | constexpr UInt32 to_max_digits = | 715 | 70 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 716 | 70 | bool multiply_may_overflow = false; | 717 | 70 | if (to_scale > from_scale) { | 718 | 40 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 719 | 40 | } | 720 | 70 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 721 | 70 | sizeof(typename ToFieldType::NativeType)), | 722 | 70 | FromFieldType, typename ToFieldType::NativeType>; | 723 | 70 | MaxNativeType scale_multiplier = | 724 | 70 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 725 | 70 | typename ToFieldType::NativeType max_result = | 726 | 70 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 727 | 70 | typename ToFieldType::NativeType min_result = -max_result; | 728 | | | 729 | 70 | ColumnUInt8::MutablePtr col_null_map_to; | 730 | 70 | NullMap::value_type* null_map_data = nullptr; | 731 | 70 | if (narrow_integral) { | 732 | 70 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 733 | 70 | null_map_data = col_null_map_to->get_data().data(); | 734 | 70 | } | 735 | | | 736 | 70 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 737 | 70 | const auto& vec_from = col_from->get_data(); | 738 | 70 | const auto* vec_from_data = vec_from.data(); | 739 | 70 | auto& vec_to = col_to->get_data(); | 740 | 70 | auto* vec_to_data = vec_to.data(); | 741 | | | 742 | 70 | CastParameters params; | 743 | 70 | params.is_strict = (CastMode == CastModeType::StrictMode); | 744 | 70 | size_t size = vec_from.size(); | 745 | | | 746 | 70 | RETURN_IF_ERROR(std::visit( | 747 | 70 | [&](auto multiply_may_overflow, auto narrow_integral) { | 748 | 70 | for (size_t i = 0; i < size; i++) { | 749 | 70 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 750 | 70 | typename ToDataType::FieldType, | 751 | 70 | multiply_may_overflow, narrow_integral>( | 752 | 70 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 753 | 70 | scale_multiplier, min_result, max_result, params)) { | 754 | 70 | if (set_nullable) { | 755 | 70 | null_map_data[i] = 1; | 756 | 70 | } else { | 757 | 70 | return params.status; | 758 | 70 | } | 759 | 70 | } | 760 | 70 | } | 761 | 70 | return Status::OK(); | 762 | 70 | }, | 763 | 70 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 764 | | | 765 | 14 | if (narrow_integral) { | 766 | 14 | block.get_by_position(result).column = | 767 | 14 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 768 | 14 | } else { | 769 | 0 | block.get_by_position(result).column = std::move(col_to); | 770 | 0 | } | 771 | 14 | return Status::OK(); | 772 | 70 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE7EEENS_15DataTypeDecimalILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 686 | 28 | const NullMap::value_type* null_map = nullptr) const override { | 687 | 28 | using FromFieldType = typename FromDataType::FieldType; | 688 | 28 | using ToFieldType = typename ToDataType::FieldType; | 689 | 28 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 690 | 28 | const auto* col_from = | 691 | 28 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 692 | 28 | if (!col_from) { | 693 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 694 | 0 | named_from.column->get_name()); | 695 | 0 | } | 696 | | | 697 | 28 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 698 | 28 | constexpr UInt32 from_scale = 0; | 699 | | | 700 | 28 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 701 | 28 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 702 | 28 | UInt32 to_precision = to_decimal_type.get_precision(); | 703 | 28 | ToDataType::check_type_precision(to_precision); | 704 | 28 | UInt32 to_scale = to_decimal_type.get_scale(); | 705 | 28 | ToDataType::check_type_scale(to_scale); | 706 | | | 707 | 28 | auto from_max_int_digit_count = from_precision - from_scale; | 708 | 28 | auto to_max_int_digit_count = to_precision - to_scale; | 709 | | // may overflow. nullable result column. | 710 | 28 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 711 | | // only in non-strict mode and may overflow, we set nullable | 712 | 28 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 713 | | | 714 | 28 | constexpr UInt32 to_max_digits = | 715 | 28 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 716 | 28 | bool multiply_may_overflow = false; | 717 | 28 | if (to_scale > from_scale) { | 718 | 16 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 719 | 16 | } | 720 | 28 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 721 | 28 | sizeof(typename ToFieldType::NativeType)), | 722 | 28 | FromFieldType, typename ToFieldType::NativeType>; | 723 | 28 | MaxNativeType scale_multiplier = | 724 | 28 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 725 | 28 | typename ToFieldType::NativeType max_result = | 726 | 28 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 727 | 28 | typename ToFieldType::NativeType min_result = -max_result; | 728 | | | 729 | 28 | ColumnUInt8::MutablePtr col_null_map_to; | 730 | 28 | NullMap::value_type* null_map_data = nullptr; | 731 | 28 | if (narrow_integral) { | 732 | 28 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 733 | 28 | null_map_data = col_null_map_to->get_data().data(); | 734 | 28 | } | 735 | | | 736 | 28 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 737 | 28 | const auto& vec_from = col_from->get_data(); | 738 | 28 | const auto* vec_from_data = vec_from.data(); | 739 | 28 | auto& vec_to = col_to->get_data(); | 740 | 28 | auto* vec_to_data = vec_to.data(); | 741 | | | 742 | 28 | CastParameters params; | 743 | 28 | params.is_strict = (CastMode == CastModeType::StrictMode); | 744 | 28 | size_t size = vec_from.size(); | 745 | | | 746 | 28 | RETURN_IF_ERROR(std::visit( | 747 | 28 | [&](auto multiply_may_overflow, auto narrow_integral) { | 748 | 28 | for (size_t i = 0; i < size; i++) { | 749 | 28 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 750 | 28 | typename ToDataType::FieldType, | 751 | 28 | multiply_may_overflow, narrow_integral>( | 752 | 28 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 753 | 28 | scale_multiplier, min_result, max_result, params)) { | 754 | 28 | if (set_nullable) { | 755 | 28 | null_map_data[i] = 1; | 756 | 28 | } else { | 757 | 28 | return params.status; | 758 | 28 | } | 759 | 28 | } | 760 | 28 | } | 761 | 28 | return Status::OK(); | 762 | 28 | }, | 763 | 28 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 764 | | | 765 | 28 | if (narrow_integral) { | 766 | 28 | block.get_by_position(result).column = | 767 | 28 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 768 | 28 | } else { | 769 | 0 | block.get_by_position(result).column = std::move(col_to); | 770 | 0 | } | 771 | 28 | return Status::OK(); | 772 | 28 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE2EEENS_15DataTypeDecimalILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 686 | 4 | const NullMap::value_type* null_map = nullptr) const override { | 687 | 4 | using FromFieldType = typename FromDataType::FieldType; | 688 | 4 | using ToFieldType = typename ToDataType::FieldType; | 689 | 4 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 690 | 4 | const auto* col_from = | 691 | 4 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 692 | 4 | if (!col_from) { | 693 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 694 | 0 | named_from.column->get_name()); | 695 | 0 | } | 696 | | | 697 | 4 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 698 | 4 | constexpr UInt32 from_scale = 0; | 699 | | | 700 | 4 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 701 | 4 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 702 | 4 | UInt32 to_precision = to_decimal_type.get_precision(); | 703 | 4 | ToDataType::check_type_precision(to_precision); | 704 | 4 | UInt32 to_scale = to_decimal_type.get_scale(); | 705 | 4 | ToDataType::check_type_scale(to_scale); | 706 | | | 707 | 4 | auto from_max_int_digit_count = from_precision - from_scale; | 708 | 4 | auto to_max_int_digit_count = to_precision - to_scale; | 709 | | // may overflow. nullable result column. | 710 | 4 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 711 | | // only in non-strict mode and may overflow, we set nullable | 712 | 4 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 713 | | | 714 | 4 | constexpr UInt32 to_max_digits = | 715 | 4 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 716 | 4 | bool multiply_may_overflow = false; | 717 | 4 | if (to_scale > from_scale) { | 718 | 4 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 719 | 4 | } | 720 | 4 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 721 | 4 | sizeof(typename ToFieldType::NativeType)), | 722 | 4 | FromFieldType, typename ToFieldType::NativeType>; | 723 | 4 | MaxNativeType scale_multiplier = | 724 | 4 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 725 | 4 | typename ToFieldType::NativeType max_result = | 726 | 4 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 727 | 4 | typename ToFieldType::NativeType min_result = -max_result; | 728 | | | 729 | 4 | ColumnUInt8::MutablePtr col_null_map_to; | 730 | 4 | NullMap::value_type* null_map_data = nullptr; | 731 | 4 | if (narrow_integral) { | 732 | 4 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 733 | 4 | null_map_data = col_null_map_to->get_data().data(); | 734 | 4 | } | 735 | | | 736 | 4 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 737 | 4 | const auto& vec_from = col_from->get_data(); | 738 | 4 | const auto* vec_from_data = vec_from.data(); | 739 | 4 | auto& vec_to = col_to->get_data(); | 740 | 4 | auto* vec_to_data = vec_to.data(); | 741 | | | 742 | 4 | CastParameters params; | 743 | 4 | params.is_strict = (CastMode == CastModeType::StrictMode); | 744 | 4 | size_t size = vec_from.size(); | 745 | | | 746 | 4 | RETURN_IF_ERROR(std::visit( | 747 | 4 | [&](auto multiply_may_overflow, auto narrow_integral) { | 748 | 4 | for (size_t i = 0; i < size; i++) { | 749 | 4 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 750 | 4 | typename ToDataType::FieldType, | 751 | 4 | multiply_may_overflow, narrow_integral>( | 752 | 4 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 753 | 4 | scale_multiplier, min_result, max_result, params)) { | 754 | 4 | if (set_nullable) { | 755 | 4 | null_map_data[i] = 1; | 756 | 4 | } else { | 757 | 4 | return params.status; | 758 | 4 | } | 759 | 4 | } | 760 | 4 | } | 761 | 4 | return Status::OK(); | 762 | 4 | }, | 763 | 4 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 764 | | | 765 | 2 | if (narrow_integral) { | 766 | 2 | block.get_by_position(result).column = | 767 | 2 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 768 | 2 | } else { | 769 | 0 | block.get_by_position(result).column = std::move(col_to); | 770 | 0 | } | 771 | 2 | return Status::OK(); | 772 | 4 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE2EEENS_15DataTypeDecimalILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 686 | 10 | const NullMap::value_type* null_map = nullptr) const override { | 687 | 10 | using FromFieldType = typename FromDataType::FieldType; | 688 | 10 | using ToFieldType = typename ToDataType::FieldType; | 689 | 10 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 690 | 10 | const auto* col_from = | 691 | 10 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 692 | 10 | if (!col_from) { | 693 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 694 | 0 | named_from.column->get_name()); | 695 | 0 | } | 696 | | | 697 | 10 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 698 | 10 | constexpr UInt32 from_scale = 0; | 699 | | | 700 | 10 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 701 | 10 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 702 | 10 | UInt32 to_precision = to_decimal_type.get_precision(); | 703 | 10 | ToDataType::check_type_precision(to_precision); | 704 | 10 | UInt32 to_scale = to_decimal_type.get_scale(); | 705 | 10 | ToDataType::check_type_scale(to_scale); | 706 | | | 707 | 10 | auto from_max_int_digit_count = from_precision - from_scale; | 708 | 10 | auto to_max_int_digit_count = to_precision - to_scale; | 709 | | // may overflow. nullable result column. | 710 | 10 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 711 | | // only in non-strict mode and may overflow, we set nullable | 712 | 10 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 713 | | | 714 | 10 | constexpr UInt32 to_max_digits = | 715 | 10 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 716 | 10 | bool multiply_may_overflow = false; | 717 | 10 | if (to_scale > from_scale) { | 718 | 8 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 719 | 8 | } | 720 | 10 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 721 | 10 | sizeof(typename ToFieldType::NativeType)), | 722 | 10 | FromFieldType, typename ToFieldType::NativeType>; | 723 | 10 | MaxNativeType scale_multiplier = | 724 | 10 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 725 | 10 | typename ToFieldType::NativeType max_result = | 726 | 10 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 727 | 10 | typename ToFieldType::NativeType min_result = -max_result; | 728 | | | 729 | 10 | ColumnUInt8::MutablePtr col_null_map_to; | 730 | 10 | NullMap::value_type* null_map_data = nullptr; | 731 | 10 | if (narrow_integral) { | 732 | 2 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 733 | 2 | null_map_data = col_null_map_to->get_data().data(); | 734 | 2 | } | 735 | | | 736 | 10 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 737 | 10 | const auto& vec_from = col_from->get_data(); | 738 | 10 | const auto* vec_from_data = vec_from.data(); | 739 | 10 | auto& vec_to = col_to->get_data(); | 740 | 10 | auto* vec_to_data = vec_to.data(); | 741 | | | 742 | 10 | CastParameters params; | 743 | 10 | params.is_strict = (CastMode == CastModeType::StrictMode); | 744 | 10 | size_t size = vec_from.size(); | 745 | | | 746 | 10 | RETURN_IF_ERROR(std::visit( | 747 | 10 | [&](auto multiply_may_overflow, auto narrow_integral) { | 748 | 10 | for (size_t i = 0; i < size; i++) { | 749 | 10 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 750 | 10 | typename ToDataType::FieldType, | 751 | 10 | multiply_may_overflow, narrow_integral>( | 752 | 10 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 753 | 10 | scale_multiplier, min_result, max_result, params)) { | 754 | 10 | if (set_nullable) { | 755 | 10 | null_map_data[i] = 1; | 756 | 10 | } else { | 757 | 10 | return params.status; | 758 | 10 | } | 759 | 10 | } | 760 | 10 | } | 761 | 10 | return Status::OK(); | 762 | 10 | }, | 763 | 10 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 764 | | | 765 | 10 | if (narrow_integral) { | 766 | 2 | block.get_by_position(result).column = | 767 | 2 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 768 | 8 | } else { | 769 | 8 | block.get_by_position(result).column = std::move(col_to); | 770 | 8 | } | 771 | 10 | return Status::OK(); | 772 | 10 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE3EEENS_15DataTypeDecimalILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 686 | 38 | const NullMap::value_type* null_map = nullptr) const override { | 687 | 38 | using FromFieldType = typename FromDataType::FieldType; | 688 | 38 | using ToFieldType = typename ToDataType::FieldType; | 689 | 38 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 690 | 38 | const auto* col_from = | 691 | 38 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 692 | 38 | if (!col_from) { | 693 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 694 | 0 | named_from.column->get_name()); | 695 | 0 | } | 696 | | | 697 | 38 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 698 | 38 | constexpr UInt32 from_scale = 0; | 699 | | | 700 | 38 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 701 | 38 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 702 | 38 | UInt32 to_precision = to_decimal_type.get_precision(); | 703 | 38 | ToDataType::check_type_precision(to_precision); | 704 | 38 | UInt32 to_scale = to_decimal_type.get_scale(); | 705 | 38 | ToDataType::check_type_scale(to_scale); | 706 | | | 707 | 38 | auto from_max_int_digit_count = from_precision - from_scale; | 708 | 38 | auto to_max_int_digit_count = to_precision - to_scale; | 709 | | // may overflow. nullable result column. | 710 | 38 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 711 | | // only in non-strict mode and may overflow, we set nullable | 712 | 38 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 713 | | | 714 | 38 | constexpr UInt32 to_max_digits = | 715 | 38 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 716 | 38 | bool multiply_may_overflow = false; | 717 | 38 | if (to_scale > from_scale) { | 718 | 24 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 719 | 24 | } | 720 | 38 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 721 | 38 | sizeof(typename ToFieldType::NativeType)), | 722 | 38 | FromFieldType, typename ToFieldType::NativeType>; | 723 | 38 | MaxNativeType scale_multiplier = | 724 | 38 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 725 | 38 | typename ToFieldType::NativeType max_result = | 726 | 38 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 727 | 38 | typename ToFieldType::NativeType min_result = -max_result; | 728 | | | 729 | 38 | ColumnUInt8::MutablePtr col_null_map_to; | 730 | 38 | NullMap::value_type* null_map_data = nullptr; | 731 | 38 | if (narrow_integral) { | 732 | 30 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 733 | 30 | null_map_data = col_null_map_to->get_data().data(); | 734 | 30 | } | 735 | | | 736 | 38 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 737 | 38 | const auto& vec_from = col_from->get_data(); | 738 | 38 | const auto* vec_from_data = vec_from.data(); | 739 | 38 | auto& vec_to = col_to->get_data(); | 740 | 38 | auto* vec_to_data = vec_to.data(); | 741 | | | 742 | 38 | CastParameters params; | 743 | 38 | params.is_strict = (CastMode == CastModeType::StrictMode); | 744 | 38 | size_t size = vec_from.size(); | 745 | | | 746 | 38 | RETURN_IF_ERROR(std::visit( | 747 | 38 | [&](auto multiply_may_overflow, auto narrow_integral) { | 748 | 38 | for (size_t i = 0; i < size; i++) { | 749 | 38 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 750 | 38 | typename ToDataType::FieldType, | 751 | 38 | multiply_may_overflow, narrow_integral>( | 752 | 38 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 753 | 38 | scale_multiplier, min_result, max_result, params)) { | 754 | 38 | if (set_nullable) { | 755 | 38 | null_map_data[i] = 1; | 756 | 38 | } else { | 757 | 38 | return params.status; | 758 | 38 | } | 759 | 38 | } | 760 | 38 | } | 761 | 38 | return Status::OK(); | 762 | 38 | }, | 763 | 38 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 764 | | | 765 | 14 | if (narrow_integral) { | 766 | 6 | block.get_by_position(result).column = | 767 | 6 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 768 | 8 | } else { | 769 | 8 | block.get_by_position(result).column = std::move(col_to); | 770 | 8 | } | 771 | 14 | return Status::OK(); | 772 | 38 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE3EEENS_15DataTypeDecimalILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 686 | 20 | const NullMap::value_type* null_map = nullptr) const override { | 687 | 20 | using FromFieldType = typename FromDataType::FieldType; | 688 | 20 | using ToFieldType = typename ToDataType::FieldType; | 689 | 20 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 690 | 20 | const auto* col_from = | 691 | 20 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 692 | 20 | if (!col_from) { | 693 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 694 | 0 | named_from.column->get_name()); | 695 | 0 | } | 696 | | | 697 | 20 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 698 | 20 | constexpr UInt32 from_scale = 0; | 699 | | | 700 | 20 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 701 | 20 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 702 | 20 | UInt32 to_precision = to_decimal_type.get_precision(); | 703 | 20 | ToDataType::check_type_precision(to_precision); | 704 | 20 | UInt32 to_scale = to_decimal_type.get_scale(); | 705 | 20 | ToDataType::check_type_scale(to_scale); | 706 | | | 707 | 20 | auto from_max_int_digit_count = from_precision - from_scale; | 708 | 20 | auto to_max_int_digit_count = to_precision - to_scale; | 709 | | // may overflow. nullable result column. | 710 | 20 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 711 | | // only in non-strict mode and may overflow, we set nullable | 712 | 20 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 713 | | | 714 | 20 | constexpr UInt32 to_max_digits = | 715 | 20 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 716 | 20 | bool multiply_may_overflow = false; | 717 | 20 | if (to_scale > from_scale) { | 718 | 12 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 719 | 12 | } | 720 | 20 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 721 | 20 | sizeof(typename ToFieldType::NativeType)), | 722 | 20 | FromFieldType, typename ToFieldType::NativeType>; | 723 | 20 | MaxNativeType scale_multiplier = | 724 | 20 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 725 | 20 | typename ToFieldType::NativeType max_result = | 726 | 20 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 727 | 20 | typename ToFieldType::NativeType min_result = -max_result; | 728 | | | 729 | 20 | ColumnUInt8::MutablePtr col_null_map_to; | 730 | 20 | NullMap::value_type* null_map_data = nullptr; | 731 | 20 | if (narrow_integral) { | 732 | 12 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 733 | 12 | null_map_data = col_null_map_to->get_data().data(); | 734 | 12 | } | 735 | | | 736 | 20 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 737 | 20 | const auto& vec_from = col_from->get_data(); | 738 | 20 | const auto* vec_from_data = vec_from.data(); | 739 | 20 | auto& vec_to = col_to->get_data(); | 740 | 20 | auto* vec_to_data = vec_to.data(); | 741 | | | 742 | 20 | CastParameters params; | 743 | 20 | params.is_strict = (CastMode == CastModeType::StrictMode); | 744 | 20 | size_t size = vec_from.size(); | 745 | | | 746 | 20 | RETURN_IF_ERROR(std::visit( | 747 | 20 | [&](auto multiply_may_overflow, auto narrow_integral) { | 748 | 20 | for (size_t i = 0; i < size; i++) { | 749 | 20 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 750 | 20 | typename ToDataType::FieldType, | 751 | 20 | multiply_may_overflow, narrow_integral>( | 752 | 20 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 753 | 20 | scale_multiplier, min_result, max_result, params)) { | 754 | 20 | if (set_nullable) { | 755 | 20 | null_map_data[i] = 1; | 756 | 20 | } else { | 757 | 20 | return params.status; | 758 | 20 | } | 759 | 20 | } | 760 | 20 | } | 761 | 20 | return Status::OK(); | 762 | 20 | }, | 763 | 20 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 764 | | | 765 | 20 | if (narrow_integral) { | 766 | 12 | block.get_by_position(result).column = | 767 | 12 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 768 | 12 | } else { | 769 | 8 | block.get_by_position(result).column = std::move(col_to); | 770 | 8 | } | 771 | 20 | return Status::OK(); | 772 | 20 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE4EEENS_15DataTypeDecimalILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 686 | 38 | const NullMap::value_type* null_map = nullptr) const override { | 687 | 38 | using FromFieldType = typename FromDataType::FieldType; | 688 | 38 | using ToFieldType = typename ToDataType::FieldType; | 689 | 38 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 690 | 38 | const auto* col_from = | 691 | 38 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 692 | 38 | if (!col_from) { | 693 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 694 | 0 | named_from.column->get_name()); | 695 | 0 | } | 696 | | | 697 | 38 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 698 | 38 | constexpr UInt32 from_scale = 0; | 699 | | | 700 | 38 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 701 | 38 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 702 | 38 | UInt32 to_precision = to_decimal_type.get_precision(); | 703 | 38 | ToDataType::check_type_precision(to_precision); | 704 | 38 | UInt32 to_scale = to_decimal_type.get_scale(); | 705 | 38 | ToDataType::check_type_scale(to_scale); | 706 | | | 707 | 38 | auto from_max_int_digit_count = from_precision - from_scale; | 708 | 38 | auto to_max_int_digit_count = to_precision - to_scale; | 709 | | // may overflow. nullable result column. | 710 | 38 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 711 | | // only in non-strict mode and may overflow, we set nullable | 712 | 38 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 713 | | | 714 | 38 | constexpr UInt32 to_max_digits = | 715 | 38 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 716 | 38 | bool multiply_may_overflow = false; | 717 | 38 | if (to_scale > from_scale) { | 718 | 24 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 719 | 24 | } | 720 | 38 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 721 | 38 | sizeof(typename ToFieldType::NativeType)), | 722 | 38 | FromFieldType, typename ToFieldType::NativeType>; | 723 | 38 | MaxNativeType scale_multiplier = | 724 | 38 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 725 | 38 | typename ToFieldType::NativeType max_result = | 726 | 38 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 727 | 38 | typename ToFieldType::NativeType min_result = -max_result; | 728 | | | 729 | 38 | ColumnUInt8::MutablePtr col_null_map_to; | 730 | 38 | NullMap::value_type* null_map_data = nullptr; | 731 | 38 | if (narrow_integral) { | 732 | 30 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 733 | 30 | null_map_data = col_null_map_to->get_data().data(); | 734 | 30 | } | 735 | | | 736 | 38 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 737 | 38 | const auto& vec_from = col_from->get_data(); | 738 | 38 | const auto* vec_from_data = vec_from.data(); | 739 | 38 | auto& vec_to = col_to->get_data(); | 740 | 38 | auto* vec_to_data = vec_to.data(); | 741 | | | 742 | 38 | CastParameters params; | 743 | 38 | params.is_strict = (CastMode == CastModeType::StrictMode); | 744 | 38 | size_t size = vec_from.size(); | 745 | | | 746 | 38 | RETURN_IF_ERROR(std::visit( | 747 | 38 | [&](auto multiply_may_overflow, auto narrow_integral) { | 748 | 38 | for (size_t i = 0; i < size; i++) { | 749 | 38 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 750 | 38 | typename ToDataType::FieldType, | 751 | 38 | multiply_may_overflow, narrow_integral>( | 752 | 38 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 753 | 38 | scale_multiplier, min_result, max_result, params)) { | 754 | 38 | if (set_nullable) { | 755 | 38 | null_map_data[i] = 1; | 756 | 38 | } else { | 757 | 38 | return params.status; | 758 | 38 | } | 759 | 38 | } | 760 | 38 | } | 761 | 38 | return Status::OK(); | 762 | 38 | }, | 763 | 38 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 764 | | | 765 | 14 | if (narrow_integral) { | 766 | 6 | block.get_by_position(result).column = | 767 | 6 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 768 | 8 | } else { | 769 | 8 | block.get_by_position(result).column = std::move(col_to); | 770 | 8 | } | 771 | 14 | return Status::OK(); | 772 | 38 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE4EEENS_15DataTypeDecimalILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 686 | 20 | const NullMap::value_type* null_map = nullptr) const override { | 687 | 20 | using FromFieldType = typename FromDataType::FieldType; | 688 | 20 | using ToFieldType = typename ToDataType::FieldType; | 689 | 20 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 690 | 20 | const auto* col_from = | 691 | 20 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 692 | 20 | if (!col_from) { | 693 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 694 | 0 | named_from.column->get_name()); | 695 | 0 | } | 696 | | | 697 | 20 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 698 | 20 | constexpr UInt32 from_scale = 0; | 699 | | | 700 | 20 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 701 | 20 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 702 | 20 | UInt32 to_precision = to_decimal_type.get_precision(); | 703 | 20 | ToDataType::check_type_precision(to_precision); | 704 | 20 | UInt32 to_scale = to_decimal_type.get_scale(); | 705 | 20 | ToDataType::check_type_scale(to_scale); | 706 | | | 707 | 20 | auto from_max_int_digit_count = from_precision - from_scale; | 708 | 20 | auto to_max_int_digit_count = to_precision - to_scale; | 709 | | // may overflow. nullable result column. | 710 | 20 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 711 | | // only in non-strict mode and may overflow, we set nullable | 712 | 20 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 713 | | | 714 | 20 | constexpr UInt32 to_max_digits = | 715 | 20 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 716 | 20 | bool multiply_may_overflow = false; | 717 | 20 | if (to_scale > from_scale) { | 718 | 12 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 719 | 12 | } | 720 | 20 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 721 | 20 | sizeof(typename ToFieldType::NativeType)), | 722 | 20 | FromFieldType, typename ToFieldType::NativeType>; | 723 | 20 | MaxNativeType scale_multiplier = | 724 | 20 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 725 | 20 | typename ToFieldType::NativeType max_result = | 726 | 20 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 727 | 20 | typename ToFieldType::NativeType min_result = -max_result; | 728 | | | 729 | 20 | ColumnUInt8::MutablePtr col_null_map_to; | 730 | 20 | NullMap::value_type* null_map_data = nullptr; | 731 | 20 | if (narrow_integral) { | 732 | 12 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 733 | 12 | null_map_data = col_null_map_to->get_data().data(); | 734 | 12 | } | 735 | | | 736 | 20 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 737 | 20 | const auto& vec_from = col_from->get_data(); | 738 | 20 | const auto* vec_from_data = vec_from.data(); | 739 | 20 | auto& vec_to = col_to->get_data(); | 740 | 20 | auto* vec_to_data = vec_to.data(); | 741 | | | 742 | 20 | CastParameters params; | 743 | 20 | params.is_strict = (CastMode == CastModeType::StrictMode); | 744 | 20 | size_t size = vec_from.size(); | 745 | | | 746 | 20 | RETURN_IF_ERROR(std::visit( | 747 | 20 | [&](auto multiply_may_overflow, auto narrow_integral) { | 748 | 20 | for (size_t i = 0; i < size; i++) { | 749 | 20 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 750 | 20 | typename ToDataType::FieldType, | 751 | 20 | multiply_may_overflow, narrow_integral>( | 752 | 20 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 753 | 20 | scale_multiplier, min_result, max_result, params)) { | 754 | 20 | if (set_nullable) { | 755 | 20 | null_map_data[i] = 1; | 756 | 20 | } else { | 757 | 20 | return params.status; | 758 | 20 | } | 759 | 20 | } | 760 | 20 | } | 761 | 20 | return Status::OK(); | 762 | 20 | }, | 763 | 20 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 764 | | | 765 | 20 | if (narrow_integral) { | 766 | 12 | block.get_by_position(result).column = | 767 | 12 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 768 | 12 | } else { | 769 | 8 | block.get_by_position(result).column = std::move(col_to); | 770 | 8 | } | 771 | 20 | return Status::OK(); | 772 | 20 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE5EEENS_15DataTypeDecimalILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 686 | 38 | const NullMap::value_type* null_map = nullptr) const override { | 687 | 38 | using FromFieldType = typename FromDataType::FieldType; | 688 | 38 | using ToFieldType = typename ToDataType::FieldType; | 689 | 38 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 690 | 38 | const auto* col_from = | 691 | 38 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 692 | 38 | if (!col_from) { | 693 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 694 | 0 | named_from.column->get_name()); | 695 | 0 | } | 696 | | | 697 | 38 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 698 | 38 | constexpr UInt32 from_scale = 0; | 699 | | | 700 | 38 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 701 | 38 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 702 | 38 | UInt32 to_precision = to_decimal_type.get_precision(); | 703 | 38 | ToDataType::check_type_precision(to_precision); | 704 | 38 | UInt32 to_scale = to_decimal_type.get_scale(); | 705 | 38 | ToDataType::check_type_scale(to_scale); | 706 | | | 707 | 38 | auto from_max_int_digit_count = from_precision - from_scale; | 708 | 38 | auto to_max_int_digit_count = to_precision - to_scale; | 709 | | // may overflow. nullable result column. | 710 | 38 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 711 | | // only in non-strict mode and may overflow, we set nullable | 712 | 38 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 713 | | | 714 | 38 | constexpr UInt32 to_max_digits = | 715 | 38 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 716 | 38 | bool multiply_may_overflow = false; | 717 | 38 | if (to_scale > from_scale) { | 718 | 24 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 719 | 24 | } | 720 | 38 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 721 | 38 | sizeof(typename ToFieldType::NativeType)), | 722 | 38 | FromFieldType, typename ToFieldType::NativeType>; | 723 | 38 | MaxNativeType scale_multiplier = | 724 | 38 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 725 | 38 | typename ToFieldType::NativeType max_result = | 726 | 38 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 727 | 38 | typename ToFieldType::NativeType min_result = -max_result; | 728 | | | 729 | 38 | ColumnUInt8::MutablePtr col_null_map_to; | 730 | 38 | NullMap::value_type* null_map_data = nullptr; | 731 | 38 | if (narrow_integral) { | 732 | 30 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 733 | 30 | null_map_data = col_null_map_to->get_data().data(); | 734 | 30 | } | 735 | | | 736 | 38 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 737 | 38 | const auto& vec_from = col_from->get_data(); | 738 | 38 | const auto* vec_from_data = vec_from.data(); | 739 | 38 | auto& vec_to = col_to->get_data(); | 740 | 38 | auto* vec_to_data = vec_to.data(); | 741 | | | 742 | 38 | CastParameters params; | 743 | 38 | params.is_strict = (CastMode == CastModeType::StrictMode); | 744 | 38 | size_t size = vec_from.size(); | 745 | | | 746 | 38 | RETURN_IF_ERROR(std::visit( | 747 | 38 | [&](auto multiply_may_overflow, auto narrow_integral) { | 748 | 38 | for (size_t i = 0; i < size; i++) { | 749 | 38 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 750 | 38 | typename ToDataType::FieldType, | 751 | 38 | multiply_may_overflow, narrow_integral>( | 752 | 38 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 753 | 38 | scale_multiplier, min_result, max_result, params)) { | 754 | 38 | if (set_nullable) { | 755 | 38 | null_map_data[i] = 1; | 756 | 38 | } else { | 757 | 38 | return params.status; | 758 | 38 | } | 759 | 38 | } | 760 | 38 | } | 761 | 38 | return Status::OK(); | 762 | 38 | }, | 763 | 38 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 764 | | | 765 | 14 | if (narrow_integral) { | 766 | 6 | block.get_by_position(result).column = | 767 | 6 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 768 | 8 | } else { | 769 | 8 | block.get_by_position(result).column = std::move(col_to); | 770 | 8 | } | 771 | 14 | return Status::OK(); | 772 | 38 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE5EEENS_15DataTypeDecimalILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 686 | 20 | const NullMap::value_type* null_map = nullptr) const override { | 687 | 20 | using FromFieldType = typename FromDataType::FieldType; | 688 | 20 | using ToFieldType = typename ToDataType::FieldType; | 689 | 20 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 690 | 20 | const auto* col_from = | 691 | 20 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 692 | 20 | if (!col_from) { | 693 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 694 | 0 | named_from.column->get_name()); | 695 | 0 | } | 696 | | | 697 | 20 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 698 | 20 | constexpr UInt32 from_scale = 0; | 699 | | | 700 | 20 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 701 | 20 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 702 | 20 | UInt32 to_precision = to_decimal_type.get_precision(); | 703 | 20 | ToDataType::check_type_precision(to_precision); | 704 | 20 | UInt32 to_scale = to_decimal_type.get_scale(); | 705 | 20 | ToDataType::check_type_scale(to_scale); | 706 | | | 707 | 20 | auto from_max_int_digit_count = from_precision - from_scale; | 708 | 20 | auto to_max_int_digit_count = to_precision - to_scale; | 709 | | // may overflow. nullable result column. | 710 | 20 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 711 | | // only in non-strict mode and may overflow, we set nullable | 712 | 20 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 713 | | | 714 | 20 | constexpr UInt32 to_max_digits = | 715 | 20 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 716 | 20 | bool multiply_may_overflow = false; | 717 | 20 | if (to_scale > from_scale) { | 718 | 12 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 719 | 12 | } | 720 | 20 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 721 | 20 | sizeof(typename ToFieldType::NativeType)), | 722 | 20 | FromFieldType, typename ToFieldType::NativeType>; | 723 | 20 | MaxNativeType scale_multiplier = | 724 | 20 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 725 | 20 | typename ToFieldType::NativeType max_result = | 726 | 20 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 727 | 20 | typename ToFieldType::NativeType min_result = -max_result; | 728 | | | 729 | 20 | ColumnUInt8::MutablePtr col_null_map_to; | 730 | 20 | NullMap::value_type* null_map_data = nullptr; | 731 | 20 | if (narrow_integral) { | 732 | 12 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 733 | 12 | null_map_data = col_null_map_to->get_data().data(); | 734 | 12 | } | 735 | | | 736 | 20 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 737 | 20 | const auto& vec_from = col_from->get_data(); | 738 | 20 | const auto* vec_from_data = vec_from.data(); | 739 | 20 | auto& vec_to = col_to->get_data(); | 740 | 20 | auto* vec_to_data = vec_to.data(); | 741 | | | 742 | 20 | CastParameters params; | 743 | 20 | params.is_strict = (CastMode == CastModeType::StrictMode); | 744 | 20 | size_t size = vec_from.size(); | 745 | | | 746 | 20 | RETURN_IF_ERROR(std::visit( | 747 | 20 | [&](auto multiply_may_overflow, auto narrow_integral) { | 748 | 20 | for (size_t i = 0; i < size; i++) { | 749 | 20 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 750 | 20 | typename ToDataType::FieldType, | 751 | 20 | multiply_may_overflow, narrow_integral>( | 752 | 20 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 753 | 20 | scale_multiplier, min_result, max_result, params)) { | 754 | 20 | if (set_nullable) { | 755 | 20 | null_map_data[i] = 1; | 756 | 20 | } else { | 757 | 20 | return params.status; | 758 | 20 | } | 759 | 20 | } | 760 | 20 | } | 761 | 20 | return Status::OK(); | 762 | 20 | }, | 763 | 20 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 764 | | | 765 | 20 | if (narrow_integral) { | 766 | 12 | block.get_by_position(result).column = | 767 | 12 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 768 | 12 | } else { | 769 | 8 | block.get_by_position(result).column = std::move(col_to); | 770 | 8 | } | 771 | 20 | return Status::OK(); | 772 | 20 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE6EEENS_15DataTypeDecimalILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 686 | 38 | const NullMap::value_type* null_map = nullptr) const override { | 687 | 38 | using FromFieldType = typename FromDataType::FieldType; | 688 | 38 | using ToFieldType = typename ToDataType::FieldType; | 689 | 38 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 690 | 38 | const auto* col_from = | 691 | 38 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 692 | 38 | if (!col_from) { | 693 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 694 | 0 | named_from.column->get_name()); | 695 | 0 | } | 696 | | | 697 | 38 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 698 | 38 | constexpr UInt32 from_scale = 0; | 699 | | | 700 | 38 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 701 | 38 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 702 | 38 | UInt32 to_precision = to_decimal_type.get_precision(); | 703 | 38 | ToDataType::check_type_precision(to_precision); | 704 | 38 | UInt32 to_scale = to_decimal_type.get_scale(); | 705 | 38 | ToDataType::check_type_scale(to_scale); | 706 | | | 707 | 38 | auto from_max_int_digit_count = from_precision - from_scale; | 708 | 38 | auto to_max_int_digit_count = to_precision - to_scale; | 709 | | // may overflow. nullable result column. | 710 | 38 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 711 | | // only in non-strict mode and may overflow, we set nullable | 712 | 38 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 713 | | | 714 | 38 | constexpr UInt32 to_max_digits = | 715 | 38 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 716 | 38 | bool multiply_may_overflow = false; | 717 | 38 | if (to_scale > from_scale) { | 718 | 24 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 719 | 24 | } | 720 | 38 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 721 | 38 | sizeof(typename ToFieldType::NativeType)), | 722 | 38 | FromFieldType, typename ToFieldType::NativeType>; | 723 | 38 | MaxNativeType scale_multiplier = | 724 | 38 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 725 | 38 | typename ToFieldType::NativeType max_result = | 726 | 38 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 727 | 38 | typename ToFieldType::NativeType min_result = -max_result; | 728 | | | 729 | 38 | ColumnUInt8::MutablePtr col_null_map_to; | 730 | 38 | NullMap::value_type* null_map_data = nullptr; | 731 | 38 | if (narrow_integral) { | 732 | 30 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 733 | 30 | null_map_data = col_null_map_to->get_data().data(); | 734 | 30 | } | 735 | | | 736 | 38 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 737 | 38 | const auto& vec_from = col_from->get_data(); | 738 | 38 | const auto* vec_from_data = vec_from.data(); | 739 | 38 | auto& vec_to = col_to->get_data(); | 740 | 38 | auto* vec_to_data = vec_to.data(); | 741 | | | 742 | 38 | CastParameters params; | 743 | 38 | params.is_strict = (CastMode == CastModeType::StrictMode); | 744 | 38 | size_t size = vec_from.size(); | 745 | | | 746 | 38 | RETURN_IF_ERROR(std::visit( | 747 | 38 | [&](auto multiply_may_overflow, auto narrow_integral) { | 748 | 38 | for (size_t i = 0; i < size; i++) { | 749 | 38 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 750 | 38 | typename ToDataType::FieldType, | 751 | 38 | multiply_may_overflow, narrow_integral>( | 752 | 38 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 753 | 38 | scale_multiplier, min_result, max_result, params)) { | 754 | 38 | if (set_nullable) { | 755 | 38 | null_map_data[i] = 1; | 756 | 38 | } else { | 757 | 38 | return params.status; | 758 | 38 | } | 759 | 38 | } | 760 | 38 | } | 761 | 38 | return Status::OK(); | 762 | 38 | }, | 763 | 38 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 764 | | | 765 | 14 | if (narrow_integral) { | 766 | 6 | block.get_by_position(result).column = | 767 | 6 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 768 | 8 | } else { | 769 | 8 | block.get_by_position(result).column = std::move(col_to); | 770 | 8 | } | 771 | 14 | return Status::OK(); | 772 | 38 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE6EEENS_15DataTypeDecimalILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 686 | 20 | const NullMap::value_type* null_map = nullptr) const override { | 687 | 20 | using FromFieldType = typename FromDataType::FieldType; | 688 | 20 | using ToFieldType = typename ToDataType::FieldType; | 689 | 20 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 690 | 20 | const auto* col_from = | 691 | 20 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 692 | 20 | if (!col_from) { | 693 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 694 | 0 | named_from.column->get_name()); | 695 | 0 | } | 696 | | | 697 | 20 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 698 | 20 | constexpr UInt32 from_scale = 0; | 699 | | | 700 | 20 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 701 | 20 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 702 | 20 | UInt32 to_precision = to_decimal_type.get_precision(); | 703 | 20 | ToDataType::check_type_precision(to_precision); | 704 | 20 | UInt32 to_scale = to_decimal_type.get_scale(); | 705 | 20 | ToDataType::check_type_scale(to_scale); | 706 | | | 707 | 20 | auto from_max_int_digit_count = from_precision - from_scale; | 708 | 20 | auto to_max_int_digit_count = to_precision - to_scale; | 709 | | // may overflow. nullable result column. | 710 | 20 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 711 | | // only in non-strict mode and may overflow, we set nullable | 712 | 20 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 713 | | | 714 | 20 | constexpr UInt32 to_max_digits = | 715 | 20 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 716 | 20 | bool multiply_may_overflow = false; | 717 | 20 | if (to_scale > from_scale) { | 718 | 12 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 719 | 12 | } | 720 | 20 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 721 | 20 | sizeof(typename ToFieldType::NativeType)), | 722 | 20 | FromFieldType, typename ToFieldType::NativeType>; | 723 | 20 | MaxNativeType scale_multiplier = | 724 | 20 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 725 | 20 | typename ToFieldType::NativeType max_result = | 726 | 20 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 727 | 20 | typename ToFieldType::NativeType min_result = -max_result; | 728 | | | 729 | 20 | ColumnUInt8::MutablePtr col_null_map_to; | 730 | 20 | NullMap::value_type* null_map_data = nullptr; | 731 | 20 | if (narrow_integral) { | 732 | 12 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 733 | 12 | null_map_data = col_null_map_to->get_data().data(); | 734 | 12 | } | 735 | | | 736 | 20 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 737 | 20 | const auto& vec_from = col_from->get_data(); | 738 | 20 | const auto* vec_from_data = vec_from.data(); | 739 | 20 | auto& vec_to = col_to->get_data(); | 740 | 20 | auto* vec_to_data = vec_to.data(); | 741 | | | 742 | 20 | CastParameters params; | 743 | 20 | params.is_strict = (CastMode == CastModeType::StrictMode); | 744 | 20 | size_t size = vec_from.size(); | 745 | | | 746 | 20 | RETURN_IF_ERROR(std::visit( | 747 | 20 | [&](auto multiply_may_overflow, auto narrow_integral) { | 748 | 20 | for (size_t i = 0; i < size; i++) { | 749 | 20 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 750 | 20 | typename ToDataType::FieldType, | 751 | 20 | multiply_may_overflow, narrow_integral>( | 752 | 20 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 753 | 20 | scale_multiplier, min_result, max_result, params)) { | 754 | 20 | if (set_nullable) { | 755 | 20 | null_map_data[i] = 1; | 756 | 20 | } else { | 757 | 20 | return params.status; | 758 | 20 | } | 759 | 20 | } | 760 | 20 | } | 761 | 20 | return Status::OK(); | 762 | 20 | }, | 763 | 20 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 764 | | | 765 | 20 | if (narrow_integral) { | 766 | 12 | block.get_by_position(result).column = | 767 | 12 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 768 | 12 | } else { | 769 | 8 | block.get_by_position(result).column = std::move(col_to); | 770 | 8 | } | 771 | 20 | return Status::OK(); | 772 | 20 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE7EEENS_15DataTypeDecimalILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 686 | 62 | const NullMap::value_type* null_map = nullptr) const override { | 687 | 62 | using FromFieldType = typename FromDataType::FieldType; | 688 | 62 | using ToFieldType = typename ToDataType::FieldType; | 689 | 62 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 690 | 62 | const auto* col_from = | 691 | 62 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 692 | 62 | if (!col_from) { | 693 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 694 | 0 | named_from.column->get_name()); | 695 | 0 | } | 696 | | | 697 | 62 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 698 | 62 | constexpr UInt32 from_scale = 0; | 699 | | | 700 | 62 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 701 | 62 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 702 | 62 | UInt32 to_precision = to_decimal_type.get_precision(); | 703 | 62 | ToDataType::check_type_precision(to_precision); | 704 | 62 | UInt32 to_scale = to_decimal_type.get_scale(); | 705 | 62 | ToDataType::check_type_scale(to_scale); | 706 | | | 707 | 62 | auto from_max_int_digit_count = from_precision - from_scale; | 708 | 62 | auto to_max_int_digit_count = to_precision - to_scale; | 709 | | // may overflow. nullable result column. | 710 | 62 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 711 | | // only in non-strict mode and may overflow, we set nullable | 712 | 62 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 713 | | | 714 | 62 | constexpr UInt32 to_max_digits = | 715 | 62 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 716 | 62 | bool multiply_may_overflow = false; | 717 | 62 | if (to_scale > from_scale) { | 718 | 40 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 719 | 40 | } | 720 | 62 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 721 | 62 | sizeof(typename ToFieldType::NativeType)), | 722 | 62 | FromFieldType, typename ToFieldType::NativeType>; | 723 | 62 | MaxNativeType scale_multiplier = | 724 | 62 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 725 | 62 | typename ToFieldType::NativeType max_result = | 726 | 62 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 727 | 62 | typename ToFieldType::NativeType min_result = -max_result; | 728 | | | 729 | 62 | ColumnUInt8::MutablePtr col_null_map_to; | 730 | 62 | NullMap::value_type* null_map_data = nullptr; | 731 | 62 | if (narrow_integral) { | 732 | 60 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 733 | 60 | null_map_data = col_null_map_to->get_data().data(); | 734 | 60 | } | 735 | | | 736 | 62 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 737 | 62 | const auto& vec_from = col_from->get_data(); | 738 | 62 | const auto* vec_from_data = vec_from.data(); | 739 | 62 | auto& vec_to = col_to->get_data(); | 740 | 62 | auto* vec_to_data = vec_to.data(); | 741 | | | 742 | 62 | CastParameters params; | 743 | 62 | params.is_strict = (CastMode == CastModeType::StrictMode); | 744 | 62 | size_t size = vec_from.size(); | 745 | | | 746 | 62 | RETURN_IF_ERROR(std::visit( | 747 | 62 | [&](auto multiply_may_overflow, auto narrow_integral) { | 748 | 62 | for (size_t i = 0; i < size; i++) { | 749 | 62 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 750 | 62 | typename ToDataType::FieldType, | 751 | 62 | multiply_may_overflow, narrow_integral>( | 752 | 62 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 753 | 62 | scale_multiplier, min_result, max_result, params)) { | 754 | 62 | if (set_nullable) { | 755 | 62 | null_map_data[i] = 1; | 756 | 62 | } else { | 757 | 62 | return params.status; | 758 | 62 | } | 759 | 62 | } | 760 | 62 | } | 761 | 62 | return Status::OK(); | 762 | 62 | }, | 763 | 62 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 764 | | | 765 | 14 | if (narrow_integral) { | 766 | 12 | block.get_by_position(result).column = | 767 | 12 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 768 | 12 | } else { | 769 | 2 | block.get_by_position(result).column = std::move(col_to); | 770 | 2 | } | 771 | 14 | return Status::OK(); | 772 | 62 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE7EEENS_15DataTypeDecimalILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 686 | 26 | const NullMap::value_type* null_map = nullptr) const override { | 687 | 26 | using FromFieldType = typename FromDataType::FieldType; | 688 | 26 | using ToFieldType = typename ToDataType::FieldType; | 689 | 26 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 690 | 26 | const auto* col_from = | 691 | 26 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 692 | 26 | if (!col_from) { | 693 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 694 | 0 | named_from.column->get_name()); | 695 | 0 | } | 696 | | | 697 | 26 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 698 | 26 | constexpr UInt32 from_scale = 0; | 699 | | | 700 | 26 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 701 | 26 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 702 | 26 | UInt32 to_precision = to_decimal_type.get_precision(); | 703 | 26 | ToDataType::check_type_precision(to_precision); | 704 | 26 | UInt32 to_scale = to_decimal_type.get_scale(); | 705 | 26 | ToDataType::check_type_scale(to_scale); | 706 | | | 707 | 26 | auto from_max_int_digit_count = from_precision - from_scale; | 708 | 26 | auto to_max_int_digit_count = to_precision - to_scale; | 709 | | // may overflow. nullable result column. | 710 | 26 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 711 | | // only in non-strict mode and may overflow, we set nullable | 712 | 26 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 713 | | | 714 | 26 | constexpr UInt32 to_max_digits = | 715 | 26 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 716 | 26 | bool multiply_may_overflow = false; | 717 | 26 | if (to_scale > from_scale) { | 718 | 16 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 719 | 16 | } | 720 | 26 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 721 | 26 | sizeof(typename ToFieldType::NativeType)), | 722 | 26 | FromFieldType, typename ToFieldType::NativeType>; | 723 | 26 | MaxNativeType scale_multiplier = | 724 | 26 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 725 | 26 | typename ToFieldType::NativeType max_result = | 726 | 26 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 727 | 26 | typename ToFieldType::NativeType min_result = -max_result; | 728 | | | 729 | 26 | ColumnUInt8::MutablePtr col_null_map_to; | 730 | 26 | NullMap::value_type* null_map_data = nullptr; | 731 | 26 | if (narrow_integral) { | 732 | 24 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 733 | 24 | null_map_data = col_null_map_to->get_data().data(); | 734 | 24 | } | 735 | | | 736 | 26 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 737 | 26 | const auto& vec_from = col_from->get_data(); | 738 | 26 | const auto* vec_from_data = vec_from.data(); | 739 | 26 | auto& vec_to = col_to->get_data(); | 740 | 26 | auto* vec_to_data = vec_to.data(); | 741 | | | 742 | 26 | CastParameters params; | 743 | 26 | params.is_strict = (CastMode == CastModeType::StrictMode); | 744 | 26 | size_t size = vec_from.size(); | 745 | | | 746 | 26 | RETURN_IF_ERROR(std::visit( | 747 | 26 | [&](auto multiply_may_overflow, auto narrow_integral) { | 748 | 26 | for (size_t i = 0; i < size; i++) { | 749 | 26 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 750 | 26 | typename ToDataType::FieldType, | 751 | 26 | multiply_may_overflow, narrow_integral>( | 752 | 26 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 753 | 26 | scale_multiplier, min_result, max_result, params)) { | 754 | 26 | if (set_nullable) { | 755 | 26 | null_map_data[i] = 1; | 756 | 26 | } else { | 757 | 26 | return params.status; | 758 | 26 | } | 759 | 26 | } | 760 | 26 | } | 761 | 26 | return Status::OK(); | 762 | 26 | }, | 763 | 26 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 764 | | | 765 | 26 | if (narrow_integral) { | 766 | 24 | block.get_by_position(result).column = | 767 | 24 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 768 | 24 | } else { | 769 | 2 | block.get_by_position(result).column = std::move(col_to); | 770 | 2 | } | 771 | 26 | return Status::OK(); | 772 | 26 | } |
|
773 | | }; |
774 | | |
775 | | // cast float and double to decimal. ALWAYS nullable result column. |
776 | | template <CastModeType CastMode, typename FromDataType, typename ToDataType> |
777 | | requires(IsDataTypeDecimal<ToDataType> && IsDataTypeFloat<FromDataType>) |
778 | | class CastToImpl<CastMode, FromDataType, ToDataType> : public CastToBase { |
779 | | public: |
780 | | Status execute_impl(FunctionContext* context, Block& block, const ColumnNumbers& arguments, |
781 | | uint32_t result, size_t input_rows_count, |
782 | 1.56k | const NullMap::value_type* null_map = nullptr) const override { |
783 | 1.56k | using FromFieldType = typename FromDataType::FieldType; |
784 | 1.56k | using ToFieldType = typename ToDataType::FieldType; |
785 | 1.56k | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); |
786 | 1.56k | const auto* col_from = |
787 | 1.56k | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); |
788 | 1.56k | if (!col_from) { |
789 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", |
790 | 0 | named_from.column->get_name()); |
791 | 0 | } |
792 | | |
793 | 1.56k | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); |
794 | 1.56k | UInt32 from_scale = 0; |
795 | | |
796 | 1.56k | const ColumnWithTypeAndName& named_to = block.get_by_position(result); |
797 | 1.56k | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); |
798 | 1.56k | UInt32 to_precision = to_decimal_type.get_precision(); |
799 | 1.56k | ToDataType::check_type_precision(to_precision); |
800 | 1.56k | UInt32 to_scale = to_decimal_type.get_scale(); |
801 | 1.56k | ToDataType::check_type_scale(to_scale); |
802 | | |
803 | 1.56k | auto from_max_int_digit_count = from_precision - from_scale; |
804 | 1.56k | auto to_max_int_digit_count = to_precision - to_scale; |
805 | 1.56k | bool narrow_integral = |
806 | 1.56k | (to_max_int_digit_count < from_max_int_digit_count) || |
807 | 1.56k | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); |
808 | | // only in non-strict mode and may overflow, we set nullable |
809 | 1.56k | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; |
810 | | |
811 | 1.56k | ColumnUInt8::MutablePtr col_null_map_to = ColumnUInt8::create(input_rows_count, 0); |
812 | 1.56k | NullMap::value_type* null_map_data = col_null_map_to->get_data().data(); |
813 | | |
814 | 1.56k | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); |
815 | 1.56k | const auto& vec_from = col_from->get_data(); |
816 | 1.56k | const auto* vec_from_data = vec_from.data(); |
817 | 1.56k | auto& vec_to = col_to->get_data(); |
818 | 1.56k | auto* vec_to_data = vec_to.data(); |
819 | | |
820 | 1.56k | CastParameters params; |
821 | 1.56k | params.is_strict = (CastMode == CastModeType::StrictMode); |
822 | 1.56k | size_t size = vec_from.size(); |
823 | | |
824 | 1.56k | typename ToFieldType::NativeType scale_multiplier = |
825 | 1.56k | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); |
826 | 1.56k | typename ToFieldType::NativeType max_result = |
827 | 1.56k | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); |
828 | 1.56k | typename ToFieldType::NativeType min_result = -max_result; |
829 | 7.98k | for (size_t i = 0; i < size; i++) { |
830 | 6.70k | if (!CastToDecimal::_from_float<typename FromDataType::FieldType, |
831 | 6.70k | typename ToDataType::FieldType>( |
832 | 6.70k | vec_from_data[i], vec_to_data[i], to_precision, to_scale, scale_multiplier, |
833 | 6.70k | min_result, max_result, params)) { |
834 | 576 | if (set_nullable) { |
835 | 288 | null_map_data[i] = 1; |
836 | 288 | } else { |
837 | 288 | return params.status; |
838 | 288 | } |
839 | 576 | } |
840 | 6.70k | } |
841 | | |
842 | 1.28k | block.get_by_position(result).column = |
843 | 1.28k | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); |
844 | 1.28k | return Status::OK(); |
845 | 1.56k | } Unexecuted instantiation: _ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE8EEENS_15DataTypeDecimalILS3_20EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Unexecuted instantiation: _ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE8EEENS_15DataTypeDecimalILS3_20EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Unexecuted instantiation: _ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE9EEENS_15DataTypeDecimalILS3_20EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Unexecuted instantiation: _ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE9EEENS_15DataTypeDecimalILS3_20EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh _ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE8EEENS_15DataTypeDecimalILS3_28EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 782 | 36 | const NullMap::value_type* null_map = nullptr) const override { | 783 | 36 | using FromFieldType = typename FromDataType::FieldType; | 784 | 36 | using ToFieldType = typename ToDataType::FieldType; | 785 | 36 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 786 | 36 | const auto* col_from = | 787 | 36 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 788 | 36 | if (!col_from) { | 789 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 790 | 0 | named_from.column->get_name()); | 791 | 0 | } | 792 | | | 793 | 36 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 794 | 36 | UInt32 from_scale = 0; | 795 | | | 796 | 36 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 797 | 36 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 798 | 36 | UInt32 to_precision = to_decimal_type.get_precision(); | 799 | 36 | ToDataType::check_type_precision(to_precision); | 800 | 36 | UInt32 to_scale = to_decimal_type.get_scale(); | 801 | 36 | ToDataType::check_type_scale(to_scale); | 802 | | | 803 | 36 | auto from_max_int_digit_count = from_precision - from_scale; | 804 | 36 | auto to_max_int_digit_count = to_precision - to_scale; | 805 | 36 | bool narrow_integral = | 806 | 36 | (to_max_int_digit_count < from_max_int_digit_count) || | 807 | 36 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 808 | | // only in non-strict mode and may overflow, we set nullable | 809 | 36 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 810 | | | 811 | 36 | ColumnUInt8::MutablePtr col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 812 | 36 | NullMap::value_type* null_map_data = col_null_map_to->get_data().data(); | 813 | | | 814 | 36 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 815 | 36 | const auto& vec_from = col_from->get_data(); | 816 | 36 | const auto* vec_from_data = vec_from.data(); | 817 | 36 | auto& vec_to = col_to->get_data(); | 818 | 36 | auto* vec_to_data = vec_to.data(); | 819 | | | 820 | 36 | CastParameters params; | 821 | 36 | params.is_strict = (CastMode == CastModeType::StrictMode); | 822 | 36 | size_t size = vec_from.size(); | 823 | | | 824 | 36 | typename ToFieldType::NativeType scale_multiplier = | 825 | 36 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 826 | 36 | typename ToFieldType::NativeType max_result = | 827 | 36 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 828 | 36 | typename ToFieldType::NativeType min_result = -max_result; | 829 | 36 | for (size_t i = 0; i < size; i++) { | 830 | 36 | if (!CastToDecimal::_from_float<typename FromDataType::FieldType, | 831 | 36 | typename ToDataType::FieldType>( | 832 | 36 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, scale_multiplier, | 833 | 36 | min_result, max_result, params)) { | 834 | 36 | if (set_nullable) { | 835 | 0 | null_map_data[i] = 1; | 836 | 36 | } else { | 837 | 36 | return params.status; | 838 | 36 | } | 839 | 36 | } | 840 | 36 | } | 841 | | | 842 | 0 | block.get_by_position(result).column = | 843 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 844 | 0 | return Status::OK(); | 845 | 36 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE8EEENS_15DataTypeDecimalILS3_28EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 782 | 162 | const NullMap::value_type* null_map = nullptr) const override { | 783 | 162 | using FromFieldType = typename FromDataType::FieldType; | 784 | 162 | using ToFieldType = typename ToDataType::FieldType; | 785 | 162 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 786 | 162 | const auto* col_from = | 787 | 162 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 788 | 162 | if (!col_from) { | 789 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 790 | 0 | named_from.column->get_name()); | 791 | 0 | } | 792 | | | 793 | 162 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 794 | 162 | UInt32 from_scale = 0; | 795 | | | 796 | 162 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 797 | 162 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 798 | 162 | UInt32 to_precision = to_decimal_type.get_precision(); | 799 | 162 | ToDataType::check_type_precision(to_precision); | 800 | 162 | UInt32 to_scale = to_decimal_type.get_scale(); | 801 | 162 | ToDataType::check_type_scale(to_scale); | 802 | | | 803 | 162 | auto from_max_int_digit_count = from_precision - from_scale; | 804 | 162 | auto to_max_int_digit_count = to_precision - to_scale; | 805 | 162 | bool narrow_integral = | 806 | 162 | (to_max_int_digit_count < from_max_int_digit_count) || | 807 | 162 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 808 | | // only in non-strict mode and may overflow, we set nullable | 809 | 162 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 810 | | | 811 | 162 | ColumnUInt8::MutablePtr col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 812 | 162 | NullMap::value_type* null_map_data = col_null_map_to->get_data().data(); | 813 | | | 814 | 162 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 815 | 162 | const auto& vec_from = col_from->get_data(); | 816 | 162 | const auto* vec_from_data = vec_from.data(); | 817 | 162 | auto& vec_to = col_to->get_data(); | 818 | 162 | auto* vec_to_data = vec_to.data(); | 819 | | | 820 | 162 | CastParameters params; | 821 | 162 | params.is_strict = (CastMode == CastModeType::StrictMode); | 822 | 162 | size_t size = vec_from.size(); | 823 | | | 824 | 162 | typename ToFieldType::NativeType scale_multiplier = | 825 | 162 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 826 | 162 | typename ToFieldType::NativeType max_result = | 827 | 162 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 828 | 162 | typename ToFieldType::NativeType min_result = -max_result; | 829 | 982 | for (size_t i = 0; i < size; i++) { | 830 | 820 | if (!CastToDecimal::_from_float<typename FromDataType::FieldType, | 831 | 820 | typename ToDataType::FieldType>( | 832 | 820 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, scale_multiplier, | 833 | 820 | min_result, max_result, params)) { | 834 | 36 | if (set_nullable) { | 835 | 36 | null_map_data[i] = 1; | 836 | 36 | } else { | 837 | 0 | return params.status; | 838 | 0 | } | 839 | 36 | } | 840 | 820 | } | 841 | | | 842 | 162 | block.get_by_position(result).column = | 843 | 162 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 844 | 162 | return Status::OK(); | 845 | 162 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE9EEENS_15DataTypeDecimalILS3_28EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 782 | 36 | const NullMap::value_type* null_map = nullptr) const override { | 783 | 36 | using FromFieldType = typename FromDataType::FieldType; | 784 | 36 | using ToFieldType = typename ToDataType::FieldType; | 785 | 36 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 786 | 36 | const auto* col_from = | 787 | 36 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 788 | 36 | if (!col_from) { | 789 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 790 | 0 | named_from.column->get_name()); | 791 | 0 | } | 792 | | | 793 | 36 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 794 | 36 | UInt32 from_scale = 0; | 795 | | | 796 | 36 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 797 | 36 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 798 | 36 | UInt32 to_precision = to_decimal_type.get_precision(); | 799 | 36 | ToDataType::check_type_precision(to_precision); | 800 | 36 | UInt32 to_scale = to_decimal_type.get_scale(); | 801 | 36 | ToDataType::check_type_scale(to_scale); | 802 | | | 803 | 36 | auto from_max_int_digit_count = from_precision - from_scale; | 804 | 36 | auto to_max_int_digit_count = to_precision - to_scale; | 805 | 36 | bool narrow_integral = | 806 | 36 | (to_max_int_digit_count < from_max_int_digit_count) || | 807 | 36 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 808 | | // only in non-strict mode and may overflow, we set nullable | 809 | 36 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 810 | | | 811 | 36 | ColumnUInt8::MutablePtr col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 812 | 36 | NullMap::value_type* null_map_data = col_null_map_to->get_data().data(); | 813 | | | 814 | 36 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 815 | 36 | const auto& vec_from = col_from->get_data(); | 816 | 36 | const auto* vec_from_data = vec_from.data(); | 817 | 36 | auto& vec_to = col_to->get_data(); | 818 | 36 | auto* vec_to_data = vec_to.data(); | 819 | | | 820 | 36 | CastParameters params; | 821 | 36 | params.is_strict = (CastMode == CastModeType::StrictMode); | 822 | 36 | size_t size = vec_from.size(); | 823 | | | 824 | 36 | typename ToFieldType::NativeType scale_multiplier = | 825 | 36 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 826 | 36 | typename ToFieldType::NativeType max_result = | 827 | 36 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 828 | 36 | typename ToFieldType::NativeType min_result = -max_result; | 829 | 36 | for (size_t i = 0; i < size; i++) { | 830 | 36 | if (!CastToDecimal::_from_float<typename FromDataType::FieldType, | 831 | 36 | typename ToDataType::FieldType>( | 832 | 36 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, scale_multiplier, | 833 | 36 | min_result, max_result, params)) { | 834 | 36 | if (set_nullable) { | 835 | 0 | null_map_data[i] = 1; | 836 | 36 | } else { | 837 | 36 | return params.status; | 838 | 36 | } | 839 | 36 | } | 840 | 36 | } | 841 | | | 842 | 0 | block.get_by_position(result).column = | 843 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 844 | 0 | return Status::OK(); | 845 | 36 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE9EEENS_15DataTypeDecimalILS3_28EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 782 | 170 | const NullMap::value_type* null_map = nullptr) const override { | 783 | 170 | using FromFieldType = typename FromDataType::FieldType; | 784 | 170 | using ToFieldType = typename ToDataType::FieldType; | 785 | 170 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 786 | 170 | const auto* col_from = | 787 | 170 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 788 | 170 | if (!col_from) { | 789 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 790 | 0 | named_from.column->get_name()); | 791 | 0 | } | 792 | | | 793 | 170 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 794 | 170 | UInt32 from_scale = 0; | 795 | | | 796 | 170 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 797 | 170 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 798 | 170 | UInt32 to_precision = to_decimal_type.get_precision(); | 799 | 170 | ToDataType::check_type_precision(to_precision); | 800 | 170 | UInt32 to_scale = to_decimal_type.get_scale(); | 801 | 170 | ToDataType::check_type_scale(to_scale); | 802 | | | 803 | 170 | auto from_max_int_digit_count = from_precision - from_scale; | 804 | 170 | auto to_max_int_digit_count = to_precision - to_scale; | 805 | 170 | bool narrow_integral = | 806 | 170 | (to_max_int_digit_count < from_max_int_digit_count) || | 807 | 170 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 808 | | // only in non-strict mode and may overflow, we set nullable | 809 | 170 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 810 | | | 811 | 170 | ColumnUInt8::MutablePtr col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 812 | 170 | NullMap::value_type* null_map_data = col_null_map_to->get_data().data(); | 813 | | | 814 | 170 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 815 | 170 | const auto& vec_from = col_from->get_data(); | 816 | 170 | const auto* vec_from_data = vec_from.data(); | 817 | 170 | auto& vec_to = col_to->get_data(); | 818 | 170 | auto* vec_to_data = vec_to.data(); | 819 | | | 820 | 170 | CastParameters params; | 821 | 170 | params.is_strict = (CastMode == CastModeType::StrictMode); | 822 | 170 | size_t size = vec_from.size(); | 823 | | | 824 | 170 | typename ToFieldType::NativeType scale_multiplier = | 825 | 170 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 826 | 170 | typename ToFieldType::NativeType max_result = | 827 | 170 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 828 | 170 | typename ToFieldType::NativeType min_result = -max_result; | 829 | 1.01k | for (size_t i = 0; i < size; i++) { | 830 | 844 | if (!CastToDecimal::_from_float<typename FromDataType::FieldType, | 831 | 844 | typename ToDataType::FieldType>( | 832 | 844 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, scale_multiplier, | 833 | 844 | min_result, max_result, params)) { | 834 | 36 | if (set_nullable) { | 835 | 36 | null_map_data[i] = 1; | 836 | 36 | } else { | 837 | 0 | return params.status; | 838 | 0 | } | 839 | 36 | } | 840 | 844 | } | 841 | | | 842 | 170 | block.get_by_position(result).column = | 843 | 170 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 844 | 170 | return Status::OK(); | 845 | 170 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE8EEENS_15DataTypeDecimalILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 782 | 36 | const NullMap::value_type* null_map = nullptr) const override { | 783 | 36 | using FromFieldType = typename FromDataType::FieldType; | 784 | 36 | using ToFieldType = typename ToDataType::FieldType; | 785 | 36 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 786 | 36 | const auto* col_from = | 787 | 36 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 788 | 36 | if (!col_from) { | 789 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 790 | 0 | named_from.column->get_name()); | 791 | 0 | } | 792 | | | 793 | 36 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 794 | 36 | UInt32 from_scale = 0; | 795 | | | 796 | 36 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 797 | 36 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 798 | 36 | UInt32 to_precision = to_decimal_type.get_precision(); | 799 | 36 | ToDataType::check_type_precision(to_precision); | 800 | 36 | UInt32 to_scale = to_decimal_type.get_scale(); | 801 | 36 | ToDataType::check_type_scale(to_scale); | 802 | | | 803 | 36 | auto from_max_int_digit_count = from_precision - from_scale; | 804 | 36 | auto to_max_int_digit_count = to_precision - to_scale; | 805 | 36 | bool narrow_integral = | 806 | 36 | (to_max_int_digit_count < from_max_int_digit_count) || | 807 | 36 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 808 | | // only in non-strict mode and may overflow, we set nullable | 809 | 36 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 810 | | | 811 | 36 | ColumnUInt8::MutablePtr col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 812 | 36 | NullMap::value_type* null_map_data = col_null_map_to->get_data().data(); | 813 | | | 814 | 36 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 815 | 36 | const auto& vec_from = col_from->get_data(); | 816 | 36 | const auto* vec_from_data = vec_from.data(); | 817 | 36 | auto& vec_to = col_to->get_data(); | 818 | 36 | auto* vec_to_data = vec_to.data(); | 819 | | | 820 | 36 | CastParameters params; | 821 | 36 | params.is_strict = (CastMode == CastModeType::StrictMode); | 822 | 36 | size_t size = vec_from.size(); | 823 | | | 824 | 36 | typename ToFieldType::NativeType scale_multiplier = | 825 | 36 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 826 | 36 | typename ToFieldType::NativeType max_result = | 827 | 36 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 828 | 36 | typename ToFieldType::NativeType min_result = -max_result; | 829 | 36 | for (size_t i = 0; i < size; i++) { | 830 | 36 | if (!CastToDecimal::_from_float<typename FromDataType::FieldType, | 831 | 36 | typename ToDataType::FieldType>( | 832 | 36 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, scale_multiplier, | 833 | 36 | min_result, max_result, params)) { | 834 | 36 | if (set_nullable) { | 835 | 0 | null_map_data[i] = 1; | 836 | 36 | } else { | 837 | 36 | return params.status; | 838 | 36 | } | 839 | 36 | } | 840 | 36 | } | 841 | | | 842 | 0 | block.get_by_position(result).column = | 843 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 844 | 0 | return Status::OK(); | 845 | 36 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE8EEENS_15DataTypeDecimalILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 782 | 162 | const NullMap::value_type* null_map = nullptr) const override { | 783 | 162 | using FromFieldType = typename FromDataType::FieldType; | 784 | 162 | using ToFieldType = typename ToDataType::FieldType; | 785 | 162 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 786 | 162 | const auto* col_from = | 787 | 162 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 788 | 162 | if (!col_from) { | 789 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 790 | 0 | named_from.column->get_name()); | 791 | 0 | } | 792 | | | 793 | 162 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 794 | 162 | UInt32 from_scale = 0; | 795 | | | 796 | 162 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 797 | 162 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 798 | 162 | UInt32 to_precision = to_decimal_type.get_precision(); | 799 | 162 | ToDataType::check_type_precision(to_precision); | 800 | 162 | UInt32 to_scale = to_decimal_type.get_scale(); | 801 | 162 | ToDataType::check_type_scale(to_scale); | 802 | | | 803 | 162 | auto from_max_int_digit_count = from_precision - from_scale; | 804 | 162 | auto to_max_int_digit_count = to_precision - to_scale; | 805 | 162 | bool narrow_integral = | 806 | 162 | (to_max_int_digit_count < from_max_int_digit_count) || | 807 | 162 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 808 | | // only in non-strict mode and may overflow, we set nullable | 809 | 162 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 810 | | | 811 | 162 | ColumnUInt8::MutablePtr col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 812 | 162 | NullMap::value_type* null_map_data = col_null_map_to->get_data().data(); | 813 | | | 814 | 162 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 815 | 162 | const auto& vec_from = col_from->get_data(); | 816 | 162 | const auto* vec_from_data = vec_from.data(); | 817 | 162 | auto& vec_to = col_to->get_data(); | 818 | 162 | auto* vec_to_data = vec_to.data(); | 819 | | | 820 | 162 | CastParameters params; | 821 | 162 | params.is_strict = (CastMode == CastModeType::StrictMode); | 822 | 162 | size_t size = vec_from.size(); | 823 | | | 824 | 162 | typename ToFieldType::NativeType scale_multiplier = | 825 | 162 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 826 | 162 | typename ToFieldType::NativeType max_result = | 827 | 162 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 828 | 162 | typename ToFieldType::NativeType min_result = -max_result; | 829 | 886 | for (size_t i = 0; i < size; i++) { | 830 | 724 | if (!CastToDecimal::_from_float<typename FromDataType::FieldType, | 831 | 724 | typename ToDataType::FieldType>( | 832 | 724 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, scale_multiplier, | 833 | 724 | min_result, max_result, params)) { | 834 | 36 | if (set_nullable) { | 835 | 36 | null_map_data[i] = 1; | 836 | 36 | } else { | 837 | 0 | return params.status; | 838 | 0 | } | 839 | 36 | } | 840 | 724 | } | 841 | | | 842 | 162 | block.get_by_position(result).column = | 843 | 162 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 844 | 162 | return Status::OK(); | 845 | 162 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE9EEENS_15DataTypeDecimalILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 782 | 36 | const NullMap::value_type* null_map = nullptr) const override { | 783 | 36 | using FromFieldType = typename FromDataType::FieldType; | 784 | 36 | using ToFieldType = typename ToDataType::FieldType; | 785 | 36 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 786 | 36 | const auto* col_from = | 787 | 36 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 788 | 36 | if (!col_from) { | 789 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 790 | 0 | named_from.column->get_name()); | 791 | 0 | } | 792 | | | 793 | 36 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 794 | 36 | UInt32 from_scale = 0; | 795 | | | 796 | 36 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 797 | 36 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 798 | 36 | UInt32 to_precision = to_decimal_type.get_precision(); | 799 | 36 | ToDataType::check_type_precision(to_precision); | 800 | 36 | UInt32 to_scale = to_decimal_type.get_scale(); | 801 | 36 | ToDataType::check_type_scale(to_scale); | 802 | | | 803 | 36 | auto from_max_int_digit_count = from_precision - from_scale; | 804 | 36 | auto to_max_int_digit_count = to_precision - to_scale; | 805 | 36 | bool narrow_integral = | 806 | 36 | (to_max_int_digit_count < from_max_int_digit_count) || | 807 | 36 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 808 | | // only in non-strict mode and may overflow, we set nullable | 809 | 36 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 810 | | | 811 | 36 | ColumnUInt8::MutablePtr col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 812 | 36 | NullMap::value_type* null_map_data = col_null_map_to->get_data().data(); | 813 | | | 814 | 36 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 815 | 36 | const auto& vec_from = col_from->get_data(); | 816 | 36 | const auto* vec_from_data = vec_from.data(); | 817 | 36 | auto& vec_to = col_to->get_data(); | 818 | 36 | auto* vec_to_data = vec_to.data(); | 819 | | | 820 | 36 | CastParameters params; | 821 | 36 | params.is_strict = (CastMode == CastModeType::StrictMode); | 822 | 36 | size_t size = vec_from.size(); | 823 | | | 824 | 36 | typename ToFieldType::NativeType scale_multiplier = | 825 | 36 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 826 | 36 | typename ToFieldType::NativeType max_result = | 827 | 36 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 828 | 36 | typename ToFieldType::NativeType min_result = -max_result; | 829 | 36 | for (size_t i = 0; i < size; i++) { | 830 | 36 | if (!CastToDecimal::_from_float<typename FromDataType::FieldType, | 831 | 36 | typename ToDataType::FieldType>( | 832 | 36 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, scale_multiplier, | 833 | 36 | min_result, max_result, params)) { | 834 | 36 | if (set_nullable) { | 835 | 0 | null_map_data[i] = 1; | 836 | 36 | } else { | 837 | 36 | return params.status; | 838 | 36 | } | 839 | 36 | } | 840 | 36 | } | 841 | | | 842 | 0 | block.get_by_position(result).column = | 843 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 844 | 0 | return Status::OK(); | 845 | 36 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE9EEENS_15DataTypeDecimalILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 782 | 162 | const NullMap::value_type* null_map = nullptr) const override { | 783 | 162 | using FromFieldType = typename FromDataType::FieldType; | 784 | 162 | using ToFieldType = typename ToDataType::FieldType; | 785 | 162 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 786 | 162 | const auto* col_from = | 787 | 162 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 788 | 162 | if (!col_from) { | 789 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 790 | 0 | named_from.column->get_name()); | 791 | 0 | } | 792 | | | 793 | 162 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 794 | 162 | UInt32 from_scale = 0; | 795 | | | 796 | 162 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 797 | 162 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 798 | 162 | UInt32 to_precision = to_decimal_type.get_precision(); | 799 | 162 | ToDataType::check_type_precision(to_precision); | 800 | 162 | UInt32 to_scale = to_decimal_type.get_scale(); | 801 | 162 | ToDataType::check_type_scale(to_scale); | 802 | | | 803 | 162 | auto from_max_int_digit_count = from_precision - from_scale; | 804 | 162 | auto to_max_int_digit_count = to_precision - to_scale; | 805 | 162 | bool narrow_integral = | 806 | 162 | (to_max_int_digit_count < from_max_int_digit_count) || | 807 | 162 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 808 | | // only in non-strict mode and may overflow, we set nullable | 809 | 162 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 810 | | | 811 | 162 | ColumnUInt8::MutablePtr col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 812 | 162 | NullMap::value_type* null_map_data = col_null_map_to->get_data().data(); | 813 | | | 814 | 162 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 815 | 162 | const auto& vec_from = col_from->get_data(); | 816 | 162 | const auto* vec_from_data = vec_from.data(); | 817 | 162 | auto& vec_to = col_to->get_data(); | 818 | 162 | auto* vec_to_data = vec_to.data(); | 819 | | | 820 | 162 | CastParameters params; | 821 | 162 | params.is_strict = (CastMode == CastModeType::StrictMode); | 822 | 162 | size_t size = vec_from.size(); | 823 | | | 824 | 162 | typename ToFieldType::NativeType scale_multiplier = | 825 | 162 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 826 | 162 | typename ToFieldType::NativeType max_result = | 827 | 162 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 828 | 162 | typename ToFieldType::NativeType min_result = -max_result; | 829 | 982 | for (size_t i = 0; i < size; i++) { | 830 | 820 | if (!CastToDecimal::_from_float<typename FromDataType::FieldType, | 831 | 820 | typename ToDataType::FieldType>( | 832 | 820 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, scale_multiplier, | 833 | 820 | min_result, max_result, params)) { | 834 | 36 | if (set_nullable) { | 835 | 36 | null_map_data[i] = 1; | 836 | 36 | } else { | 837 | 0 | return params.status; | 838 | 0 | } | 839 | 36 | } | 840 | 820 | } | 841 | | | 842 | 162 | block.get_by_position(result).column = | 843 | 162 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 844 | 162 | return Status::OK(); | 845 | 162 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE8EEENS_15DataTypeDecimalILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 782 | 36 | const NullMap::value_type* null_map = nullptr) const override { | 783 | 36 | using FromFieldType = typename FromDataType::FieldType; | 784 | 36 | using ToFieldType = typename ToDataType::FieldType; | 785 | 36 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 786 | 36 | const auto* col_from = | 787 | 36 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 788 | 36 | if (!col_from) { | 789 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 790 | 0 | named_from.column->get_name()); | 791 | 0 | } | 792 | | | 793 | 36 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 794 | 36 | UInt32 from_scale = 0; | 795 | | | 796 | 36 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 797 | 36 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 798 | 36 | UInt32 to_precision = to_decimal_type.get_precision(); | 799 | 36 | ToDataType::check_type_precision(to_precision); | 800 | 36 | UInt32 to_scale = to_decimal_type.get_scale(); | 801 | 36 | ToDataType::check_type_scale(to_scale); | 802 | | | 803 | 36 | auto from_max_int_digit_count = from_precision - from_scale; | 804 | 36 | auto to_max_int_digit_count = to_precision - to_scale; | 805 | 36 | bool narrow_integral = | 806 | 36 | (to_max_int_digit_count < from_max_int_digit_count) || | 807 | 36 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 808 | | // only in non-strict mode and may overflow, we set nullable | 809 | 36 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 810 | | | 811 | 36 | ColumnUInt8::MutablePtr col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 812 | 36 | NullMap::value_type* null_map_data = col_null_map_to->get_data().data(); | 813 | | | 814 | 36 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 815 | 36 | const auto& vec_from = col_from->get_data(); | 816 | 36 | const auto* vec_from_data = vec_from.data(); | 817 | 36 | auto& vec_to = col_to->get_data(); | 818 | 36 | auto* vec_to_data = vec_to.data(); | 819 | | | 820 | 36 | CastParameters params; | 821 | 36 | params.is_strict = (CastMode == CastModeType::StrictMode); | 822 | 36 | size_t size = vec_from.size(); | 823 | | | 824 | 36 | typename ToFieldType::NativeType scale_multiplier = | 825 | 36 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 826 | 36 | typename ToFieldType::NativeType max_result = | 827 | 36 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 828 | 36 | typename ToFieldType::NativeType min_result = -max_result; | 829 | 36 | for (size_t i = 0; i < size; i++) { | 830 | 36 | if (!CastToDecimal::_from_float<typename FromDataType::FieldType, | 831 | 36 | typename ToDataType::FieldType>( | 832 | 36 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, scale_multiplier, | 833 | 36 | min_result, max_result, params)) { | 834 | 36 | if (set_nullable) { | 835 | 0 | null_map_data[i] = 1; | 836 | 36 | } else { | 837 | 36 | return params.status; | 838 | 36 | } | 839 | 36 | } | 840 | 36 | } | 841 | | | 842 | 0 | block.get_by_position(result).column = | 843 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 844 | 0 | return Status::OK(); | 845 | 36 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE8EEENS_15DataTypeDecimalILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 782 | 178 | const NullMap::value_type* null_map = nullptr) const override { | 783 | 178 | using FromFieldType = typename FromDataType::FieldType; | 784 | 178 | using ToFieldType = typename ToDataType::FieldType; | 785 | 178 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 786 | 178 | const auto* col_from = | 787 | 178 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 788 | 178 | if (!col_from) { | 789 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 790 | 0 | named_from.column->get_name()); | 791 | 0 | } | 792 | | | 793 | 178 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 794 | 178 | UInt32 from_scale = 0; | 795 | | | 796 | 178 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 797 | 178 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 798 | 178 | UInt32 to_precision = to_decimal_type.get_precision(); | 799 | 178 | ToDataType::check_type_precision(to_precision); | 800 | 178 | UInt32 to_scale = to_decimal_type.get_scale(); | 801 | 178 | ToDataType::check_type_scale(to_scale); | 802 | | | 803 | 178 | auto from_max_int_digit_count = from_precision - from_scale; | 804 | 178 | auto to_max_int_digit_count = to_precision - to_scale; | 805 | 178 | bool narrow_integral = | 806 | 178 | (to_max_int_digit_count < from_max_int_digit_count) || | 807 | 178 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 808 | | // only in non-strict mode and may overflow, we set nullable | 809 | 178 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 810 | | | 811 | 178 | ColumnUInt8::MutablePtr col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 812 | 178 | NullMap::value_type* null_map_data = col_null_map_to->get_data().data(); | 813 | | | 814 | 178 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 815 | 178 | const auto& vec_from = col_from->get_data(); | 816 | 178 | const auto* vec_from_data = vec_from.data(); | 817 | 178 | auto& vec_to = col_to->get_data(); | 818 | 178 | auto* vec_to_data = vec_to.data(); | 819 | | | 820 | 178 | CastParameters params; | 821 | 178 | params.is_strict = (CastMode == CastModeType::StrictMode); | 822 | 178 | size_t size = vec_from.size(); | 823 | | | 824 | 178 | typename ToFieldType::NativeType scale_multiplier = | 825 | 178 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 826 | 178 | typename ToFieldType::NativeType max_result = | 827 | 178 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 828 | 178 | typename ToFieldType::NativeType min_result = -max_result; | 829 | 1.03k | for (size_t i = 0; i < size; i++) { | 830 | 852 | if (!CastToDecimal::_from_float<typename FromDataType::FieldType, | 831 | 852 | typename ToDataType::FieldType>( | 832 | 852 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, scale_multiplier, | 833 | 852 | min_result, max_result, params)) { | 834 | 36 | if (set_nullable) { | 835 | 36 | null_map_data[i] = 1; | 836 | 36 | } else { | 837 | 0 | return params.status; | 838 | 0 | } | 839 | 36 | } | 840 | 852 | } | 841 | | | 842 | 178 | block.get_by_position(result).column = | 843 | 178 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 844 | 178 | return Status::OK(); | 845 | 178 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE9EEENS_15DataTypeDecimalILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 782 | 36 | const NullMap::value_type* null_map = nullptr) const override { | 783 | 36 | using FromFieldType = typename FromDataType::FieldType; | 784 | 36 | using ToFieldType = typename ToDataType::FieldType; | 785 | 36 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 786 | 36 | const auto* col_from = | 787 | 36 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 788 | 36 | if (!col_from) { | 789 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 790 | 0 | named_from.column->get_name()); | 791 | 0 | } | 792 | | | 793 | 36 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 794 | 36 | UInt32 from_scale = 0; | 795 | | | 796 | 36 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 797 | 36 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 798 | 36 | UInt32 to_precision = to_decimal_type.get_precision(); | 799 | 36 | ToDataType::check_type_precision(to_precision); | 800 | 36 | UInt32 to_scale = to_decimal_type.get_scale(); | 801 | 36 | ToDataType::check_type_scale(to_scale); | 802 | | | 803 | 36 | auto from_max_int_digit_count = from_precision - from_scale; | 804 | 36 | auto to_max_int_digit_count = to_precision - to_scale; | 805 | 36 | bool narrow_integral = | 806 | 36 | (to_max_int_digit_count < from_max_int_digit_count) || | 807 | 36 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 808 | | // only in non-strict mode and may overflow, we set nullable | 809 | 36 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 810 | | | 811 | 36 | ColumnUInt8::MutablePtr col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 812 | 36 | NullMap::value_type* null_map_data = col_null_map_to->get_data().data(); | 813 | | | 814 | 36 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 815 | 36 | const auto& vec_from = col_from->get_data(); | 816 | 36 | const auto* vec_from_data = vec_from.data(); | 817 | 36 | auto& vec_to = col_to->get_data(); | 818 | 36 | auto* vec_to_data = vec_to.data(); | 819 | | | 820 | 36 | CastParameters params; | 821 | 36 | params.is_strict = (CastMode == CastModeType::StrictMode); | 822 | 36 | size_t size = vec_from.size(); | 823 | | | 824 | 36 | typename ToFieldType::NativeType scale_multiplier = | 825 | 36 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 826 | 36 | typename ToFieldType::NativeType max_result = | 827 | 36 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 828 | 36 | typename ToFieldType::NativeType min_result = -max_result; | 829 | 36 | for (size_t i = 0; i < size; i++) { | 830 | 36 | if (!CastToDecimal::_from_float<typename FromDataType::FieldType, | 831 | 36 | typename ToDataType::FieldType>( | 832 | 36 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, scale_multiplier, | 833 | 36 | min_result, max_result, params)) { | 834 | 36 | if (set_nullable) { | 835 | 0 | null_map_data[i] = 1; | 836 | 36 | } else { | 837 | 36 | return params.status; | 838 | 36 | } | 839 | 36 | } | 840 | 36 | } | 841 | | | 842 | 0 | block.get_by_position(result).column = | 843 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 844 | 0 | return Status::OK(); | 845 | 36 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE9EEENS_15DataTypeDecimalILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 782 | 146 | const NullMap::value_type* null_map = nullptr) const override { | 783 | 146 | using FromFieldType = typename FromDataType::FieldType; | 784 | 146 | using ToFieldType = typename ToDataType::FieldType; | 785 | 146 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 786 | 146 | const auto* col_from = | 787 | 146 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 788 | 146 | if (!col_from) { | 789 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 790 | 0 | named_from.column->get_name()); | 791 | 0 | } | 792 | | | 793 | 146 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 794 | 146 | UInt32 from_scale = 0; | 795 | | | 796 | 146 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 797 | 146 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 798 | 146 | UInt32 to_precision = to_decimal_type.get_precision(); | 799 | 146 | ToDataType::check_type_precision(to_precision); | 800 | 146 | UInt32 to_scale = to_decimal_type.get_scale(); | 801 | 146 | ToDataType::check_type_scale(to_scale); | 802 | | | 803 | 146 | auto from_max_int_digit_count = from_precision - from_scale; | 804 | 146 | auto to_max_int_digit_count = to_precision - to_scale; | 805 | 146 | bool narrow_integral = | 806 | 146 | (to_max_int_digit_count < from_max_int_digit_count) || | 807 | 146 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 808 | | // only in non-strict mode and may overflow, we set nullable | 809 | 146 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 810 | | | 811 | 146 | ColumnUInt8::MutablePtr col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 812 | 146 | NullMap::value_type* null_map_data = col_null_map_to->get_data().data(); | 813 | | | 814 | 146 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 815 | 146 | const auto& vec_from = col_from->get_data(); | 816 | 146 | const auto* vec_from_data = vec_from.data(); | 817 | 146 | auto& vec_to = col_to->get_data(); | 818 | 146 | auto* vec_to_data = vec_to.data(); | 819 | | | 820 | 146 | CastParameters params; | 821 | 146 | params.is_strict = (CastMode == CastModeType::StrictMode); | 822 | 146 | size_t size = vec_from.size(); | 823 | | | 824 | 146 | typename ToFieldType::NativeType scale_multiplier = | 825 | 146 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 826 | 146 | typename ToFieldType::NativeType max_result = | 827 | 146 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 828 | 146 | typename ToFieldType::NativeType min_result = -max_result; | 829 | 854 | for (size_t i = 0; i < size; i++) { | 830 | 708 | if (!CastToDecimal::_from_float<typename FromDataType::FieldType, | 831 | 708 | typename ToDataType::FieldType>( | 832 | 708 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, scale_multiplier, | 833 | 708 | min_result, max_result, params)) { | 834 | 36 | if (set_nullable) { | 835 | 36 | null_map_data[i] = 1; | 836 | 36 | } else { | 837 | 0 | return params.status; | 838 | 0 | } | 839 | 36 | } | 840 | 708 | } | 841 | | | 842 | 146 | block.get_by_position(result).column = | 843 | 146 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 844 | 146 | return Status::OK(); | 845 | 146 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE8EEENS_15DataTypeDecimalILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 782 | 36 | const NullMap::value_type* null_map = nullptr) const override { | 783 | 36 | using FromFieldType = typename FromDataType::FieldType; | 784 | 36 | using ToFieldType = typename ToDataType::FieldType; | 785 | 36 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 786 | 36 | const auto* col_from = | 787 | 36 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 788 | 36 | if (!col_from) { | 789 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 790 | 0 | named_from.column->get_name()); | 791 | 0 | } | 792 | | | 793 | 36 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 794 | 36 | UInt32 from_scale = 0; | 795 | | | 796 | 36 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 797 | 36 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 798 | 36 | UInt32 to_precision = to_decimal_type.get_precision(); | 799 | 36 | ToDataType::check_type_precision(to_precision); | 800 | 36 | UInt32 to_scale = to_decimal_type.get_scale(); | 801 | 36 | ToDataType::check_type_scale(to_scale); | 802 | | | 803 | 36 | auto from_max_int_digit_count = from_precision - from_scale; | 804 | 36 | auto to_max_int_digit_count = to_precision - to_scale; | 805 | 36 | bool narrow_integral = | 806 | 36 | (to_max_int_digit_count < from_max_int_digit_count) || | 807 | 36 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 808 | | // only in non-strict mode and may overflow, we set nullable | 809 | 36 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 810 | | | 811 | 36 | ColumnUInt8::MutablePtr col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 812 | 36 | NullMap::value_type* null_map_data = col_null_map_to->get_data().data(); | 813 | | | 814 | 36 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 815 | 36 | const auto& vec_from = col_from->get_data(); | 816 | 36 | const auto* vec_from_data = vec_from.data(); | 817 | 36 | auto& vec_to = col_to->get_data(); | 818 | 36 | auto* vec_to_data = vec_to.data(); | 819 | | | 820 | 36 | CastParameters params; | 821 | 36 | params.is_strict = (CastMode == CastModeType::StrictMode); | 822 | 36 | size_t size = vec_from.size(); | 823 | | | 824 | 36 | typename ToFieldType::NativeType scale_multiplier = | 825 | 36 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 826 | 36 | typename ToFieldType::NativeType max_result = | 827 | 36 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 828 | 36 | typename ToFieldType::NativeType min_result = -max_result; | 829 | 36 | for (size_t i = 0; i < size; i++) { | 830 | 36 | if (!CastToDecimal::_from_float<typename FromDataType::FieldType, | 831 | 36 | typename ToDataType::FieldType>( | 832 | 36 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, scale_multiplier, | 833 | 36 | min_result, max_result, params)) { | 834 | 36 | if (set_nullable) { | 835 | 0 | null_map_data[i] = 1; | 836 | 36 | } else { | 837 | 36 | return params.status; | 838 | 36 | } | 839 | 36 | } | 840 | 36 | } | 841 | | | 842 | 0 | block.get_by_position(result).column = | 843 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 844 | 0 | return Status::OK(); | 845 | 36 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE8EEENS_15DataTypeDecimalILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 782 | 138 | const NullMap::value_type* null_map = nullptr) const override { | 783 | 138 | using FromFieldType = typename FromDataType::FieldType; | 784 | 138 | using ToFieldType = typename ToDataType::FieldType; | 785 | 138 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 786 | 138 | const auto* col_from = | 787 | 138 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 788 | 138 | if (!col_from) { | 789 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 790 | 0 | named_from.column->get_name()); | 791 | 0 | } | 792 | | | 793 | 138 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 794 | 138 | UInt32 from_scale = 0; | 795 | | | 796 | 138 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 797 | 138 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 798 | 138 | UInt32 to_precision = to_decimal_type.get_precision(); | 799 | 138 | ToDataType::check_type_precision(to_precision); | 800 | 138 | UInt32 to_scale = to_decimal_type.get_scale(); | 801 | 138 | ToDataType::check_type_scale(to_scale); | 802 | | | 803 | 138 | auto from_max_int_digit_count = from_precision - from_scale; | 804 | 138 | auto to_max_int_digit_count = to_precision - to_scale; | 805 | 138 | bool narrow_integral = | 806 | 138 | (to_max_int_digit_count < from_max_int_digit_count) || | 807 | 138 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 808 | | // only in non-strict mode and may overflow, we set nullable | 809 | 138 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 810 | | | 811 | 138 | ColumnUInt8::MutablePtr col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 812 | 138 | NullMap::value_type* null_map_data = col_null_map_to->get_data().data(); | 813 | | | 814 | 138 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 815 | 138 | const auto& vec_from = col_from->get_data(); | 816 | 138 | const auto* vec_from_data = vec_from.data(); | 817 | 138 | auto& vec_to = col_to->get_data(); | 818 | 138 | auto* vec_to_data = vec_to.data(); | 819 | | | 820 | 138 | CastParameters params; | 821 | 138 | params.is_strict = (CastMode == CastModeType::StrictMode); | 822 | 138 | size_t size = vec_from.size(); | 823 | | | 824 | 138 | typename ToFieldType::NativeType scale_multiplier = | 825 | 138 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 826 | 138 | typename ToFieldType::NativeType max_result = | 827 | 138 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 828 | 138 | typename ToFieldType::NativeType min_result = -max_result; | 829 | 950 | for (size_t i = 0; i < size; i++) { | 830 | 812 | if (!CastToDecimal::_from_float<typename FromDataType::FieldType, | 831 | 812 | typename ToDataType::FieldType>( | 832 | 812 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, scale_multiplier, | 833 | 812 | min_result, max_result, params)) { | 834 | 36 | if (set_nullable) { | 835 | 36 | null_map_data[i] = 1; | 836 | 36 | } else { | 837 | 0 | return params.status; | 838 | 0 | } | 839 | 36 | } | 840 | 812 | } | 841 | | | 842 | 138 | block.get_by_position(result).column = | 843 | 138 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 844 | 138 | return Status::OK(); | 845 | 138 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE9EEENS_15DataTypeDecimalILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 782 | 36 | const NullMap::value_type* null_map = nullptr) const override { | 783 | 36 | using FromFieldType = typename FromDataType::FieldType; | 784 | 36 | using ToFieldType = typename ToDataType::FieldType; | 785 | 36 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 786 | 36 | const auto* col_from = | 787 | 36 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 788 | 36 | if (!col_from) { | 789 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 790 | 0 | named_from.column->get_name()); | 791 | 0 | } | 792 | | | 793 | 36 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 794 | 36 | UInt32 from_scale = 0; | 795 | | | 796 | 36 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 797 | 36 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 798 | 36 | UInt32 to_precision = to_decimal_type.get_precision(); | 799 | 36 | ToDataType::check_type_precision(to_precision); | 800 | 36 | UInt32 to_scale = to_decimal_type.get_scale(); | 801 | 36 | ToDataType::check_type_scale(to_scale); | 802 | | | 803 | 36 | auto from_max_int_digit_count = from_precision - from_scale; | 804 | 36 | auto to_max_int_digit_count = to_precision - to_scale; | 805 | 36 | bool narrow_integral = | 806 | 36 | (to_max_int_digit_count < from_max_int_digit_count) || | 807 | 36 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 808 | | // only in non-strict mode and may overflow, we set nullable | 809 | 36 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 810 | | | 811 | 36 | ColumnUInt8::MutablePtr col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 812 | 36 | NullMap::value_type* null_map_data = col_null_map_to->get_data().data(); | 813 | | | 814 | 36 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 815 | 36 | const auto& vec_from = col_from->get_data(); | 816 | 36 | const auto* vec_from_data = vec_from.data(); | 817 | 36 | auto& vec_to = col_to->get_data(); | 818 | 36 | auto* vec_to_data = vec_to.data(); | 819 | | | 820 | 36 | CastParameters params; | 821 | 36 | params.is_strict = (CastMode == CastModeType::StrictMode); | 822 | 36 | size_t size = vec_from.size(); | 823 | | | 824 | 36 | typename ToFieldType::NativeType scale_multiplier = | 825 | 36 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 826 | 36 | typename ToFieldType::NativeType max_result = | 827 | 36 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 828 | 36 | typename ToFieldType::NativeType min_result = -max_result; | 829 | 36 | for (size_t i = 0; i < size; i++) { | 830 | 36 | if (!CastToDecimal::_from_float<typename FromDataType::FieldType, | 831 | 36 | typename ToDataType::FieldType>( | 832 | 36 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, scale_multiplier, | 833 | 36 | min_result, max_result, params)) { | 834 | 36 | if (set_nullable) { | 835 | 0 | null_map_data[i] = 1; | 836 | 36 | } else { | 837 | 36 | return params.status; | 838 | 36 | } | 839 | 36 | } | 840 | 36 | } | 841 | | | 842 | 0 | block.get_by_position(result).column = | 843 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 844 | 0 | return Status::OK(); | 845 | 36 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE9EEENS_15DataTypeDecimalILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 782 | 162 | const NullMap::value_type* null_map = nullptr) const override { | 783 | 162 | using FromFieldType = typename FromDataType::FieldType; | 784 | 162 | using ToFieldType = typename ToDataType::FieldType; | 785 | 162 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 786 | 162 | const auto* col_from = | 787 | 162 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 788 | 162 | if (!col_from) { | 789 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 790 | 0 | named_from.column->get_name()); | 791 | 0 | } | 792 | | | 793 | 162 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 794 | 162 | UInt32 from_scale = 0; | 795 | | | 796 | 162 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 797 | 162 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 798 | 162 | UInt32 to_precision = to_decimal_type.get_precision(); | 799 | 162 | ToDataType::check_type_precision(to_precision); | 800 | 162 | UInt32 to_scale = to_decimal_type.get_scale(); | 801 | 162 | ToDataType::check_type_scale(to_scale); | 802 | | | 803 | 162 | auto from_max_int_digit_count = from_precision - from_scale; | 804 | 162 | auto to_max_int_digit_count = to_precision - to_scale; | 805 | 162 | bool narrow_integral = | 806 | 162 | (to_max_int_digit_count < from_max_int_digit_count) || | 807 | 162 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 808 | | // only in non-strict mode and may overflow, we set nullable | 809 | 162 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 810 | | | 811 | 162 | ColumnUInt8::MutablePtr col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 812 | 162 | NullMap::value_type* null_map_data = col_null_map_to->get_data().data(); | 813 | | | 814 | 162 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 815 | 162 | const auto& vec_from = col_from->get_data(); | 816 | 162 | const auto* vec_from_data = vec_from.data(); | 817 | 162 | auto& vec_to = col_to->get_data(); | 818 | 162 | auto* vec_to_data = vec_to.data(); | 819 | | | 820 | 162 | CastParameters params; | 821 | 162 | params.is_strict = (CastMode == CastModeType::StrictMode); | 822 | 162 | size_t size = vec_from.size(); | 823 | | | 824 | 162 | typename ToFieldType::NativeType scale_multiplier = | 825 | 162 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 826 | 162 | typename ToFieldType::NativeType max_result = | 827 | 162 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 828 | 162 | typename ToFieldType::NativeType min_result = -max_result; | 829 | 998 | for (size_t i = 0; i < size; i++) { | 830 | 836 | if (!CastToDecimal::_from_float<typename FromDataType::FieldType, | 831 | 836 | typename ToDataType::FieldType>( | 832 | 836 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, scale_multiplier, | 833 | 836 | min_result, max_result, params)) { | 834 | 36 | if (set_nullable) { | 835 | 36 | null_map_data[i] = 1; | 836 | 36 | } else { | 837 | 0 | return params.status; | 838 | 0 | } | 839 | 36 | } | 840 | 836 | } | 841 | | | 842 | 162 | block.get_by_position(result).column = | 843 | 162 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 844 | 162 | return Status::OK(); | 845 | 162 | } |
|
846 | | }; |
847 | | |
848 | | // cast decimalv3 types to decimalv2 types |
849 | | template <CastModeType CastMode, typename FromDataType, typename ToDataType> |
850 | | requires(IsDataTypeDecimalV3<ToDataType> && IsDataTypeDecimalV2<ToDataType>) |
851 | | class CastToImpl<CastMode, FromDataType, ToDataType> : public CastToBase { |
852 | | public: |
853 | | Status execute_impl(FunctionContext* context, Block& block, const ColumnNumbers& arguments, |
854 | | uint32_t result, size_t input_rows_count, |
855 | | const NullMap::value_type* null_map = nullptr) const override { |
856 | | return Status::RuntimeError( |
857 | | "not support {} ", |
858 | | cast_mode_type_to_string(CastMode, block.get_by_position(arguments[0]).type, |
859 | | block.get_by_position(result).type)); |
860 | | } |
861 | | }; |
862 | | |
863 | | // cast decimalv2 types to decimalv3 types |
864 | | template <CastModeType CastMode, typename FromDataType, typename ToDataType> |
865 | | requires(IsDataTypeDecimalV2<FromDataType> && IsDataTypeDecimalV3<ToDataType>) |
866 | | class CastToImpl<CastMode, FromDataType, ToDataType> : public CastToBase { |
867 | | public: |
868 | | Status execute_impl(FunctionContext* context, Block& block, const ColumnNumbers& arguments, |
869 | | uint32_t result, size_t input_rows_count, |
870 | 1.21k | const NullMap::value_type* null_map = nullptr) const override { |
871 | 1.21k | using FromFieldType = typename FromDataType::FieldType; |
872 | 1.21k | using ToFieldType = typename ToDataType::FieldType; |
873 | 1.21k | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); |
874 | 1.21k | const auto* col_from = |
875 | 1.21k | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); |
876 | 1.21k | if (!col_from) { |
877 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", |
878 | 0 | named_from.column->get_name()); |
879 | 0 | } |
880 | | |
881 | 1.21k | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); |
882 | 1.21k | UInt32 from_precision = from_decimal_type.get_precision(); |
883 | 1.21k | UInt32 from_scale = from_decimal_type.get_scale(); |
884 | 1.21k | UInt32 from_original_precision = from_decimal_type.get_original_precision(); |
885 | 1.21k | UInt32 from_original_scale = from_decimal_type.get_original_scale(); |
886 | | |
887 | 1.21k | const ColumnWithTypeAndName& named_to = block.get_by_position(result); |
888 | 1.21k | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); |
889 | 1.21k | UInt32 to_precision = to_decimal_type.get_precision(); |
890 | 1.21k | ToDataType::check_type_precision(to_precision); |
891 | 1.21k | UInt32 to_scale = to_decimal_type.get_scale(); |
892 | 1.21k | ToDataType::check_type_scale(to_scale); |
893 | | |
894 | 1.21k | auto from_max_int_digit_count = from_original_precision - from_original_scale; |
895 | 1.21k | auto to_max_int_digit_count = to_precision - to_scale; |
896 | 1.21k | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count) || |
897 | 1.21k | (to_max_int_digit_count == from_max_int_digit_count && |
898 | 432 | to_scale < from_original_scale); |
899 | | // only in non-strict mode and may overflow, we set nullable |
900 | 1.21k | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; |
901 | | |
902 | 1.21k | size_t size = col_from->size(); |
903 | 1.21k | ColumnUInt8::MutablePtr col_null_map_to; |
904 | 1.21k | NullMap::value_type* null_map_data = nullptr; |
905 | 1.21k | if (narrow_integral) { |
906 | 820 | col_null_map_to = ColumnUInt8::create(size, 0); |
907 | 820 | null_map_data = col_null_map_to->get_data().data(); |
908 | 820 | } |
909 | 1.21k | CastParameters params; |
910 | 1.21k | params.is_strict = (CastMode == CastModeType::StrictMode); |
911 | 1.21k | auto col_to = ToDataType::ColumnType::create(size, to_scale); |
912 | 1.21k | const auto& vec_from = col_from->get_data(); |
913 | 1.21k | const auto* vec_from_data = vec_from.data(); |
914 | 1.21k | auto& vec_to = col_to->get_data(); |
915 | 1.21k | auto* vec_to_data = vec_to.data(); |
916 | | |
917 | 1.21k | using MaxFieldType = |
918 | 1.21k | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && |
919 | 1.21k | (std::is_same_v<ToFieldType, Decimal128V3> || |
920 | 1.21k | std::is_same_v<FromFieldType, Decimal128V3>), |
921 | 1.21k | Decimal128V3, |
922 | 1.21k | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), |
923 | 1.21k | FromFieldType, ToFieldType>>; |
924 | 1.21k | using MaxNativeType = typename MaxFieldType::NativeType; |
925 | | |
926 | 1.21k | constexpr UInt32 to_max_digits = |
927 | 1.21k | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); |
928 | 1.21k | bool multiply_may_overflow = false; |
929 | 1.21k | if (to_scale > from_scale) { |
930 | 372 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; |
931 | 372 | } |
932 | | |
933 | 1.21k | typename ToFieldType::NativeType max_result = |
934 | 1.21k | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); |
935 | 1.21k | typename ToFieldType::NativeType min_result = -max_result; |
936 | | |
937 | 1.21k | MaxNativeType multiplier {}; |
938 | 1.21k | if (from_scale < to_scale) { |
939 | 372 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - |
940 | 372 | from_scale); |
941 | 844 | } else if (from_scale > to_scale) { |
942 | 776 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - |
943 | 776 | to_scale); |
944 | 776 | } |
945 | 1.21k | RETURN_IF_ERROR(std::visit( |
946 | 1.21k | [&](auto multiply_may_overflow, auto narrow_integral) { |
947 | 1.21k | for (size_t i = 0; i < size; i++) { |
948 | 1.21k | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, |
949 | 1.21k | multiply_may_overflow, narrow_integral>( |
950 | 1.21k | vec_from_data[i], from_precision, from_scale, vec_to_data[i], |
951 | 1.21k | to_precision, to_scale, min_result, max_result, multiplier, |
952 | 1.21k | params)) { |
953 | 1.21k | if (set_nullable) { |
954 | 1.21k | null_map_data[i] = 1; |
955 | 1.21k | } else { |
956 | 1.21k | return params.status; |
957 | 1.21k | } |
958 | 1.21k | } |
959 | 1.21k | } |
960 | 1.21k | return Status::OK(); |
961 | 1.21k | }, |
962 | 1.21k | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); |
963 | 774 | if (narrow_integral) { |
964 | 378 | block.get_by_position(result).column = |
965 | 378 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); |
966 | 396 | } else { |
967 | 396 | block.get_by_position(result).column = std::move(col_to); |
968 | 396 | } |
969 | 774 | return Status::OK(); |
970 | 1.21k | } _ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEENS2_ILS3_28EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 870 | 174 | const NullMap::value_type* null_map = nullptr) const override { | 871 | 174 | using FromFieldType = typename FromDataType::FieldType; | 872 | 174 | using ToFieldType = typename ToDataType::FieldType; | 873 | 174 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 874 | 174 | const auto* col_from = | 875 | 174 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 876 | 174 | if (!col_from) { | 877 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 878 | 0 | named_from.column->get_name()); | 879 | 0 | } | 880 | | | 881 | 174 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 882 | 174 | UInt32 from_precision = from_decimal_type.get_precision(); | 883 | 174 | UInt32 from_scale = from_decimal_type.get_scale(); | 884 | 174 | UInt32 from_original_precision = from_decimal_type.get_original_precision(); | 885 | 174 | UInt32 from_original_scale = from_decimal_type.get_original_scale(); | 886 | | | 887 | 174 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 888 | 174 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 889 | 174 | UInt32 to_precision = to_decimal_type.get_precision(); | 890 | 174 | ToDataType::check_type_precision(to_precision); | 891 | 174 | UInt32 to_scale = to_decimal_type.get_scale(); | 892 | 174 | ToDataType::check_type_scale(to_scale); | 893 | | | 894 | 174 | auto from_max_int_digit_count = from_original_precision - from_original_scale; | 895 | 174 | auto to_max_int_digit_count = to_precision - to_scale; | 896 | 174 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count) || | 897 | 174 | (to_max_int_digit_count == from_max_int_digit_count && | 898 | 0 | to_scale < from_original_scale); | 899 | | // only in non-strict mode and may overflow, we set nullable | 900 | 174 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 901 | | | 902 | 174 | size_t size = col_from->size(); | 903 | 174 | ColumnUInt8::MutablePtr col_null_map_to; | 904 | 174 | NullMap::value_type* null_map_data = nullptr; | 905 | 174 | if (narrow_integral) { | 906 | 174 | col_null_map_to = ColumnUInt8::create(size, 0); | 907 | 174 | null_map_data = col_null_map_to->get_data().data(); | 908 | 174 | } | 909 | 174 | CastParameters params; | 910 | 174 | params.is_strict = (CastMode == CastModeType::StrictMode); | 911 | 174 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 912 | 174 | const auto& vec_from = col_from->get_data(); | 913 | 174 | const auto* vec_from_data = vec_from.data(); | 914 | 174 | auto& vec_to = col_to->get_data(); | 915 | 174 | auto* vec_to_data = vec_to.data(); | 916 | | | 917 | 174 | using MaxFieldType = | 918 | 174 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 919 | 174 | (std::is_same_v<ToFieldType, Decimal128V3> || | 920 | 174 | std::is_same_v<FromFieldType, Decimal128V3>), | 921 | 174 | Decimal128V3, | 922 | 174 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 923 | 174 | FromFieldType, ToFieldType>>; | 924 | 174 | using MaxNativeType = typename MaxFieldType::NativeType; | 925 | | | 926 | 174 | constexpr UInt32 to_max_digits = | 927 | 174 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 928 | 174 | bool multiply_may_overflow = false; | 929 | 174 | if (to_scale > from_scale) { | 930 | 0 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 931 | 0 | } | 932 | | | 933 | 174 | typename ToFieldType::NativeType max_result = | 934 | 174 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 935 | 174 | typename ToFieldType::NativeType min_result = -max_result; | 936 | | | 937 | 174 | MaxNativeType multiplier {}; | 938 | 174 | if (from_scale < to_scale) { | 939 | 0 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 940 | 0 | from_scale); | 941 | 174 | } else if (from_scale > to_scale) { | 942 | 156 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 943 | 156 | to_scale); | 944 | 156 | } | 945 | 174 | RETURN_IF_ERROR(std::visit( | 946 | 174 | [&](auto multiply_may_overflow, auto narrow_integral) { | 947 | 174 | for (size_t i = 0; i < size; i++) { | 948 | 174 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 949 | 174 | multiply_may_overflow, narrow_integral>( | 950 | 174 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 951 | 174 | to_precision, to_scale, min_result, max_result, multiplier, | 952 | 174 | params)) { | 953 | 174 | if (set_nullable) { | 954 | 174 | null_map_data[i] = 1; | 955 | 174 | } else { | 956 | 174 | return params.status; | 957 | 174 | } | 958 | 174 | } | 959 | 174 | } | 960 | 174 | return Status::OK(); | 961 | 174 | }, | 962 | 174 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 963 | 0 | if (narrow_integral) { | 964 | 0 | block.get_by_position(result).column = | 965 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 966 | 0 | } else { | 967 | 0 | block.get_by_position(result).column = std::move(col_to); | 968 | 0 | } | 969 | 0 | return Status::OK(); | 970 | 174 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEENS2_ILS3_28EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 870 | 148 | const NullMap::value_type* null_map = nullptr) const override { | 871 | 148 | using FromFieldType = typename FromDataType::FieldType; | 872 | 148 | using ToFieldType = typename ToDataType::FieldType; | 873 | 148 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 874 | 148 | const auto* col_from = | 875 | 148 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 876 | 148 | if (!col_from) { | 877 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 878 | 0 | named_from.column->get_name()); | 879 | 0 | } | 880 | | | 881 | 148 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 882 | 148 | UInt32 from_precision = from_decimal_type.get_precision(); | 883 | 148 | UInt32 from_scale = from_decimal_type.get_scale(); | 884 | 148 | UInt32 from_original_precision = from_decimal_type.get_original_precision(); | 885 | 148 | UInt32 from_original_scale = from_decimal_type.get_original_scale(); | 886 | | | 887 | 148 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 888 | 148 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 889 | 148 | UInt32 to_precision = to_decimal_type.get_precision(); | 890 | 148 | ToDataType::check_type_precision(to_precision); | 891 | 148 | UInt32 to_scale = to_decimal_type.get_scale(); | 892 | 148 | ToDataType::check_type_scale(to_scale); | 893 | | | 894 | 148 | auto from_max_int_digit_count = from_original_precision - from_original_scale; | 895 | 148 | auto to_max_int_digit_count = to_precision - to_scale; | 896 | 148 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count) || | 897 | 148 | (to_max_int_digit_count == from_max_int_digit_count && | 898 | 36 | to_scale < from_original_scale); | 899 | | // only in non-strict mode and may overflow, we set nullable | 900 | 148 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 901 | | | 902 | 148 | size_t size = col_from->size(); | 903 | 148 | ColumnUInt8::MutablePtr col_null_map_to; | 904 | 148 | NullMap::value_type* null_map_data = nullptr; | 905 | 148 | if (narrow_integral) { | 906 | 112 | col_null_map_to = ColumnUInt8::create(size, 0); | 907 | 112 | null_map_data = col_null_map_to->get_data().data(); | 908 | 112 | } | 909 | 148 | CastParameters params; | 910 | 148 | params.is_strict = (CastMode == CastModeType::StrictMode); | 911 | 148 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 912 | 148 | const auto& vec_from = col_from->get_data(); | 913 | 148 | const auto* vec_from_data = vec_from.data(); | 914 | 148 | auto& vec_to = col_to->get_data(); | 915 | 148 | auto* vec_to_data = vec_to.data(); | 916 | | | 917 | 148 | using MaxFieldType = | 918 | 148 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 919 | 148 | (std::is_same_v<ToFieldType, Decimal128V3> || | 920 | 148 | std::is_same_v<FromFieldType, Decimal128V3>), | 921 | 148 | Decimal128V3, | 922 | 148 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 923 | 148 | FromFieldType, ToFieldType>>; | 924 | 148 | using MaxNativeType = typename MaxFieldType::NativeType; | 925 | | | 926 | 148 | constexpr UInt32 to_max_digits = | 927 | 148 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 928 | 148 | bool multiply_may_overflow = false; | 929 | 148 | if (to_scale > from_scale) { | 930 | 0 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 931 | 0 | } | 932 | | | 933 | 148 | typename ToFieldType::NativeType max_result = | 934 | 148 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 935 | 148 | typename ToFieldType::NativeType min_result = -max_result; | 936 | | | 937 | 148 | MaxNativeType multiplier {}; | 938 | 148 | if (from_scale < to_scale) { | 939 | 0 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 940 | 0 | from_scale); | 941 | 148 | } else if (from_scale > to_scale) { | 942 | 134 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 943 | 134 | to_scale); | 944 | 134 | } | 945 | 148 | RETURN_IF_ERROR(std::visit( | 946 | 148 | [&](auto multiply_may_overflow, auto narrow_integral) { | 947 | 148 | for (size_t i = 0; i < size; i++) { | 948 | 148 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 949 | 148 | multiply_may_overflow, narrow_integral>( | 950 | 148 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 951 | 148 | to_precision, to_scale, min_result, max_result, multiplier, | 952 | 148 | params)) { | 953 | 148 | if (set_nullable) { | 954 | 148 | null_map_data[i] = 1; | 955 | 148 | } else { | 956 | 148 | return params.status; | 957 | 148 | } | 958 | 148 | } | 959 | 148 | } | 960 | 148 | return Status::OK(); | 961 | 148 | }, | 962 | 148 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 963 | 148 | if (narrow_integral) { | 964 | 112 | block.get_by_position(result).column = | 965 | 112 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 966 | 112 | } else { | 967 | 36 | block.get_by_position(result).column = std::move(col_to); | 968 | 36 | } | 969 | 148 | return Status::OK(); | 970 | 148 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEENS2_ILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 870 | 144 | const NullMap::value_type* null_map = nullptr) const override { | 871 | 144 | using FromFieldType = typename FromDataType::FieldType; | 872 | 144 | using ToFieldType = typename ToDataType::FieldType; | 873 | 144 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 874 | 144 | const auto* col_from = | 875 | 144 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 876 | 144 | if (!col_from) { | 877 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 878 | 0 | named_from.column->get_name()); | 879 | 0 | } | 880 | | | 881 | 144 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 882 | 144 | UInt32 from_precision = from_decimal_type.get_precision(); | 883 | 144 | UInt32 from_scale = from_decimal_type.get_scale(); | 884 | 144 | UInt32 from_original_precision = from_decimal_type.get_original_precision(); | 885 | 144 | UInt32 from_original_scale = from_decimal_type.get_original_scale(); | 886 | | | 887 | 144 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 888 | 144 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 889 | 144 | UInt32 to_precision = to_decimal_type.get_precision(); | 890 | 144 | ToDataType::check_type_precision(to_precision); | 891 | 144 | UInt32 to_scale = to_decimal_type.get_scale(); | 892 | 144 | ToDataType::check_type_scale(to_scale); | 893 | | | 894 | 144 | auto from_max_int_digit_count = from_original_precision - from_original_scale; | 895 | 144 | auto to_max_int_digit_count = to_precision - to_scale; | 896 | 144 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count) || | 897 | 144 | (to_max_int_digit_count == from_max_int_digit_count && | 898 | 4 | to_scale < from_original_scale); | 899 | | // only in non-strict mode and may overflow, we set nullable | 900 | 144 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 901 | | | 902 | 144 | size_t size = col_from->size(); | 903 | 144 | ColumnUInt8::MutablePtr col_null_map_to; | 904 | 144 | NullMap::value_type* null_map_data = nullptr; | 905 | 144 | if (narrow_integral) { | 906 | 144 | col_null_map_to = ColumnUInt8::create(size, 0); | 907 | 144 | null_map_data = col_null_map_to->get_data().data(); | 908 | 144 | } | 909 | 144 | CastParameters params; | 910 | 144 | params.is_strict = (CastMode == CastModeType::StrictMode); | 911 | 144 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 912 | 144 | const auto& vec_from = col_from->get_data(); | 913 | 144 | const auto* vec_from_data = vec_from.data(); | 914 | 144 | auto& vec_to = col_to->get_data(); | 915 | 144 | auto* vec_to_data = vec_to.data(); | 916 | | | 917 | 144 | using MaxFieldType = | 918 | 144 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 919 | 144 | (std::is_same_v<ToFieldType, Decimal128V3> || | 920 | 144 | std::is_same_v<FromFieldType, Decimal128V3>), | 921 | 144 | Decimal128V3, | 922 | 144 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 923 | 144 | FromFieldType, ToFieldType>>; | 924 | 144 | using MaxNativeType = typename MaxFieldType::NativeType; | 925 | | | 926 | 144 | constexpr UInt32 to_max_digits = | 927 | 144 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 928 | 144 | bool multiply_may_overflow = false; | 929 | 144 | if (to_scale > from_scale) { | 930 | 48 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 931 | 48 | } | 932 | | | 933 | 144 | typename ToFieldType::NativeType max_result = | 934 | 144 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 935 | 144 | typename ToFieldType::NativeType min_result = -max_result; | 936 | | | 937 | 144 | MaxNativeType multiplier {}; | 938 | 144 | if (from_scale < to_scale) { | 939 | 48 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 940 | 48 | from_scale); | 941 | 96 | } else if (from_scale > to_scale) { | 942 | 84 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 943 | 84 | to_scale); | 944 | 84 | } | 945 | 144 | RETURN_IF_ERROR(std::visit( | 946 | 144 | [&](auto multiply_may_overflow, auto narrow_integral) { | 947 | 144 | for (size_t i = 0; i < size; i++) { | 948 | 144 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 949 | 144 | multiply_may_overflow, narrow_integral>( | 950 | 144 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 951 | 144 | to_precision, to_scale, min_result, max_result, multiplier, | 952 | 144 | params)) { | 953 | 144 | if (set_nullable) { | 954 | 144 | null_map_data[i] = 1; | 955 | 144 | } else { | 956 | 144 | return params.status; | 957 | 144 | } | 958 | 144 | } | 959 | 144 | } | 960 | 144 | return Status::OK(); | 961 | 144 | }, | 962 | 144 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 963 | 0 | if (narrow_integral) { | 964 | 0 | block.get_by_position(result).column = | 965 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 966 | 0 | } else { | 967 | 0 | block.get_by_position(result).column = std::move(col_to); | 968 | 0 | } | 969 | 0 | return Status::OK(); | 970 | 144 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEENS2_ILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 870 | 216 | const NullMap::value_type* null_map = nullptr) const override { | 871 | 216 | using FromFieldType = typename FromDataType::FieldType; | 872 | 216 | using ToFieldType = typename ToDataType::FieldType; | 873 | 216 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 874 | 216 | const auto* col_from = | 875 | 216 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 876 | 216 | if (!col_from) { | 877 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 878 | 0 | named_from.column->get_name()); | 879 | 0 | } | 880 | | | 881 | 216 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 882 | 216 | UInt32 from_precision = from_decimal_type.get_precision(); | 883 | 216 | UInt32 from_scale = from_decimal_type.get_scale(); | 884 | 216 | UInt32 from_original_precision = from_decimal_type.get_original_precision(); | 885 | 216 | UInt32 from_original_scale = from_decimal_type.get_original_scale(); | 886 | | | 887 | 216 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 888 | 216 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 889 | 216 | UInt32 to_precision = to_decimal_type.get_precision(); | 890 | 216 | ToDataType::check_type_precision(to_precision); | 891 | 216 | UInt32 to_scale = to_decimal_type.get_scale(); | 892 | 216 | ToDataType::check_type_scale(to_scale); | 893 | | | 894 | 216 | auto from_max_int_digit_count = from_original_precision - from_original_scale; | 895 | 216 | auto to_max_int_digit_count = to_precision - to_scale; | 896 | 216 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count) || | 897 | 216 | (to_max_int_digit_count == from_max_int_digit_count && | 898 | 90 | to_scale < from_original_scale); | 899 | | // only in non-strict mode and may overflow, we set nullable | 900 | 216 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 901 | | | 902 | 216 | size_t size = col_from->size(); | 903 | 216 | ColumnUInt8::MutablePtr col_null_map_to; | 904 | 216 | NullMap::value_type* null_map_data = nullptr; | 905 | 216 | if (narrow_integral) { | 906 | 140 | col_null_map_to = ColumnUInt8::create(size, 0); | 907 | 140 | null_map_data = col_null_map_to->get_data().data(); | 908 | 140 | } | 909 | 216 | CastParameters params; | 910 | 216 | params.is_strict = (CastMode == CastModeType::StrictMode); | 911 | 216 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 912 | 216 | const auto& vec_from = col_from->get_data(); | 913 | 216 | const auto* vec_from_data = vec_from.data(); | 914 | 216 | auto& vec_to = col_to->get_data(); | 915 | 216 | auto* vec_to_data = vec_to.data(); | 916 | | | 917 | 216 | using MaxFieldType = | 918 | 216 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 919 | 216 | (std::is_same_v<ToFieldType, Decimal128V3> || | 920 | 216 | std::is_same_v<FromFieldType, Decimal128V3>), | 921 | 216 | Decimal128V3, | 922 | 216 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 923 | 216 | FromFieldType, ToFieldType>>; | 924 | 216 | using MaxNativeType = typename MaxFieldType::NativeType; | 925 | | | 926 | 216 | constexpr UInt32 to_max_digits = | 927 | 216 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 928 | 216 | bool multiply_may_overflow = false; | 929 | 216 | if (to_scale > from_scale) { | 930 | 52 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 931 | 52 | } | 932 | | | 933 | 216 | typename ToFieldType::NativeType max_result = | 934 | 216 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 935 | 216 | typename ToFieldType::NativeType min_result = -max_result; | 936 | | | 937 | 216 | MaxNativeType multiplier {}; | 938 | 216 | if (from_scale < to_scale) { | 939 | 52 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 940 | 52 | from_scale); | 941 | 164 | } else if (from_scale > to_scale) { | 942 | 140 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 943 | 140 | to_scale); | 944 | 140 | } | 945 | 216 | RETURN_IF_ERROR(std::visit( | 946 | 216 | [&](auto multiply_may_overflow, auto narrow_integral) { | 947 | 216 | for (size_t i = 0; i < size; i++) { | 948 | 216 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 949 | 216 | multiply_may_overflow, narrow_integral>( | 950 | 216 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 951 | 216 | to_precision, to_scale, min_result, max_result, multiplier, | 952 | 216 | params)) { | 953 | 216 | if (set_nullable) { | 954 | 216 | null_map_data[i] = 1; | 955 | 216 | } else { | 956 | 216 | return params.status; | 957 | 216 | } | 958 | 216 | } | 959 | 216 | } | 960 | 216 | return Status::OK(); | 961 | 216 | }, | 962 | 216 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 963 | 216 | if (narrow_integral) { | 964 | 140 | block.get_by_position(result).column = | 965 | 140 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 966 | 140 | } else { | 967 | 76 | block.get_by_position(result).column = std::move(col_to); | 968 | 76 | } | 969 | 216 | return Status::OK(); | 970 | 216 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEENS2_ILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 870 | 64 | const NullMap::value_type* null_map = nullptr) const override { | 871 | 64 | using FromFieldType = typename FromDataType::FieldType; | 872 | 64 | using ToFieldType = typename ToDataType::FieldType; | 873 | 64 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 874 | 64 | const auto* col_from = | 875 | 64 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 876 | 64 | if (!col_from) { | 877 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 878 | 0 | named_from.column->get_name()); | 879 | 0 | } | 880 | | | 881 | 64 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 882 | 64 | UInt32 from_precision = from_decimal_type.get_precision(); | 883 | 64 | UInt32 from_scale = from_decimal_type.get_scale(); | 884 | 64 | UInt32 from_original_precision = from_decimal_type.get_original_precision(); | 885 | 64 | UInt32 from_original_scale = from_decimal_type.get_original_scale(); | 886 | | | 887 | 64 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 888 | 64 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 889 | 64 | UInt32 to_precision = to_decimal_type.get_precision(); | 890 | 64 | ToDataType::check_type_precision(to_precision); | 891 | 64 | UInt32 to_scale = to_decimal_type.get_scale(); | 892 | 64 | ToDataType::check_type_scale(to_scale); | 893 | | | 894 | 64 | auto from_max_int_digit_count = from_original_precision - from_original_scale; | 895 | 64 | auto to_max_int_digit_count = to_precision - to_scale; | 896 | 64 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count) || | 897 | 64 | (to_max_int_digit_count == from_max_int_digit_count && | 898 | 4 | to_scale < from_original_scale); | 899 | | // only in non-strict mode and may overflow, we set nullable | 900 | 64 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 901 | | | 902 | 64 | size_t size = col_from->size(); | 903 | 64 | ColumnUInt8::MutablePtr col_null_map_to; | 904 | 64 | NullMap::value_type* null_map_data = nullptr; | 905 | 64 | if (narrow_integral) { | 906 | 64 | col_null_map_to = ColumnUInt8::create(size, 0); | 907 | 64 | null_map_data = col_null_map_to->get_data().data(); | 908 | 64 | } | 909 | 64 | CastParameters params; | 910 | 64 | params.is_strict = (CastMode == CastModeType::StrictMode); | 911 | 64 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 912 | 64 | const auto& vec_from = col_from->get_data(); | 913 | 64 | const auto* vec_from_data = vec_from.data(); | 914 | 64 | auto& vec_to = col_to->get_data(); | 915 | 64 | auto* vec_to_data = vec_to.data(); | 916 | | | 917 | 64 | using MaxFieldType = | 918 | 64 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 919 | 64 | (std::is_same_v<ToFieldType, Decimal128V3> || | 920 | 64 | std::is_same_v<FromFieldType, Decimal128V3>), | 921 | 64 | Decimal128V3, | 922 | 64 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 923 | 64 | FromFieldType, ToFieldType>>; | 924 | 64 | using MaxNativeType = typename MaxFieldType::NativeType; | 925 | | | 926 | 64 | constexpr UInt32 to_max_digits = | 927 | 64 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 928 | 64 | bool multiply_may_overflow = false; | 929 | 64 | if (to_scale > from_scale) { | 930 | 60 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 931 | 60 | } | 932 | | | 933 | 64 | typename ToFieldType::NativeType max_result = | 934 | 64 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 935 | 64 | typename ToFieldType::NativeType min_result = -max_result; | 936 | | | 937 | 64 | MaxNativeType multiplier {}; | 938 | 64 | if (from_scale < to_scale) { | 939 | 60 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 940 | 60 | from_scale); | 941 | 60 | } else if (from_scale > to_scale) { | 942 | 4 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 943 | 4 | to_scale); | 944 | 4 | } | 945 | 64 | RETURN_IF_ERROR(std::visit( | 946 | 64 | [&](auto multiply_may_overflow, auto narrow_integral) { | 947 | 64 | for (size_t i = 0; i < size; i++) { | 948 | 64 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 949 | 64 | multiply_may_overflow, narrow_integral>( | 950 | 64 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 951 | 64 | to_precision, to_scale, min_result, max_result, multiplier, | 952 | 64 | params)) { | 953 | 64 | if (set_nullable) { | 954 | 64 | null_map_data[i] = 1; | 955 | 64 | } else { | 956 | 64 | return params.status; | 957 | 64 | } | 958 | 64 | } | 959 | 64 | } | 960 | 64 | return Status::OK(); | 961 | 64 | }, | 962 | 64 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 963 | 0 | if (narrow_integral) { | 964 | 0 | block.get_by_position(result).column = | 965 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 966 | 0 | } else { | 967 | 0 | block.get_by_position(result).column = std::move(col_to); | 968 | 0 | } | 969 | 0 | return Status::OK(); | 970 | 64 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEENS2_ILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 870 | 206 | const NullMap::value_type* null_map = nullptr) const override { | 871 | 206 | using FromFieldType = typename FromDataType::FieldType; | 872 | 206 | using ToFieldType = typename ToDataType::FieldType; | 873 | 206 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 874 | 206 | const auto* col_from = | 875 | 206 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 876 | 206 | if (!col_from) { | 877 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 878 | 0 | named_from.column->get_name()); | 879 | 0 | } | 880 | | | 881 | 206 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 882 | 206 | UInt32 from_precision = from_decimal_type.get_precision(); | 883 | 206 | UInt32 from_scale = from_decimal_type.get_scale(); | 884 | 206 | UInt32 from_original_precision = from_decimal_type.get_original_precision(); | 885 | 206 | UInt32 from_original_scale = from_decimal_type.get_original_scale(); | 886 | | | 887 | 206 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 888 | 206 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 889 | 206 | UInt32 to_precision = to_decimal_type.get_precision(); | 890 | 206 | ToDataType::check_type_precision(to_precision); | 891 | 206 | UInt32 to_scale = to_decimal_type.get_scale(); | 892 | 206 | ToDataType::check_type_scale(to_scale); | 893 | | | 894 | 206 | auto from_max_int_digit_count = from_original_precision - from_original_scale; | 895 | 206 | auto to_max_int_digit_count = to_precision - to_scale; | 896 | 206 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count) || | 897 | 206 | (to_max_int_digit_count == from_max_int_digit_count && | 898 | 150 | to_scale < from_original_scale); | 899 | | // only in non-strict mode and may overflow, we set nullable | 900 | 206 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 901 | | | 902 | 206 | size_t size = col_from->size(); | 903 | 206 | ColumnUInt8::MutablePtr col_null_map_to; | 904 | 206 | NullMap::value_type* null_map_data = nullptr; | 905 | 206 | if (narrow_integral) { | 906 | 70 | col_null_map_to = ColumnUInt8::create(size, 0); | 907 | 70 | null_map_data = col_null_map_to->get_data().data(); | 908 | 70 | } | 909 | 206 | CastParameters params; | 910 | 206 | params.is_strict = (CastMode == CastModeType::StrictMode); | 911 | 206 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 912 | 206 | const auto& vec_from = col_from->get_data(); | 913 | 206 | const auto* vec_from_data = vec_from.data(); | 914 | 206 | auto& vec_to = col_to->get_data(); | 915 | 206 | auto* vec_to_data = vec_to.data(); | 916 | | | 917 | 206 | using MaxFieldType = | 918 | 206 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 919 | 206 | (std::is_same_v<ToFieldType, Decimal128V3> || | 920 | 206 | std::is_same_v<FromFieldType, Decimal128V3>), | 921 | 206 | Decimal128V3, | 922 | 206 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 923 | 206 | FromFieldType, ToFieldType>>; | 924 | 206 | using MaxNativeType = typename MaxFieldType::NativeType; | 925 | | | 926 | 206 | constexpr UInt32 to_max_digits = | 927 | 206 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 928 | 206 | bool multiply_may_overflow = false; | 929 | 206 | if (to_scale > from_scale) { | 930 | 76 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 931 | 76 | } | 932 | | | 933 | 206 | typename ToFieldType::NativeType max_result = | 934 | 206 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 935 | 206 | typename ToFieldType::NativeType min_result = -max_result; | 936 | | | 937 | 206 | MaxNativeType multiplier {}; | 938 | 206 | if (from_scale < to_scale) { | 939 | 76 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 940 | 76 | from_scale); | 941 | 130 | } else if (from_scale > to_scale) { | 942 | 130 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 943 | 130 | to_scale); | 944 | 130 | } | 945 | 206 | RETURN_IF_ERROR(std::visit( | 946 | 206 | [&](auto multiply_may_overflow, auto narrow_integral) { | 947 | 206 | for (size_t i = 0; i < size; i++) { | 948 | 206 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 949 | 206 | multiply_may_overflow, narrow_integral>( | 950 | 206 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 951 | 206 | to_precision, to_scale, min_result, max_result, multiplier, | 952 | 206 | params)) { | 953 | 206 | if (set_nullable) { | 954 | 206 | null_map_data[i] = 1; | 955 | 206 | } else { | 956 | 206 | return params.status; | 957 | 206 | } | 958 | 206 | } | 959 | 206 | } | 960 | 206 | return Status::OK(); | 961 | 206 | }, | 962 | 206 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 963 | 206 | if (narrow_integral) { | 964 | 70 | block.get_by_position(result).column = | 965 | 70 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 966 | 136 | } else { | 967 | 136 | block.get_by_position(result).column = std::move(col_to); | 968 | 136 | } | 969 | 206 | return Status::OK(); | 970 | 206 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEENS2_ILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 870 | 60 | const NullMap::value_type* null_map = nullptr) const override { | 871 | 60 | using FromFieldType = typename FromDataType::FieldType; | 872 | 60 | using ToFieldType = typename ToDataType::FieldType; | 873 | 60 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 874 | 60 | const auto* col_from = | 875 | 60 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 876 | 60 | if (!col_from) { | 877 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 878 | 0 | named_from.column->get_name()); | 879 | 0 | } | 880 | | | 881 | 60 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 882 | 60 | UInt32 from_precision = from_decimal_type.get_precision(); | 883 | 60 | UInt32 from_scale = from_decimal_type.get_scale(); | 884 | 60 | UInt32 from_original_precision = from_decimal_type.get_original_precision(); | 885 | 60 | UInt32 from_original_scale = from_decimal_type.get_original_scale(); | 886 | | | 887 | 60 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 888 | 60 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 889 | 60 | UInt32 to_precision = to_decimal_type.get_precision(); | 890 | 60 | ToDataType::check_type_precision(to_precision); | 891 | 60 | UInt32 to_scale = to_decimal_type.get_scale(); | 892 | 60 | ToDataType::check_type_scale(to_scale); | 893 | | | 894 | 60 | auto from_max_int_digit_count = from_original_precision - from_original_scale; | 895 | 60 | auto to_max_int_digit_count = to_precision - to_scale; | 896 | 60 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count) || | 897 | 60 | (to_max_int_digit_count == from_max_int_digit_count && | 898 | 0 | to_scale < from_original_scale); | 899 | | // only in non-strict mode and may overflow, we set nullable | 900 | 60 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 901 | | | 902 | 60 | size_t size = col_from->size(); | 903 | 60 | ColumnUInt8::MutablePtr col_null_map_to; | 904 | 60 | NullMap::value_type* null_map_data = nullptr; | 905 | 60 | if (narrow_integral) { | 906 | 60 | col_null_map_to = ColumnUInt8::create(size, 0); | 907 | 60 | null_map_data = col_null_map_to->get_data().data(); | 908 | 60 | } | 909 | 60 | CastParameters params; | 910 | 60 | params.is_strict = (CastMode == CastModeType::StrictMode); | 911 | 60 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 912 | 60 | const auto& vec_from = col_from->get_data(); | 913 | 60 | const auto* vec_from_data = vec_from.data(); | 914 | 60 | auto& vec_to = col_to->get_data(); | 915 | 60 | auto* vec_to_data = vec_to.data(); | 916 | | | 917 | 60 | using MaxFieldType = | 918 | 60 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 919 | 60 | (std::is_same_v<ToFieldType, Decimal128V3> || | 920 | 60 | std::is_same_v<FromFieldType, Decimal128V3>), | 921 | 60 | Decimal128V3, | 922 | 60 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 923 | 60 | FromFieldType, ToFieldType>>; | 924 | 60 | using MaxNativeType = typename MaxFieldType::NativeType; | 925 | | | 926 | 60 | constexpr UInt32 to_max_digits = | 927 | 60 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 928 | 60 | bool multiply_may_overflow = false; | 929 | 60 | if (to_scale > from_scale) { | 930 | 60 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 931 | 60 | } | 932 | | | 933 | 60 | typename ToFieldType::NativeType max_result = | 934 | 60 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 935 | 60 | typename ToFieldType::NativeType min_result = -max_result; | 936 | | | 937 | 60 | MaxNativeType multiplier {}; | 938 | 60 | if (from_scale < to_scale) { | 939 | 60 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 940 | 60 | from_scale); | 941 | 60 | } else if (from_scale > to_scale) { | 942 | 0 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 943 | 0 | to_scale); | 944 | 0 | } | 945 | 60 | RETURN_IF_ERROR(std::visit( | 946 | 60 | [&](auto multiply_may_overflow, auto narrow_integral) { | 947 | 60 | for (size_t i = 0; i < size; i++) { | 948 | 60 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 949 | 60 | multiply_may_overflow, narrow_integral>( | 950 | 60 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 951 | 60 | to_precision, to_scale, min_result, max_result, multiplier, | 952 | 60 | params)) { | 953 | 60 | if (set_nullable) { | 954 | 60 | null_map_data[i] = 1; | 955 | 60 | } else { | 956 | 60 | return params.status; | 957 | 60 | } | 958 | 60 | } | 959 | 60 | } | 960 | 60 | return Status::OK(); | 961 | 60 | }, | 962 | 60 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 963 | 0 | if (narrow_integral) { | 964 | 0 | block.get_by_position(result).column = | 965 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 966 | 0 | } else { | 967 | 0 | block.get_by_position(result).column = std::move(col_to); | 968 | 0 | } | 969 | 0 | return Status::OK(); | 970 | 60 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEENS2_ILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 870 | 204 | const NullMap::value_type* null_map = nullptr) const override { | 871 | 204 | using FromFieldType = typename FromDataType::FieldType; | 872 | 204 | using ToFieldType = typename ToDataType::FieldType; | 873 | 204 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 874 | 204 | const auto* col_from = | 875 | 204 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 876 | 204 | if (!col_from) { | 877 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 878 | 0 | named_from.column->get_name()); | 879 | 0 | } | 880 | | | 881 | 204 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 882 | 204 | UInt32 from_precision = from_decimal_type.get_precision(); | 883 | 204 | UInt32 from_scale = from_decimal_type.get_scale(); | 884 | 204 | UInt32 from_original_precision = from_decimal_type.get_original_precision(); | 885 | 204 | UInt32 from_original_scale = from_decimal_type.get_original_scale(); | 886 | | | 887 | 204 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 888 | 204 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 889 | 204 | UInt32 to_precision = to_decimal_type.get_precision(); | 890 | 204 | ToDataType::check_type_precision(to_precision); | 891 | 204 | UInt32 to_scale = to_decimal_type.get_scale(); | 892 | 204 | ToDataType::check_type_scale(to_scale); | 893 | | | 894 | 204 | auto from_max_int_digit_count = from_original_precision - from_original_scale; | 895 | 204 | auto to_max_int_digit_count = to_precision - to_scale; | 896 | 204 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count) || | 897 | 204 | (to_max_int_digit_count == from_max_int_digit_count && | 898 | 148 | to_scale < from_original_scale); | 899 | | // only in non-strict mode and may overflow, we set nullable | 900 | 204 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 901 | | | 902 | 204 | size_t size = col_from->size(); | 903 | 204 | ColumnUInt8::MutablePtr col_null_map_to; | 904 | 204 | NullMap::value_type* null_map_data = nullptr; | 905 | 204 | if (narrow_integral) { | 906 | 56 | col_null_map_to = ColumnUInt8::create(size, 0); | 907 | 56 | null_map_data = col_null_map_to->get_data().data(); | 908 | 56 | } | 909 | 204 | CastParameters params; | 910 | 204 | params.is_strict = (CastMode == CastModeType::StrictMode); | 911 | 204 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 912 | 204 | const auto& vec_from = col_from->get_data(); | 913 | 204 | const auto* vec_from_data = vec_from.data(); | 914 | 204 | auto& vec_to = col_to->get_data(); | 915 | 204 | auto* vec_to_data = vec_to.data(); | 916 | | | 917 | 204 | using MaxFieldType = | 918 | 204 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 919 | 204 | (std::is_same_v<ToFieldType, Decimal128V3> || | 920 | 204 | std::is_same_v<FromFieldType, Decimal128V3>), | 921 | 204 | Decimal128V3, | 922 | 204 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 923 | 204 | FromFieldType, ToFieldType>>; | 924 | 204 | using MaxNativeType = typename MaxFieldType::NativeType; | 925 | | | 926 | 204 | constexpr UInt32 to_max_digits = | 927 | 204 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 928 | 204 | bool multiply_may_overflow = false; | 929 | 204 | if (to_scale > from_scale) { | 930 | 76 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 931 | 76 | } | 932 | | | 933 | 204 | typename ToFieldType::NativeType max_result = | 934 | 204 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 935 | 204 | typename ToFieldType::NativeType min_result = -max_result; | 936 | | | 937 | 204 | MaxNativeType multiplier {}; | 938 | 204 | if (from_scale < to_scale) { | 939 | 76 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 940 | 76 | from_scale); | 941 | 128 | } else if (from_scale > to_scale) { | 942 | 128 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 943 | 128 | to_scale); | 944 | 128 | } | 945 | 204 | RETURN_IF_ERROR(std::visit( | 946 | 204 | [&](auto multiply_may_overflow, auto narrow_integral) { | 947 | 204 | for (size_t i = 0; i < size; i++) { | 948 | 204 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 949 | 204 | multiply_may_overflow, narrow_integral>( | 950 | 204 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 951 | 204 | to_precision, to_scale, min_result, max_result, multiplier, | 952 | 204 | params)) { | 953 | 204 | if (set_nullable) { | 954 | 204 | null_map_data[i] = 1; | 955 | 204 | } else { | 956 | 204 | return params.status; | 957 | 204 | } | 958 | 204 | } | 959 | 204 | } | 960 | 204 | return Status::OK(); | 961 | 204 | }, | 962 | 204 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 963 | 204 | if (narrow_integral) { | 964 | 56 | block.get_by_position(result).column = | 965 | 56 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 966 | 148 | } else { | 967 | 148 | block.get_by_position(result).column = std::move(col_to); | 968 | 148 | } | 969 | 204 | return Status::OK(); | 970 | 204 | } |
|
971 | | }; |
972 | | |
973 | | // cast between decimalv3 types |
974 | | template <CastModeType CastMode, typename FromDataType, typename ToDataType> |
975 | | requires(IsDataTypeDecimalV3<ToDataType> && IsDataTypeDecimalV3<FromDataType>) |
976 | | class CastToImpl<CastMode, FromDataType, ToDataType> : public CastToBase { |
977 | | public: |
978 | | Status execute_impl(FunctionContext* context, Block& block, const ColumnNumbers& arguments, |
979 | | uint32_t result, size_t input_rows_count, |
980 | 8.54k | const NullMap::value_type* null_map = nullptr) const override { |
981 | 8.54k | using FromFieldType = typename FromDataType::FieldType; |
982 | 8.54k | using ToFieldType = typename ToDataType::FieldType; |
983 | 8.54k | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); |
984 | 8.54k | const auto* col_from = |
985 | 8.54k | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); |
986 | 8.54k | if (!col_from) { |
987 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", |
988 | 0 | named_from.column->get_name()); |
989 | 0 | } |
990 | | |
991 | 8.54k | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); |
992 | 8.54k | UInt32 from_precision = from_decimal_type.get_precision(); |
993 | 8.54k | UInt32 from_scale = from_decimal_type.get_scale(); |
994 | | |
995 | 8.54k | const ColumnWithTypeAndName& named_to = block.get_by_position(result); |
996 | 8.54k | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); |
997 | 8.54k | UInt32 to_precision = to_decimal_type.get_precision(); |
998 | 8.54k | ToDataType::check_type_precision(to_precision); |
999 | 8.54k | UInt32 to_scale = to_decimal_type.get_scale(); |
1000 | 8.54k | ToDataType::check_type_scale(to_scale); |
1001 | | |
1002 | 8.54k | auto from_max_int_digit_count = from_precision - from_scale; |
1003 | 8.54k | auto to_max_int_digit_count = to_precision - to_scale; |
1004 | 8.54k | bool narrow_integral = |
1005 | 8.54k | (to_max_int_digit_count < from_max_int_digit_count) || |
1006 | 8.54k | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); |
1007 | | // only in non-strict mode and may overflow, we set nullable |
1008 | 8.54k | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; |
1009 | | |
1010 | 8.54k | size_t size = col_from->size(); |
1011 | 8.54k | ColumnUInt8::MutablePtr col_null_map_to; |
1012 | 8.54k | NullMap::value_type* null_map_data = nullptr; |
1013 | 8.54k | if (narrow_integral) { |
1014 | 6.20k | col_null_map_to = ColumnUInt8::create(size, 0); |
1015 | 6.20k | null_map_data = col_null_map_to->get_data().data(); |
1016 | 6.20k | } |
1017 | 8.54k | CastParameters params; |
1018 | 8.54k | params.is_strict = (CastMode == CastModeType::StrictMode); |
1019 | 8.54k | auto col_to = ToDataType::ColumnType::create(size, to_scale); |
1020 | 8.54k | const auto& vec_from = col_from->get_data(); |
1021 | 8.54k | const auto* vec_from_data = vec_from.data(); |
1022 | 8.54k | auto& vec_to = col_to->get_data(); |
1023 | 8.54k | auto* vec_to_data = vec_to.data(); |
1024 | | |
1025 | 8.54k | using MaxFieldType = |
1026 | 8.54k | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && |
1027 | 8.54k | (std::is_same_v<ToFieldType, Decimal128V3> || |
1028 | 8.54k | std::is_same_v<FromFieldType, Decimal128V3>), |
1029 | 8.54k | Decimal128V3, |
1030 | 8.54k | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), |
1031 | 8.54k | FromFieldType, ToFieldType>>; |
1032 | 8.54k | using MaxNativeType = typename MaxFieldType::NativeType; |
1033 | | |
1034 | 8.54k | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); |
1035 | 8.54k | bool multiply_may_overflow = false; |
1036 | 8.54k | if (to_scale > from_scale) { |
1037 | 3.91k | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; |
1038 | 3.91k | } |
1039 | | |
1040 | 8.54k | typename ToFieldType::NativeType max_result = |
1041 | 8.54k | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); |
1042 | 8.54k | typename ToFieldType::NativeType min_result = -max_result; |
1043 | | |
1044 | 8.54k | MaxNativeType multiplier {}; |
1045 | 8.54k | if (from_scale < to_scale) { |
1046 | 3.91k | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - |
1047 | 3.91k | from_scale); |
1048 | 4.63k | } else if (from_scale > to_scale) { |
1049 | 3.02k | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - |
1050 | 3.02k | to_scale); |
1051 | 3.02k | } |
1052 | 8.54k | RETURN_IF_ERROR(std::visit( |
1053 | 8.54k | [&](auto multiply_may_overflow, auto narrow_integral) { |
1054 | 8.54k | for (size_t i = 0; i < size; i++) { |
1055 | 8.54k | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, |
1056 | 8.54k | multiply_may_overflow, narrow_integral>( |
1057 | 8.54k | vec_from_data[i], from_precision, from_scale, vec_to_data[i], |
1058 | 8.54k | to_precision, to_scale, min_result, max_result, multiplier, |
1059 | 8.54k | params)) { |
1060 | 8.54k | if (set_nullable) { |
1061 | 8.54k | null_map_data[i] = 1; |
1062 | 8.54k | } else { |
1063 | 8.54k | return params.status; |
1064 | 8.54k | } |
1065 | 8.54k | } |
1066 | 8.54k | } |
1067 | 8.54k | return Status::OK(); |
1068 | 8.54k | }, |
1069 | 8.54k | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); |
1070 | 5.55k | if (narrow_integral) { |
1071 | 3.21k | block.get_by_position(result).column = |
1072 | 3.21k | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); |
1073 | 3.21k | } else { |
1074 | 2.34k | block.get_by_position(result).column = std::move(col_to); |
1075 | 2.34k | } |
1076 | 5.55k | return Status::OK(); |
1077 | 8.54k | } _ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEES4_E12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 980 | 106 | const NullMap::value_type* null_map = nullptr) const override { | 981 | 106 | using FromFieldType = typename FromDataType::FieldType; | 982 | 106 | using ToFieldType = typename ToDataType::FieldType; | 983 | 106 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 984 | 106 | const auto* col_from = | 985 | 106 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 986 | 106 | if (!col_from) { | 987 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 988 | 0 | named_from.column->get_name()); | 989 | 0 | } | 990 | | | 991 | 106 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 992 | 106 | UInt32 from_precision = from_decimal_type.get_precision(); | 993 | 106 | UInt32 from_scale = from_decimal_type.get_scale(); | 994 | | | 995 | 106 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 996 | 106 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 997 | 106 | UInt32 to_precision = to_decimal_type.get_precision(); | 998 | 106 | ToDataType::check_type_precision(to_precision); | 999 | 106 | UInt32 to_scale = to_decimal_type.get_scale(); | 1000 | 106 | ToDataType::check_type_scale(to_scale); | 1001 | | | 1002 | 106 | auto from_max_int_digit_count = from_precision - from_scale; | 1003 | 106 | auto to_max_int_digit_count = to_precision - to_scale; | 1004 | 106 | bool narrow_integral = | 1005 | 106 | (to_max_int_digit_count < from_max_int_digit_count) || | 1006 | 106 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1007 | | // only in non-strict mode and may overflow, we set nullable | 1008 | 106 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1009 | | | 1010 | 106 | size_t size = col_from->size(); | 1011 | 106 | ColumnUInt8::MutablePtr col_null_map_to; | 1012 | 106 | NullMap::value_type* null_map_data = nullptr; | 1013 | 106 | if (narrow_integral) { | 1014 | 106 | col_null_map_to = ColumnUInt8::create(size, 0); | 1015 | 106 | null_map_data = col_null_map_to->get_data().data(); | 1016 | 106 | } | 1017 | 106 | CastParameters params; | 1018 | 106 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1019 | 106 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1020 | 106 | const auto& vec_from = col_from->get_data(); | 1021 | 106 | const auto* vec_from_data = vec_from.data(); | 1022 | 106 | auto& vec_to = col_to->get_data(); | 1023 | 106 | auto* vec_to_data = vec_to.data(); | 1024 | | | 1025 | 106 | using MaxFieldType = | 1026 | 106 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1027 | 106 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1028 | 106 | std::is_same_v<FromFieldType, Decimal128V3>), | 1029 | 106 | Decimal128V3, | 1030 | 106 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1031 | 106 | FromFieldType, ToFieldType>>; | 1032 | 106 | using MaxNativeType = typename MaxFieldType::NativeType; | 1033 | | | 1034 | 106 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1035 | 106 | bool multiply_may_overflow = false; | 1036 | 106 | if (to_scale > from_scale) { | 1037 | 54 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1038 | 54 | } | 1039 | | | 1040 | 106 | typename ToFieldType::NativeType max_result = | 1041 | 106 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1042 | 106 | typename ToFieldType::NativeType min_result = -max_result; | 1043 | | | 1044 | 106 | MaxNativeType multiplier {}; | 1045 | 106 | if (from_scale < to_scale) { | 1046 | 54 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1047 | 54 | from_scale); | 1048 | 54 | } else if (from_scale > to_scale) { | 1049 | 40 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1050 | 40 | to_scale); | 1051 | 40 | } | 1052 | 106 | RETURN_IF_ERROR(std::visit( | 1053 | 106 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1054 | 106 | for (size_t i = 0; i < size; i++) { | 1055 | 106 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1056 | 106 | multiply_may_overflow, narrow_integral>( | 1057 | 106 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1058 | 106 | to_precision, to_scale, min_result, max_result, multiplier, | 1059 | 106 | params)) { | 1060 | 106 | if (set_nullable) { | 1061 | 106 | null_map_data[i] = 1; | 1062 | 106 | } else { | 1063 | 106 | return params.status; | 1064 | 106 | } | 1065 | 106 | } | 1066 | 106 | } | 1067 | 106 | return Status::OK(); | 1068 | 106 | }, | 1069 | 106 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1070 | 0 | if (narrow_integral) { | 1071 | 0 | block.get_by_position(result).column = | 1072 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1073 | 0 | } else { | 1074 | 0 | block.get_by_position(result).column = std::move(col_to); | 1075 | 0 | } | 1076 | 0 | return Status::OK(); | 1077 | 106 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEES4_E12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 980 | 150 | const NullMap::value_type* null_map = nullptr) const override { | 981 | 150 | using FromFieldType = typename FromDataType::FieldType; | 982 | 150 | using ToFieldType = typename ToDataType::FieldType; | 983 | 150 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 984 | 150 | const auto* col_from = | 985 | 150 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 986 | 150 | if (!col_from) { | 987 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 988 | 0 | named_from.column->get_name()); | 989 | 0 | } | 990 | | | 991 | 150 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 992 | 150 | UInt32 from_precision = from_decimal_type.get_precision(); | 993 | 150 | UInt32 from_scale = from_decimal_type.get_scale(); | 994 | | | 995 | 150 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 996 | 150 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 997 | 150 | UInt32 to_precision = to_decimal_type.get_precision(); | 998 | 150 | ToDataType::check_type_precision(to_precision); | 999 | 150 | UInt32 to_scale = to_decimal_type.get_scale(); | 1000 | 150 | ToDataType::check_type_scale(to_scale); | 1001 | | | 1002 | 150 | auto from_max_int_digit_count = from_precision - from_scale; | 1003 | 150 | auto to_max_int_digit_count = to_precision - to_scale; | 1004 | 150 | bool narrow_integral = | 1005 | 150 | (to_max_int_digit_count < from_max_int_digit_count) || | 1006 | 150 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1007 | | // only in non-strict mode and may overflow, we set nullable | 1008 | 150 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1009 | | | 1010 | 150 | size_t size = col_from->size(); | 1011 | 150 | ColumnUInt8::MutablePtr col_null_map_to; | 1012 | 150 | NullMap::value_type* null_map_data = nullptr; | 1013 | 150 | if (narrow_integral) { | 1014 | 90 | col_null_map_to = ColumnUInt8::create(size, 0); | 1015 | 90 | null_map_data = col_null_map_to->get_data().data(); | 1016 | 90 | } | 1017 | 150 | CastParameters params; | 1018 | 150 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1019 | 150 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1020 | 150 | const auto& vec_from = col_from->get_data(); | 1021 | 150 | const auto* vec_from_data = vec_from.data(); | 1022 | 150 | auto& vec_to = col_to->get_data(); | 1023 | 150 | auto* vec_to_data = vec_to.data(); | 1024 | | | 1025 | 150 | using MaxFieldType = | 1026 | 150 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1027 | 150 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1028 | 150 | std::is_same_v<FromFieldType, Decimal128V3>), | 1029 | 150 | Decimal128V3, | 1030 | 150 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1031 | 150 | FromFieldType, ToFieldType>>; | 1032 | 150 | using MaxNativeType = typename MaxFieldType::NativeType; | 1033 | | | 1034 | 150 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1035 | 150 | bool multiply_may_overflow = false; | 1036 | 150 | if (to_scale > from_scale) { | 1037 | 70 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1038 | 70 | } | 1039 | | | 1040 | 150 | typename ToFieldType::NativeType max_result = | 1041 | 150 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1042 | 150 | typename ToFieldType::NativeType min_result = -max_result; | 1043 | | | 1044 | 150 | MaxNativeType multiplier {}; | 1045 | 150 | if (from_scale < to_scale) { | 1046 | 70 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1047 | 70 | from_scale); | 1048 | 80 | } else if (from_scale > to_scale) { | 1049 | 60 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1050 | 60 | to_scale); | 1051 | 60 | } | 1052 | 150 | RETURN_IF_ERROR(std::visit( | 1053 | 150 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1054 | 150 | for (size_t i = 0; i < size; i++) { | 1055 | 150 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1056 | 150 | multiply_may_overflow, narrow_integral>( | 1057 | 150 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1058 | 150 | to_precision, to_scale, min_result, max_result, multiplier, | 1059 | 150 | params)) { | 1060 | 150 | if (set_nullable) { | 1061 | 150 | null_map_data[i] = 1; | 1062 | 150 | } else { | 1063 | 150 | return params.status; | 1064 | 150 | } | 1065 | 150 | } | 1066 | 150 | } | 1067 | 150 | return Status::OK(); | 1068 | 150 | }, | 1069 | 150 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1070 | 150 | if (narrow_integral) { | 1071 | 90 | block.get_by_position(result).column = | 1072 | 90 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1073 | 90 | } else { | 1074 | 60 | block.get_by_position(result).column = std::move(col_to); | 1075 | 60 | } | 1076 | 150 | return Status::OK(); | 1077 | 150 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEENS2_ILS3_28EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 980 | 258 | const NullMap::value_type* null_map = nullptr) const override { | 981 | 258 | using FromFieldType = typename FromDataType::FieldType; | 982 | 258 | using ToFieldType = typename ToDataType::FieldType; | 983 | 258 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 984 | 258 | const auto* col_from = | 985 | 258 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 986 | 258 | if (!col_from) { | 987 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 988 | 0 | named_from.column->get_name()); | 989 | 0 | } | 990 | | | 991 | 258 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 992 | 258 | UInt32 from_precision = from_decimal_type.get_precision(); | 993 | 258 | UInt32 from_scale = from_decimal_type.get_scale(); | 994 | | | 995 | 258 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 996 | 258 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 997 | 258 | UInt32 to_precision = to_decimal_type.get_precision(); | 998 | 258 | ToDataType::check_type_precision(to_precision); | 999 | 258 | UInt32 to_scale = to_decimal_type.get_scale(); | 1000 | 258 | ToDataType::check_type_scale(to_scale); | 1001 | | | 1002 | 258 | auto from_max_int_digit_count = from_precision - from_scale; | 1003 | 258 | auto to_max_int_digit_count = to_precision - to_scale; | 1004 | 258 | bool narrow_integral = | 1005 | 258 | (to_max_int_digit_count < from_max_int_digit_count) || | 1006 | 258 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1007 | | // only in non-strict mode and may overflow, we set nullable | 1008 | 258 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1009 | | | 1010 | 258 | size_t size = col_from->size(); | 1011 | 258 | ColumnUInt8::MutablePtr col_null_map_to; | 1012 | 258 | NullMap::value_type* null_map_data = nullptr; | 1013 | 258 | if (narrow_integral) { | 1014 | 258 | col_null_map_to = ColumnUInt8::create(size, 0); | 1015 | 258 | null_map_data = col_null_map_to->get_data().data(); | 1016 | 258 | } | 1017 | 258 | CastParameters params; | 1018 | 258 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1019 | 258 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1020 | 258 | const auto& vec_from = col_from->get_data(); | 1021 | 258 | const auto* vec_from_data = vec_from.data(); | 1022 | 258 | auto& vec_to = col_to->get_data(); | 1023 | 258 | auto* vec_to_data = vec_to.data(); | 1024 | | | 1025 | 258 | using MaxFieldType = | 1026 | 258 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1027 | 258 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1028 | 258 | std::is_same_v<FromFieldType, Decimal128V3>), | 1029 | 258 | Decimal128V3, | 1030 | 258 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1031 | 258 | FromFieldType, ToFieldType>>; | 1032 | 258 | using MaxNativeType = typename MaxFieldType::NativeType; | 1033 | | | 1034 | 258 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1035 | 258 | bool multiply_may_overflow = false; | 1036 | 258 | if (to_scale > from_scale) { | 1037 | 72 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1038 | 72 | } | 1039 | | | 1040 | 258 | typename ToFieldType::NativeType max_result = | 1041 | 258 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1042 | 258 | typename ToFieldType::NativeType min_result = -max_result; | 1043 | | | 1044 | 258 | MaxNativeType multiplier {}; | 1045 | 258 | if (from_scale < to_scale) { | 1046 | 72 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1047 | 72 | from_scale); | 1048 | 186 | } else if (from_scale > to_scale) { | 1049 | 132 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1050 | 132 | to_scale); | 1051 | 132 | } | 1052 | 258 | RETURN_IF_ERROR(std::visit( | 1053 | 258 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1054 | 258 | for (size_t i = 0; i < size; i++) { | 1055 | 258 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1056 | 258 | multiply_may_overflow, narrow_integral>( | 1057 | 258 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1058 | 258 | to_precision, to_scale, min_result, max_result, multiplier, | 1059 | 258 | params)) { | 1060 | 258 | if (set_nullable) { | 1061 | 258 | null_map_data[i] = 1; | 1062 | 258 | } else { | 1063 | 258 | return params.status; | 1064 | 258 | } | 1065 | 258 | } | 1066 | 258 | } | 1067 | 258 | return Status::OK(); | 1068 | 258 | }, | 1069 | 258 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1070 | 0 | if (narrow_integral) { | 1071 | 0 | block.get_by_position(result).column = | 1072 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1073 | 0 | } else { | 1074 | 0 | block.get_by_position(result).column = std::move(col_to); | 1075 | 0 | } | 1076 | 0 | return Status::OK(); | 1077 | 258 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEENS2_ILS3_28EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 980 | 312 | const NullMap::value_type* null_map = nullptr) const override { | 981 | 312 | using FromFieldType = typename FromDataType::FieldType; | 982 | 312 | using ToFieldType = typename ToDataType::FieldType; | 983 | 312 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 984 | 312 | const auto* col_from = | 985 | 312 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 986 | 312 | if (!col_from) { | 987 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 988 | 0 | named_from.column->get_name()); | 989 | 0 | } | 990 | | | 991 | 312 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 992 | 312 | UInt32 from_precision = from_decimal_type.get_precision(); | 993 | 312 | UInt32 from_scale = from_decimal_type.get_scale(); | 994 | | | 995 | 312 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 996 | 312 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 997 | 312 | UInt32 to_precision = to_decimal_type.get_precision(); | 998 | 312 | ToDataType::check_type_precision(to_precision); | 999 | 312 | UInt32 to_scale = to_decimal_type.get_scale(); | 1000 | 312 | ToDataType::check_type_scale(to_scale); | 1001 | | | 1002 | 312 | auto from_max_int_digit_count = from_precision - from_scale; | 1003 | 312 | auto to_max_int_digit_count = to_precision - to_scale; | 1004 | 312 | bool narrow_integral = | 1005 | 312 | (to_max_int_digit_count < from_max_int_digit_count) || | 1006 | 312 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1007 | | // only in non-strict mode and may overflow, we set nullable | 1008 | 312 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1009 | | | 1010 | 312 | size_t size = col_from->size(); | 1011 | 312 | ColumnUInt8::MutablePtr col_null_map_to; | 1012 | 312 | NullMap::value_type* null_map_data = nullptr; | 1013 | 312 | if (narrow_integral) { | 1014 | 272 | col_null_map_to = ColumnUInt8::create(size, 0); | 1015 | 272 | null_map_data = col_null_map_to->get_data().data(); | 1016 | 272 | } | 1017 | 312 | CastParameters params; | 1018 | 312 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1019 | 312 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1020 | 312 | const auto& vec_from = col_from->get_data(); | 1021 | 312 | const auto* vec_from_data = vec_from.data(); | 1022 | 312 | auto& vec_to = col_to->get_data(); | 1023 | 312 | auto* vec_to_data = vec_to.data(); | 1024 | | | 1025 | 312 | using MaxFieldType = | 1026 | 312 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1027 | 312 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1028 | 312 | std::is_same_v<FromFieldType, Decimal128V3>), | 1029 | 312 | Decimal128V3, | 1030 | 312 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1031 | 312 | FromFieldType, ToFieldType>>; | 1032 | 312 | using MaxNativeType = typename MaxFieldType::NativeType; | 1033 | | | 1034 | 312 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1035 | 312 | bool multiply_may_overflow = false; | 1036 | 312 | if (to_scale > from_scale) { | 1037 | 84 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1038 | 84 | } | 1039 | | | 1040 | 312 | typename ToFieldType::NativeType max_result = | 1041 | 312 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1042 | 312 | typename ToFieldType::NativeType min_result = -max_result; | 1043 | | | 1044 | 312 | MaxNativeType multiplier {}; | 1045 | 312 | if (from_scale < to_scale) { | 1046 | 84 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1047 | 84 | from_scale); | 1048 | 228 | } else if (from_scale > to_scale) { | 1049 | 144 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1050 | 144 | to_scale); | 1051 | 144 | } | 1052 | 312 | RETURN_IF_ERROR(std::visit( | 1053 | 312 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1054 | 312 | for (size_t i = 0; i < size; i++) { | 1055 | 312 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1056 | 312 | multiply_may_overflow, narrow_integral>( | 1057 | 312 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1058 | 312 | to_precision, to_scale, min_result, max_result, multiplier, | 1059 | 312 | params)) { | 1060 | 312 | if (set_nullable) { | 1061 | 312 | null_map_data[i] = 1; | 1062 | 312 | } else { | 1063 | 312 | return params.status; | 1064 | 312 | } | 1065 | 312 | } | 1066 | 312 | } | 1067 | 312 | return Status::OK(); | 1068 | 312 | }, | 1069 | 312 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1070 | 312 | if (narrow_integral) { | 1071 | 272 | block.get_by_position(result).column = | 1072 | 272 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1073 | 272 | } else { | 1074 | 40 | block.get_by_position(result).column = std::move(col_to); | 1075 | 40 | } | 1076 | 312 | return Status::OK(); | 1077 | 312 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEENS2_ILS3_28EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 980 | 280 | const NullMap::value_type* null_map = nullptr) const override { | 981 | 280 | using FromFieldType = typename FromDataType::FieldType; | 982 | 280 | using ToFieldType = typename ToDataType::FieldType; | 983 | 280 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 984 | 280 | const auto* col_from = | 985 | 280 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 986 | 280 | if (!col_from) { | 987 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 988 | 0 | named_from.column->get_name()); | 989 | 0 | } | 990 | | | 991 | 280 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 992 | 280 | UInt32 from_precision = from_decimal_type.get_precision(); | 993 | 280 | UInt32 from_scale = from_decimal_type.get_scale(); | 994 | | | 995 | 280 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 996 | 280 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 997 | 280 | UInt32 to_precision = to_decimal_type.get_precision(); | 998 | 280 | ToDataType::check_type_precision(to_precision); | 999 | 280 | UInt32 to_scale = to_decimal_type.get_scale(); | 1000 | 280 | ToDataType::check_type_scale(to_scale); | 1001 | | | 1002 | 280 | auto from_max_int_digit_count = from_precision - from_scale; | 1003 | 280 | auto to_max_int_digit_count = to_precision - to_scale; | 1004 | 280 | bool narrow_integral = | 1005 | 280 | (to_max_int_digit_count < from_max_int_digit_count) || | 1006 | 280 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1007 | | // only in non-strict mode and may overflow, we set nullable | 1008 | 280 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1009 | | | 1010 | 280 | size_t size = col_from->size(); | 1011 | 280 | ColumnUInt8::MutablePtr col_null_map_to; | 1012 | 280 | NullMap::value_type* null_map_data = nullptr; | 1013 | 280 | if (narrow_integral) { | 1014 | 280 | col_null_map_to = ColumnUInt8::create(size, 0); | 1015 | 280 | null_map_data = col_null_map_to->get_data().data(); | 1016 | 280 | } | 1017 | 280 | CastParameters params; | 1018 | 280 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1019 | 280 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1020 | 280 | const auto& vec_from = col_from->get_data(); | 1021 | 280 | const auto* vec_from_data = vec_from.data(); | 1022 | 280 | auto& vec_to = col_to->get_data(); | 1023 | 280 | auto* vec_to_data = vec_to.data(); | 1024 | | | 1025 | 280 | using MaxFieldType = | 1026 | 280 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1027 | 280 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1028 | 280 | std::is_same_v<FromFieldType, Decimal128V3>), | 1029 | 280 | Decimal128V3, | 1030 | 280 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1031 | 280 | FromFieldType, ToFieldType>>; | 1032 | 280 | using MaxNativeType = typename MaxFieldType::NativeType; | 1033 | | | 1034 | 280 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1035 | 280 | bool multiply_may_overflow = false; | 1036 | 280 | if (to_scale > from_scale) { | 1037 | 72 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1038 | 72 | } | 1039 | | | 1040 | 280 | typename ToFieldType::NativeType max_result = | 1041 | 280 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1042 | 280 | typename ToFieldType::NativeType min_result = -max_result; | 1043 | | | 1044 | 280 | MaxNativeType multiplier {}; | 1045 | 280 | if (from_scale < to_scale) { | 1046 | 72 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1047 | 72 | from_scale); | 1048 | 208 | } else if (from_scale > to_scale) { | 1049 | 160 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1050 | 160 | to_scale); | 1051 | 160 | } | 1052 | 280 | RETURN_IF_ERROR(std::visit( | 1053 | 280 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1054 | 280 | for (size_t i = 0; i < size; i++) { | 1055 | 280 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1056 | 280 | multiply_may_overflow, narrow_integral>( | 1057 | 280 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1058 | 280 | to_precision, to_scale, min_result, max_result, multiplier, | 1059 | 280 | params)) { | 1060 | 280 | if (set_nullable) { | 1061 | 280 | null_map_data[i] = 1; | 1062 | 280 | } else { | 1063 | 280 | return params.status; | 1064 | 280 | } | 1065 | 280 | } | 1066 | 280 | } | 1067 | 280 | return Status::OK(); | 1068 | 280 | }, | 1069 | 280 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1070 | 0 | if (narrow_integral) { | 1071 | 0 | block.get_by_position(result).column = | 1072 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1073 | 0 | } else { | 1074 | 0 | block.get_by_position(result).column = std::move(col_to); | 1075 | 0 | } | 1076 | 0 | return Status::OK(); | 1077 | 280 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEENS2_ILS3_28EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 980 | 312 | const NullMap::value_type* null_map = nullptr) const override { | 981 | 312 | using FromFieldType = typename FromDataType::FieldType; | 982 | 312 | using ToFieldType = typename ToDataType::FieldType; | 983 | 312 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 984 | 312 | const auto* col_from = | 985 | 312 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 986 | 312 | if (!col_from) { | 987 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 988 | 0 | named_from.column->get_name()); | 989 | 0 | } | 990 | | | 991 | 312 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 992 | 312 | UInt32 from_precision = from_decimal_type.get_precision(); | 993 | 312 | UInt32 from_scale = from_decimal_type.get_scale(); | 994 | | | 995 | 312 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 996 | 312 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 997 | 312 | UInt32 to_precision = to_decimal_type.get_precision(); | 998 | 312 | ToDataType::check_type_precision(to_precision); | 999 | 312 | UInt32 to_scale = to_decimal_type.get_scale(); | 1000 | 312 | ToDataType::check_type_scale(to_scale); | 1001 | | | 1002 | 312 | auto from_max_int_digit_count = from_precision - from_scale; | 1003 | 312 | auto to_max_int_digit_count = to_precision - to_scale; | 1004 | 312 | bool narrow_integral = | 1005 | 312 | (to_max_int_digit_count < from_max_int_digit_count) || | 1006 | 312 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1007 | | // only in non-strict mode and may overflow, we set nullable | 1008 | 312 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1009 | | | 1010 | 312 | size_t size = col_from->size(); | 1011 | 312 | ColumnUInt8::MutablePtr col_null_map_to; | 1012 | 312 | NullMap::value_type* null_map_data = nullptr; | 1013 | 312 | if (narrow_integral) { | 1014 | 272 | col_null_map_to = ColumnUInt8::create(size, 0); | 1015 | 272 | null_map_data = col_null_map_to->get_data().data(); | 1016 | 272 | } | 1017 | 312 | CastParameters params; | 1018 | 312 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1019 | 312 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1020 | 312 | const auto& vec_from = col_from->get_data(); | 1021 | 312 | const auto* vec_from_data = vec_from.data(); | 1022 | 312 | auto& vec_to = col_to->get_data(); | 1023 | 312 | auto* vec_to_data = vec_to.data(); | 1024 | | | 1025 | 312 | using MaxFieldType = | 1026 | 312 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1027 | 312 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1028 | 312 | std::is_same_v<FromFieldType, Decimal128V3>), | 1029 | 312 | Decimal128V3, | 1030 | 312 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1031 | 312 | FromFieldType, ToFieldType>>; | 1032 | 312 | using MaxNativeType = typename MaxFieldType::NativeType; | 1033 | | | 1034 | 312 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1035 | 312 | bool multiply_may_overflow = false; | 1036 | 312 | if (to_scale > from_scale) { | 1037 | 84 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1038 | 84 | } | 1039 | | | 1040 | 312 | typename ToFieldType::NativeType max_result = | 1041 | 312 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1042 | 312 | typename ToFieldType::NativeType min_result = -max_result; | 1043 | | | 1044 | 312 | MaxNativeType multiplier {}; | 1045 | 312 | if (from_scale < to_scale) { | 1046 | 84 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1047 | 84 | from_scale); | 1048 | 228 | } else if (from_scale > to_scale) { | 1049 | 148 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1050 | 148 | to_scale); | 1051 | 148 | } | 1052 | 312 | RETURN_IF_ERROR(std::visit( | 1053 | 312 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1054 | 312 | for (size_t i = 0; i < size; i++) { | 1055 | 312 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1056 | 312 | multiply_may_overflow, narrow_integral>( | 1057 | 312 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1058 | 312 | to_precision, to_scale, min_result, max_result, multiplier, | 1059 | 312 | params)) { | 1060 | 312 | if (set_nullable) { | 1061 | 312 | null_map_data[i] = 1; | 1062 | 312 | } else { | 1063 | 312 | return params.status; | 1064 | 312 | } | 1065 | 312 | } | 1066 | 312 | } | 1067 | 312 | return Status::OK(); | 1068 | 312 | }, | 1069 | 312 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1070 | 312 | if (narrow_integral) { | 1071 | 272 | block.get_by_position(result).column = | 1072 | 272 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1073 | 272 | } else { | 1074 | 40 | block.get_by_position(result).column = std::move(col_to); | 1075 | 40 | } | 1076 | 312 | return Status::OK(); | 1077 | 312 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEENS2_ILS3_28EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 980 | 280 | const NullMap::value_type* null_map = nullptr) const override { | 981 | 280 | using FromFieldType = typename FromDataType::FieldType; | 982 | 280 | using ToFieldType = typename ToDataType::FieldType; | 983 | 280 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 984 | 280 | const auto* col_from = | 985 | 280 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 986 | 280 | if (!col_from) { | 987 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 988 | 0 | named_from.column->get_name()); | 989 | 0 | } | 990 | | | 991 | 280 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 992 | 280 | UInt32 from_precision = from_decimal_type.get_precision(); | 993 | 280 | UInt32 from_scale = from_decimal_type.get_scale(); | 994 | | | 995 | 280 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 996 | 280 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 997 | 280 | UInt32 to_precision = to_decimal_type.get_precision(); | 998 | 280 | ToDataType::check_type_precision(to_precision); | 999 | 280 | UInt32 to_scale = to_decimal_type.get_scale(); | 1000 | 280 | ToDataType::check_type_scale(to_scale); | 1001 | | | 1002 | 280 | auto from_max_int_digit_count = from_precision - from_scale; | 1003 | 280 | auto to_max_int_digit_count = to_precision - to_scale; | 1004 | 280 | bool narrow_integral = | 1005 | 280 | (to_max_int_digit_count < from_max_int_digit_count) || | 1006 | 280 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1007 | | // only in non-strict mode and may overflow, we set nullable | 1008 | 280 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1009 | | | 1010 | 280 | size_t size = col_from->size(); | 1011 | 280 | ColumnUInt8::MutablePtr col_null_map_to; | 1012 | 280 | NullMap::value_type* null_map_data = nullptr; | 1013 | 280 | if (narrow_integral) { | 1014 | 280 | col_null_map_to = ColumnUInt8::create(size, 0); | 1015 | 280 | null_map_data = col_null_map_to->get_data().data(); | 1016 | 280 | } | 1017 | 280 | CastParameters params; | 1018 | 280 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1019 | 280 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1020 | 280 | const auto& vec_from = col_from->get_data(); | 1021 | 280 | const auto* vec_from_data = vec_from.data(); | 1022 | 280 | auto& vec_to = col_to->get_data(); | 1023 | 280 | auto* vec_to_data = vec_to.data(); | 1024 | | | 1025 | 280 | using MaxFieldType = | 1026 | 280 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1027 | 280 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1028 | 280 | std::is_same_v<FromFieldType, Decimal128V3>), | 1029 | 280 | Decimal128V3, | 1030 | 280 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1031 | 280 | FromFieldType, ToFieldType>>; | 1032 | 280 | using MaxNativeType = typename MaxFieldType::NativeType; | 1033 | | | 1034 | 280 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1035 | 280 | bool multiply_may_overflow = false; | 1036 | 280 | if (to_scale > from_scale) { | 1037 | 72 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1038 | 72 | } | 1039 | | | 1040 | 280 | typename ToFieldType::NativeType max_result = | 1041 | 280 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1042 | 280 | typename ToFieldType::NativeType min_result = -max_result; | 1043 | | | 1044 | 280 | MaxNativeType multiplier {}; | 1045 | 280 | if (from_scale < to_scale) { | 1046 | 72 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1047 | 72 | from_scale); | 1048 | 208 | } else if (from_scale > to_scale) { | 1049 | 160 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1050 | 160 | to_scale); | 1051 | 160 | } | 1052 | 280 | RETURN_IF_ERROR(std::visit( | 1053 | 280 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1054 | 280 | for (size_t i = 0; i < size; i++) { | 1055 | 280 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1056 | 280 | multiply_may_overflow, narrow_integral>( | 1057 | 280 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1058 | 280 | to_precision, to_scale, min_result, max_result, multiplier, | 1059 | 280 | params)) { | 1060 | 280 | if (set_nullable) { | 1061 | 280 | null_map_data[i] = 1; | 1062 | 280 | } else { | 1063 | 280 | return params.status; | 1064 | 280 | } | 1065 | 280 | } | 1066 | 280 | } | 1067 | 280 | return Status::OK(); | 1068 | 280 | }, | 1069 | 280 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1070 | 0 | if (narrow_integral) { | 1071 | 0 | block.get_by_position(result).column = | 1072 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1073 | 0 | } else { | 1074 | 0 | block.get_by_position(result).column = std::move(col_to); | 1075 | 0 | } | 1076 | 0 | return Status::OK(); | 1077 | 280 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEENS2_ILS3_28EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 980 | 312 | const NullMap::value_type* null_map = nullptr) const override { | 981 | 312 | using FromFieldType = typename FromDataType::FieldType; | 982 | 312 | using ToFieldType = typename ToDataType::FieldType; | 983 | 312 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 984 | 312 | const auto* col_from = | 985 | 312 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 986 | 312 | if (!col_from) { | 987 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 988 | 0 | named_from.column->get_name()); | 989 | 0 | } | 990 | | | 991 | 312 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 992 | 312 | UInt32 from_precision = from_decimal_type.get_precision(); | 993 | 312 | UInt32 from_scale = from_decimal_type.get_scale(); | 994 | | | 995 | 312 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 996 | 312 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 997 | 312 | UInt32 to_precision = to_decimal_type.get_precision(); | 998 | 312 | ToDataType::check_type_precision(to_precision); | 999 | 312 | UInt32 to_scale = to_decimal_type.get_scale(); | 1000 | 312 | ToDataType::check_type_scale(to_scale); | 1001 | | | 1002 | 312 | auto from_max_int_digit_count = from_precision - from_scale; | 1003 | 312 | auto to_max_int_digit_count = to_precision - to_scale; | 1004 | 312 | bool narrow_integral = | 1005 | 312 | (to_max_int_digit_count < from_max_int_digit_count) || | 1006 | 312 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1007 | | // only in non-strict mode and may overflow, we set nullable | 1008 | 312 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1009 | | | 1010 | 312 | size_t size = col_from->size(); | 1011 | 312 | ColumnUInt8::MutablePtr col_null_map_to; | 1012 | 312 | NullMap::value_type* null_map_data = nullptr; | 1013 | 312 | if (narrow_integral) { | 1014 | 272 | col_null_map_to = ColumnUInt8::create(size, 0); | 1015 | 272 | null_map_data = col_null_map_to->get_data().data(); | 1016 | 272 | } | 1017 | 312 | CastParameters params; | 1018 | 312 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1019 | 312 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1020 | 312 | const auto& vec_from = col_from->get_data(); | 1021 | 312 | const auto* vec_from_data = vec_from.data(); | 1022 | 312 | auto& vec_to = col_to->get_data(); | 1023 | 312 | auto* vec_to_data = vec_to.data(); | 1024 | | | 1025 | 312 | using MaxFieldType = | 1026 | 312 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1027 | 312 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1028 | 312 | std::is_same_v<FromFieldType, Decimal128V3>), | 1029 | 312 | Decimal128V3, | 1030 | 312 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1031 | 312 | FromFieldType, ToFieldType>>; | 1032 | 312 | using MaxNativeType = typename MaxFieldType::NativeType; | 1033 | | | 1034 | 312 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1035 | 312 | bool multiply_may_overflow = false; | 1036 | 312 | if (to_scale > from_scale) { | 1037 | 84 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1038 | 84 | } | 1039 | | | 1040 | 312 | typename ToFieldType::NativeType max_result = | 1041 | 312 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1042 | 312 | typename ToFieldType::NativeType min_result = -max_result; | 1043 | | | 1044 | 312 | MaxNativeType multiplier {}; | 1045 | 312 | if (from_scale < to_scale) { | 1046 | 84 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1047 | 84 | from_scale); | 1048 | 228 | } else if (from_scale > to_scale) { | 1049 | 148 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1050 | 148 | to_scale); | 1051 | 148 | } | 1052 | 312 | RETURN_IF_ERROR(std::visit( | 1053 | 312 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1054 | 312 | for (size_t i = 0; i < size; i++) { | 1055 | 312 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1056 | 312 | multiply_may_overflow, narrow_integral>( | 1057 | 312 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1058 | 312 | to_precision, to_scale, min_result, max_result, multiplier, | 1059 | 312 | params)) { | 1060 | 312 | if (set_nullable) { | 1061 | 312 | null_map_data[i] = 1; | 1062 | 312 | } else { | 1063 | 312 | return params.status; | 1064 | 312 | } | 1065 | 312 | } | 1066 | 312 | } | 1067 | 312 | return Status::OK(); | 1068 | 312 | }, | 1069 | 312 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1070 | 312 | if (narrow_integral) { | 1071 | 272 | block.get_by_position(result).column = | 1072 | 272 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1073 | 272 | } else { | 1074 | 40 | block.get_by_position(result).column = std::move(col_to); | 1075 | 40 | } | 1076 | 312 | return Status::OK(); | 1077 | 312 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEENS2_ILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 980 | 72 | const NullMap::value_type* null_map = nullptr) const override { | 981 | 72 | using FromFieldType = typename FromDataType::FieldType; | 982 | 72 | using ToFieldType = typename ToDataType::FieldType; | 983 | 72 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 984 | 72 | const auto* col_from = | 985 | 72 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 986 | 72 | if (!col_from) { | 987 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 988 | 0 | named_from.column->get_name()); | 989 | 0 | } | 990 | | | 991 | 72 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 992 | 72 | UInt32 from_precision = from_decimal_type.get_precision(); | 993 | 72 | UInt32 from_scale = from_decimal_type.get_scale(); | 994 | | | 995 | 72 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 996 | 72 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 997 | 72 | UInt32 to_precision = to_decimal_type.get_precision(); | 998 | 72 | ToDataType::check_type_precision(to_precision); | 999 | 72 | UInt32 to_scale = to_decimal_type.get_scale(); | 1000 | 72 | ToDataType::check_type_scale(to_scale); | 1001 | | | 1002 | 72 | auto from_max_int_digit_count = from_precision - from_scale; | 1003 | 72 | auto to_max_int_digit_count = to_precision - to_scale; | 1004 | 72 | bool narrow_integral = | 1005 | 72 | (to_max_int_digit_count < from_max_int_digit_count) || | 1006 | 72 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1007 | | // only in non-strict mode and may overflow, we set nullable | 1008 | 72 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1009 | | | 1010 | 72 | size_t size = col_from->size(); | 1011 | 72 | ColumnUInt8::MutablePtr col_null_map_to; | 1012 | 72 | NullMap::value_type* null_map_data = nullptr; | 1013 | 72 | if (narrow_integral) { | 1014 | 72 | col_null_map_to = ColumnUInt8::create(size, 0); | 1015 | 72 | null_map_data = col_null_map_to->get_data().data(); | 1016 | 72 | } | 1017 | 72 | CastParameters params; | 1018 | 72 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1019 | 72 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1020 | 72 | const auto& vec_from = col_from->get_data(); | 1021 | 72 | const auto* vec_from_data = vec_from.data(); | 1022 | 72 | auto& vec_to = col_to->get_data(); | 1023 | 72 | auto* vec_to_data = vec_to.data(); | 1024 | | | 1025 | 72 | using MaxFieldType = | 1026 | 72 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1027 | 72 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1028 | 72 | std::is_same_v<FromFieldType, Decimal128V3>), | 1029 | 72 | Decimal128V3, | 1030 | 72 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1031 | 72 | FromFieldType, ToFieldType>>; | 1032 | 72 | using MaxNativeType = typename MaxFieldType::NativeType; | 1033 | | | 1034 | 72 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1035 | 72 | bool multiply_may_overflow = false; | 1036 | 72 | if (to_scale > from_scale) { | 1037 | 72 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1038 | 72 | } | 1039 | | | 1040 | 72 | typename ToFieldType::NativeType max_result = | 1041 | 72 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1042 | 72 | typename ToFieldType::NativeType min_result = -max_result; | 1043 | | | 1044 | 72 | MaxNativeType multiplier {}; | 1045 | 72 | if (from_scale < to_scale) { | 1046 | 72 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1047 | 72 | from_scale); | 1048 | 72 | } else if (from_scale > to_scale) { | 1049 | 0 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1050 | 0 | to_scale); | 1051 | 0 | } | 1052 | 72 | RETURN_IF_ERROR(std::visit( | 1053 | 72 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1054 | 72 | for (size_t i = 0; i < size; i++) { | 1055 | 72 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1056 | 72 | multiply_may_overflow, narrow_integral>( | 1057 | 72 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1058 | 72 | to_precision, to_scale, min_result, max_result, multiplier, | 1059 | 72 | params)) { | 1060 | 72 | if (set_nullable) { | 1061 | 72 | null_map_data[i] = 1; | 1062 | 72 | } else { | 1063 | 72 | return params.status; | 1064 | 72 | } | 1065 | 72 | } | 1066 | 72 | } | 1067 | 72 | return Status::OK(); | 1068 | 72 | }, | 1069 | 72 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1070 | 0 | if (narrow_integral) { | 1071 | 0 | block.get_by_position(result).column = | 1072 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1073 | 0 | } else { | 1074 | 0 | block.get_by_position(result).column = std::move(col_to); | 1075 | 0 | } | 1076 | 0 | return Status::OK(); | 1077 | 72 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEENS2_ILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 980 | 264 | const NullMap::value_type* null_map = nullptr) const override { | 981 | 264 | using FromFieldType = typename FromDataType::FieldType; | 982 | 264 | using ToFieldType = typename ToDataType::FieldType; | 983 | 264 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 984 | 264 | const auto* col_from = | 985 | 264 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 986 | 264 | if (!col_from) { | 987 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 988 | 0 | named_from.column->get_name()); | 989 | 0 | } | 990 | | | 991 | 264 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 992 | 264 | UInt32 from_precision = from_decimal_type.get_precision(); | 993 | 264 | UInt32 from_scale = from_decimal_type.get_scale(); | 994 | | | 995 | 264 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 996 | 264 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 997 | 264 | UInt32 to_precision = to_decimal_type.get_precision(); | 998 | 264 | ToDataType::check_type_precision(to_precision); | 999 | 264 | UInt32 to_scale = to_decimal_type.get_scale(); | 1000 | 264 | ToDataType::check_type_scale(to_scale); | 1001 | | | 1002 | 264 | auto from_max_int_digit_count = from_precision - from_scale; | 1003 | 264 | auto to_max_int_digit_count = to_precision - to_scale; | 1004 | 264 | bool narrow_integral = | 1005 | 264 | (to_max_int_digit_count < from_max_int_digit_count) || | 1006 | 264 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1007 | | // only in non-strict mode and may overflow, we set nullable | 1008 | 264 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1009 | | | 1010 | 264 | size_t size = col_from->size(); | 1011 | 264 | ColumnUInt8::MutablePtr col_null_map_to; | 1012 | 264 | NullMap::value_type* null_map_data = nullptr; | 1013 | 264 | if (narrow_integral) { | 1014 | 64 | col_null_map_to = ColumnUInt8::create(size, 0); | 1015 | 64 | null_map_data = col_null_map_to->get_data().data(); | 1016 | 64 | } | 1017 | 264 | CastParameters params; | 1018 | 264 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1019 | 264 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1020 | 264 | const auto& vec_from = col_from->get_data(); | 1021 | 264 | const auto* vec_from_data = vec_from.data(); | 1022 | 264 | auto& vec_to = col_to->get_data(); | 1023 | 264 | auto* vec_to_data = vec_to.data(); | 1024 | | | 1025 | 264 | using MaxFieldType = | 1026 | 264 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1027 | 264 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1028 | 264 | std::is_same_v<FromFieldType, Decimal128V3>), | 1029 | 264 | Decimal128V3, | 1030 | 264 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1031 | 264 | FromFieldType, ToFieldType>>; | 1032 | 264 | using MaxNativeType = typename MaxFieldType::NativeType; | 1033 | | | 1034 | 264 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1035 | 264 | bool multiply_may_overflow = false; | 1036 | 264 | if (to_scale > from_scale) { | 1037 | 138 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1038 | 138 | } | 1039 | | | 1040 | 264 | typename ToFieldType::NativeType max_result = | 1041 | 264 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1042 | 264 | typename ToFieldType::NativeType min_result = -max_result; | 1043 | | | 1044 | 264 | MaxNativeType multiplier {}; | 1045 | 264 | if (from_scale < to_scale) { | 1046 | 138 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1047 | 138 | from_scale); | 1048 | 138 | } else if (from_scale > to_scale) { | 1049 | 60 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1050 | 60 | to_scale); | 1051 | 60 | } | 1052 | 264 | RETURN_IF_ERROR(std::visit( | 1053 | 264 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1054 | 264 | for (size_t i = 0; i < size; i++) { | 1055 | 264 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1056 | 264 | multiply_may_overflow, narrow_integral>( | 1057 | 264 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1058 | 264 | to_precision, to_scale, min_result, max_result, multiplier, | 1059 | 264 | params)) { | 1060 | 264 | if (set_nullable) { | 1061 | 264 | null_map_data[i] = 1; | 1062 | 264 | } else { | 1063 | 264 | return params.status; | 1064 | 264 | } | 1065 | 264 | } | 1066 | 264 | } | 1067 | 264 | return Status::OK(); | 1068 | 264 | }, | 1069 | 264 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1070 | 264 | if (narrow_integral) { | 1071 | 64 | block.get_by_position(result).column = | 1072 | 64 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1073 | 200 | } else { | 1074 | 200 | block.get_by_position(result).column = std::move(col_to); | 1075 | 200 | } | 1076 | 264 | return Status::OK(); | 1077 | 264 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEES4_E12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 980 | 184 | const NullMap::value_type* null_map = nullptr) const override { | 981 | 184 | using FromFieldType = typename FromDataType::FieldType; | 982 | 184 | using ToFieldType = typename ToDataType::FieldType; | 983 | 184 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 984 | 184 | const auto* col_from = | 985 | 184 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 986 | 184 | if (!col_from) { | 987 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 988 | 0 | named_from.column->get_name()); | 989 | 0 | } | 990 | | | 991 | 184 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 992 | 184 | UInt32 from_precision = from_decimal_type.get_precision(); | 993 | 184 | UInt32 from_scale = from_decimal_type.get_scale(); | 994 | | | 995 | 184 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 996 | 184 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 997 | 184 | UInt32 to_precision = to_decimal_type.get_precision(); | 998 | 184 | ToDataType::check_type_precision(to_precision); | 999 | 184 | UInt32 to_scale = to_decimal_type.get_scale(); | 1000 | 184 | ToDataType::check_type_scale(to_scale); | 1001 | | | 1002 | 184 | auto from_max_int_digit_count = from_precision - from_scale; | 1003 | 184 | auto to_max_int_digit_count = to_precision - to_scale; | 1004 | 184 | bool narrow_integral = | 1005 | 184 | (to_max_int_digit_count < from_max_int_digit_count) || | 1006 | 184 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1007 | | // only in non-strict mode and may overflow, we set nullable | 1008 | 184 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1009 | | | 1010 | 184 | size_t size = col_from->size(); | 1011 | 184 | ColumnUInt8::MutablePtr col_null_map_to; | 1012 | 184 | NullMap::value_type* null_map_data = nullptr; | 1013 | 184 | if (narrow_integral) { | 1014 | 184 | col_null_map_to = ColumnUInt8::create(size, 0); | 1015 | 184 | null_map_data = col_null_map_to->get_data().data(); | 1016 | 184 | } | 1017 | 184 | CastParameters params; | 1018 | 184 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1019 | 184 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1020 | 184 | const auto& vec_from = col_from->get_data(); | 1021 | 184 | const auto* vec_from_data = vec_from.data(); | 1022 | 184 | auto& vec_to = col_to->get_data(); | 1023 | 184 | auto* vec_to_data = vec_to.data(); | 1024 | | | 1025 | 184 | using MaxFieldType = | 1026 | 184 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1027 | 184 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1028 | 184 | std::is_same_v<FromFieldType, Decimal128V3>), | 1029 | 184 | Decimal128V3, | 1030 | 184 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1031 | 184 | FromFieldType, ToFieldType>>; | 1032 | 184 | using MaxNativeType = typename MaxFieldType::NativeType; | 1033 | | | 1034 | 184 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1035 | 184 | bool multiply_may_overflow = false; | 1036 | 184 | if (to_scale > from_scale) { | 1037 | 132 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1038 | 132 | } | 1039 | | | 1040 | 184 | typename ToFieldType::NativeType max_result = | 1041 | 184 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1042 | 184 | typename ToFieldType::NativeType min_result = -max_result; | 1043 | | | 1044 | 184 | MaxNativeType multiplier {}; | 1045 | 184 | if (from_scale < to_scale) { | 1046 | 132 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1047 | 132 | from_scale); | 1048 | 132 | } else if (from_scale > to_scale) { | 1049 | 40 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1050 | 40 | to_scale); | 1051 | 40 | } | 1052 | 184 | RETURN_IF_ERROR(std::visit( | 1053 | 184 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1054 | 184 | for (size_t i = 0; i < size; i++) { | 1055 | 184 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1056 | 184 | multiply_may_overflow, narrow_integral>( | 1057 | 184 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1058 | 184 | to_precision, to_scale, min_result, max_result, multiplier, | 1059 | 184 | params)) { | 1060 | 184 | if (set_nullable) { | 1061 | 184 | null_map_data[i] = 1; | 1062 | 184 | } else { | 1063 | 184 | return params.status; | 1064 | 184 | } | 1065 | 184 | } | 1066 | 184 | } | 1067 | 184 | return Status::OK(); | 1068 | 184 | }, | 1069 | 184 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1070 | 0 | if (narrow_integral) { | 1071 | 0 | block.get_by_position(result).column = | 1072 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1073 | 0 | } else { | 1074 | 0 | block.get_by_position(result).column = std::move(col_to); | 1075 | 0 | } | 1076 | 0 | return Status::OK(); | 1077 | 184 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEES4_E12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 980 | 360 | const NullMap::value_type* null_map = nullptr) const override { | 981 | 360 | using FromFieldType = typename FromDataType::FieldType; | 982 | 360 | using ToFieldType = typename ToDataType::FieldType; | 983 | 360 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 984 | 360 | const auto* col_from = | 985 | 360 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 986 | 360 | if (!col_from) { | 987 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 988 | 0 | named_from.column->get_name()); | 989 | 0 | } | 990 | | | 991 | 360 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 992 | 360 | UInt32 from_precision = from_decimal_type.get_precision(); | 993 | 360 | UInt32 from_scale = from_decimal_type.get_scale(); | 994 | | | 995 | 360 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 996 | 360 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 997 | 360 | UInt32 to_precision = to_decimal_type.get_precision(); | 998 | 360 | ToDataType::check_type_precision(to_precision); | 999 | 360 | UInt32 to_scale = to_decimal_type.get_scale(); | 1000 | 360 | ToDataType::check_type_scale(to_scale); | 1001 | | | 1002 | 360 | auto from_max_int_digit_count = from_precision - from_scale; | 1003 | 360 | auto to_max_int_digit_count = to_precision - to_scale; | 1004 | 360 | bool narrow_integral = | 1005 | 360 | (to_max_int_digit_count < from_max_int_digit_count) || | 1006 | 360 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1007 | | // only in non-strict mode and may overflow, we set nullable | 1008 | 360 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1009 | | | 1010 | 360 | size_t size = col_from->size(); | 1011 | 360 | ColumnUInt8::MutablePtr col_null_map_to; | 1012 | 360 | NullMap::value_type* null_map_data = nullptr; | 1013 | 360 | if (narrow_integral) { | 1014 | 208 | col_null_map_to = ColumnUInt8::create(size, 0); | 1015 | 208 | null_map_data = col_null_map_to->get_data().data(); | 1016 | 208 | } | 1017 | 360 | CastParameters params; | 1018 | 360 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1019 | 360 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1020 | 360 | const auto& vec_from = col_from->get_data(); | 1021 | 360 | const auto* vec_from_data = vec_from.data(); | 1022 | 360 | auto& vec_to = col_to->get_data(); | 1023 | 360 | auto* vec_to_data = vec_to.data(); | 1024 | | | 1025 | 360 | using MaxFieldType = | 1026 | 360 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1027 | 360 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1028 | 360 | std::is_same_v<FromFieldType, Decimal128V3>), | 1029 | 360 | Decimal128V3, | 1030 | 360 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1031 | 360 | FromFieldType, ToFieldType>>; | 1032 | 360 | using MaxNativeType = typename MaxFieldType::NativeType; | 1033 | | | 1034 | 360 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1035 | 360 | bool multiply_may_overflow = false; | 1036 | 360 | if (to_scale > from_scale) { | 1037 | 172 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1038 | 172 | } | 1039 | | | 1040 | 360 | typename ToFieldType::NativeType max_result = | 1041 | 360 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1042 | 360 | typename ToFieldType::NativeType min_result = -max_result; | 1043 | | | 1044 | 360 | MaxNativeType multiplier {}; | 1045 | 360 | if (from_scale < to_scale) { | 1046 | 172 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1047 | 172 | from_scale); | 1048 | 188 | } else if (from_scale > to_scale) { | 1049 | 136 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1050 | 136 | to_scale); | 1051 | 136 | } | 1052 | 360 | RETURN_IF_ERROR(std::visit( | 1053 | 360 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1054 | 360 | for (size_t i = 0; i < size; i++) { | 1055 | 360 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1056 | 360 | multiply_may_overflow, narrow_integral>( | 1057 | 360 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1058 | 360 | to_precision, to_scale, min_result, max_result, multiplier, | 1059 | 360 | params)) { | 1060 | 360 | if (set_nullable) { | 1061 | 360 | null_map_data[i] = 1; | 1062 | 360 | } else { | 1063 | 360 | return params.status; | 1064 | 360 | } | 1065 | 360 | } | 1066 | 360 | } | 1067 | 360 | return Status::OK(); | 1068 | 360 | }, | 1069 | 360 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1070 | 360 | if (narrow_integral) { | 1071 | 208 | block.get_by_position(result).column = | 1072 | 208 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1073 | 208 | } else { | 1074 | 152 | block.get_by_position(result).column = std::move(col_to); | 1075 | 152 | } | 1076 | 360 | return Status::OK(); | 1077 | 360 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEENS2_ILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 980 | 306 | const NullMap::value_type* null_map = nullptr) const override { | 981 | 306 | using FromFieldType = typename FromDataType::FieldType; | 982 | 306 | using ToFieldType = typename ToDataType::FieldType; | 983 | 306 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 984 | 306 | const auto* col_from = | 985 | 306 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 986 | 306 | if (!col_from) { | 987 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 988 | 0 | named_from.column->get_name()); | 989 | 0 | } | 990 | | | 991 | 306 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 992 | 306 | UInt32 from_precision = from_decimal_type.get_precision(); | 993 | 306 | UInt32 from_scale = from_decimal_type.get_scale(); | 994 | | | 995 | 306 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 996 | 306 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 997 | 306 | UInt32 to_precision = to_decimal_type.get_precision(); | 998 | 306 | ToDataType::check_type_precision(to_precision); | 999 | 306 | UInt32 to_scale = to_decimal_type.get_scale(); | 1000 | 306 | ToDataType::check_type_scale(to_scale); | 1001 | | | 1002 | 306 | auto from_max_int_digit_count = from_precision - from_scale; | 1003 | 306 | auto to_max_int_digit_count = to_precision - to_scale; | 1004 | 306 | bool narrow_integral = | 1005 | 306 | (to_max_int_digit_count < from_max_int_digit_count) || | 1006 | 306 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1007 | | // only in non-strict mode and may overflow, we set nullable | 1008 | 306 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1009 | | | 1010 | 306 | size_t size = col_from->size(); | 1011 | 306 | ColumnUInt8::MutablePtr col_null_map_to; | 1012 | 306 | NullMap::value_type* null_map_data = nullptr; | 1013 | 306 | if (narrow_integral) { | 1014 | 306 | col_null_map_to = ColumnUInt8::create(size, 0); | 1015 | 306 | null_map_data = col_null_map_to->get_data().data(); | 1016 | 306 | } | 1017 | 306 | CastParameters params; | 1018 | 306 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1019 | 306 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1020 | 306 | const auto& vec_from = col_from->get_data(); | 1021 | 306 | const auto* vec_from_data = vec_from.data(); | 1022 | 306 | auto& vec_to = col_to->get_data(); | 1023 | 306 | auto* vec_to_data = vec_to.data(); | 1024 | | | 1025 | 306 | using MaxFieldType = | 1026 | 306 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1027 | 306 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1028 | 306 | std::is_same_v<FromFieldType, Decimal128V3>), | 1029 | 306 | Decimal128V3, | 1030 | 306 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1031 | 306 | FromFieldType, ToFieldType>>; | 1032 | 306 | using MaxNativeType = typename MaxFieldType::NativeType; | 1033 | | | 1034 | 306 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1035 | 306 | bool multiply_may_overflow = false; | 1036 | 306 | if (to_scale > from_scale) { | 1037 | 120 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1038 | 120 | } | 1039 | | | 1040 | 306 | typename ToFieldType::NativeType max_result = | 1041 | 306 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1042 | 306 | typename ToFieldType::NativeType min_result = -max_result; | 1043 | | | 1044 | 306 | MaxNativeType multiplier {}; | 1045 | 306 | if (from_scale < to_scale) { | 1046 | 120 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1047 | 120 | from_scale); | 1048 | 186 | } else if (from_scale > to_scale) { | 1049 | 132 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1050 | 132 | to_scale); | 1051 | 132 | } | 1052 | 306 | RETURN_IF_ERROR(std::visit( | 1053 | 306 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1054 | 306 | for (size_t i = 0; i < size; i++) { | 1055 | 306 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1056 | 306 | multiply_may_overflow, narrow_integral>( | 1057 | 306 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1058 | 306 | to_precision, to_scale, min_result, max_result, multiplier, | 1059 | 306 | params)) { | 1060 | 306 | if (set_nullable) { | 1061 | 306 | null_map_data[i] = 1; | 1062 | 306 | } else { | 1063 | 306 | return params.status; | 1064 | 306 | } | 1065 | 306 | } | 1066 | 306 | } | 1067 | 306 | return Status::OK(); | 1068 | 306 | }, | 1069 | 306 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1070 | 0 | if (narrow_integral) { | 1071 | 0 | block.get_by_position(result).column = | 1072 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1073 | 0 | } else { | 1074 | 0 | block.get_by_position(result).column = std::move(col_to); | 1075 | 0 | } | 1076 | 0 | return Status::OK(); | 1077 | 306 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEENS2_ILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 980 | 456 | const NullMap::value_type* null_map = nullptr) const override { | 981 | 456 | using FromFieldType = typename FromDataType::FieldType; | 982 | 456 | using ToFieldType = typename ToDataType::FieldType; | 983 | 456 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 984 | 456 | const auto* col_from = | 985 | 456 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 986 | 456 | if (!col_from) { | 987 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 988 | 0 | named_from.column->get_name()); | 989 | 0 | } | 990 | | | 991 | 456 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 992 | 456 | UInt32 from_precision = from_decimal_type.get_precision(); | 993 | 456 | UInt32 from_scale = from_decimal_type.get_scale(); | 994 | | | 995 | 456 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 996 | 456 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 997 | 456 | UInt32 to_precision = to_decimal_type.get_precision(); | 998 | 456 | ToDataType::check_type_precision(to_precision); | 999 | 456 | UInt32 to_scale = to_decimal_type.get_scale(); | 1000 | 456 | ToDataType::check_type_scale(to_scale); | 1001 | | | 1002 | 456 | auto from_max_int_digit_count = from_precision - from_scale; | 1003 | 456 | auto to_max_int_digit_count = to_precision - to_scale; | 1004 | 456 | bool narrow_integral = | 1005 | 456 | (to_max_int_digit_count < from_max_int_digit_count) || | 1006 | 456 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1007 | | // only in non-strict mode and may overflow, we set nullable | 1008 | 456 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1009 | | | 1010 | 456 | size_t size = col_from->size(); | 1011 | 456 | ColumnUInt8::MutablePtr col_null_map_to; | 1012 | 456 | NullMap::value_type* null_map_data = nullptr; | 1013 | 456 | if (narrow_integral) { | 1014 | 384 | col_null_map_to = ColumnUInt8::create(size, 0); | 1015 | 384 | null_map_data = col_null_map_to->get_data().data(); | 1016 | 384 | } | 1017 | 456 | CastParameters params; | 1018 | 456 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1019 | 456 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1020 | 456 | const auto& vec_from = col_from->get_data(); | 1021 | 456 | const auto* vec_from_data = vec_from.data(); | 1022 | 456 | auto& vec_to = col_to->get_data(); | 1023 | 456 | auto* vec_to_data = vec_to.data(); | 1024 | | | 1025 | 456 | using MaxFieldType = | 1026 | 456 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1027 | 456 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1028 | 456 | std::is_same_v<FromFieldType, Decimal128V3>), | 1029 | 456 | Decimal128V3, | 1030 | 456 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1031 | 456 | FromFieldType, ToFieldType>>; | 1032 | 456 | using MaxNativeType = typename MaxFieldType::NativeType; | 1033 | | | 1034 | 456 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1035 | 456 | bool multiply_may_overflow = false; | 1036 | 456 | if (to_scale > from_scale) { | 1037 | 152 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1038 | 152 | } | 1039 | | | 1040 | 456 | typename ToFieldType::NativeType max_result = | 1041 | 456 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1042 | 456 | typename ToFieldType::NativeType min_result = -max_result; | 1043 | | | 1044 | 456 | MaxNativeType multiplier {}; | 1045 | 456 | if (from_scale < to_scale) { | 1046 | 152 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1047 | 152 | from_scale); | 1048 | 304 | } else if (from_scale > to_scale) { | 1049 | 188 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1050 | 188 | to_scale); | 1051 | 188 | } | 1052 | 456 | RETURN_IF_ERROR(std::visit( | 1053 | 456 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1054 | 456 | for (size_t i = 0; i < size; i++) { | 1055 | 456 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1056 | 456 | multiply_may_overflow, narrow_integral>( | 1057 | 456 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1058 | 456 | to_precision, to_scale, min_result, max_result, multiplier, | 1059 | 456 | params)) { | 1060 | 456 | if (set_nullable) { | 1061 | 456 | null_map_data[i] = 1; | 1062 | 456 | } else { | 1063 | 456 | return params.status; | 1064 | 456 | } | 1065 | 456 | } | 1066 | 456 | } | 1067 | 456 | return Status::OK(); | 1068 | 456 | }, | 1069 | 456 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1070 | 456 | if (narrow_integral) { | 1071 | 384 | block.get_by_position(result).column = | 1072 | 384 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1073 | 384 | } else { | 1074 | 72 | block.get_by_position(result).column = std::move(col_to); | 1075 | 72 | } | 1076 | 456 | return Status::OK(); | 1077 | 456 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEENS2_ILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 980 | 328 | const NullMap::value_type* null_map = nullptr) const override { | 981 | 328 | using FromFieldType = typename FromDataType::FieldType; | 982 | 328 | using ToFieldType = typename ToDataType::FieldType; | 983 | 328 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 984 | 328 | const auto* col_from = | 985 | 328 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 986 | 328 | if (!col_from) { | 987 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 988 | 0 | named_from.column->get_name()); | 989 | 0 | } | 990 | | | 991 | 328 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 992 | 328 | UInt32 from_precision = from_decimal_type.get_precision(); | 993 | 328 | UInt32 from_scale = from_decimal_type.get_scale(); | 994 | | | 995 | 328 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 996 | 328 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 997 | 328 | UInt32 to_precision = to_decimal_type.get_precision(); | 998 | 328 | ToDataType::check_type_precision(to_precision); | 999 | 328 | UInt32 to_scale = to_decimal_type.get_scale(); | 1000 | 328 | ToDataType::check_type_scale(to_scale); | 1001 | | | 1002 | 328 | auto from_max_int_digit_count = from_precision - from_scale; | 1003 | 328 | auto to_max_int_digit_count = to_precision - to_scale; | 1004 | 328 | bool narrow_integral = | 1005 | 328 | (to_max_int_digit_count < from_max_int_digit_count) || | 1006 | 328 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1007 | | // only in non-strict mode and may overflow, we set nullable | 1008 | 328 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1009 | | | 1010 | 328 | size_t size = col_from->size(); | 1011 | 328 | ColumnUInt8::MutablePtr col_null_map_to; | 1012 | 328 | NullMap::value_type* null_map_data = nullptr; | 1013 | 328 | if (narrow_integral) { | 1014 | 328 | col_null_map_to = ColumnUInt8::create(size, 0); | 1015 | 328 | null_map_data = col_null_map_to->get_data().data(); | 1016 | 328 | } | 1017 | 328 | CastParameters params; | 1018 | 328 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1019 | 328 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1020 | 328 | const auto& vec_from = col_from->get_data(); | 1021 | 328 | const auto* vec_from_data = vec_from.data(); | 1022 | 328 | auto& vec_to = col_to->get_data(); | 1023 | 328 | auto* vec_to_data = vec_to.data(); | 1024 | | | 1025 | 328 | using MaxFieldType = | 1026 | 328 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1027 | 328 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1028 | 328 | std::is_same_v<FromFieldType, Decimal128V3>), | 1029 | 328 | Decimal128V3, | 1030 | 328 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1031 | 328 | FromFieldType, ToFieldType>>; | 1032 | 328 | using MaxNativeType = typename MaxFieldType::NativeType; | 1033 | | | 1034 | 328 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1035 | 328 | bool multiply_may_overflow = false; | 1036 | 328 | if (to_scale > from_scale) { | 1037 | 120 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1038 | 120 | } | 1039 | | | 1040 | 328 | typename ToFieldType::NativeType max_result = | 1041 | 328 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1042 | 328 | typename ToFieldType::NativeType min_result = -max_result; | 1043 | | | 1044 | 328 | MaxNativeType multiplier {}; | 1045 | 328 | if (from_scale < to_scale) { | 1046 | 120 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1047 | 120 | from_scale); | 1048 | 208 | } else if (from_scale > to_scale) { | 1049 | 160 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1050 | 160 | to_scale); | 1051 | 160 | } | 1052 | 328 | RETURN_IF_ERROR(std::visit( | 1053 | 328 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1054 | 328 | for (size_t i = 0; i < size; i++) { | 1055 | 328 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1056 | 328 | multiply_may_overflow, narrow_integral>( | 1057 | 328 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1058 | 328 | to_precision, to_scale, min_result, max_result, multiplier, | 1059 | 328 | params)) { | 1060 | 328 | if (set_nullable) { | 1061 | 328 | null_map_data[i] = 1; | 1062 | 328 | } else { | 1063 | 328 | return params.status; | 1064 | 328 | } | 1065 | 328 | } | 1066 | 328 | } | 1067 | 328 | return Status::OK(); | 1068 | 328 | }, | 1069 | 328 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1070 | 0 | if (narrow_integral) { | 1071 | 0 | block.get_by_position(result).column = | 1072 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1073 | 0 | } else { | 1074 | 0 | block.get_by_position(result).column = std::move(col_to); | 1075 | 0 | } | 1076 | 0 | return Status::OK(); | 1077 | 328 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEENS2_ILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 980 | 456 | const NullMap::value_type* null_map = nullptr) const override { | 981 | 456 | using FromFieldType = typename FromDataType::FieldType; | 982 | 456 | using ToFieldType = typename ToDataType::FieldType; | 983 | 456 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 984 | 456 | const auto* col_from = | 985 | 456 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 986 | 456 | if (!col_from) { | 987 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 988 | 0 | named_from.column->get_name()); | 989 | 0 | } | 990 | | | 991 | 456 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 992 | 456 | UInt32 from_precision = from_decimal_type.get_precision(); | 993 | 456 | UInt32 from_scale = from_decimal_type.get_scale(); | 994 | | | 995 | 456 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 996 | 456 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 997 | 456 | UInt32 to_precision = to_decimal_type.get_precision(); | 998 | 456 | ToDataType::check_type_precision(to_precision); | 999 | 456 | UInt32 to_scale = to_decimal_type.get_scale(); | 1000 | 456 | ToDataType::check_type_scale(to_scale); | 1001 | | | 1002 | 456 | auto from_max_int_digit_count = from_precision - from_scale; | 1003 | 456 | auto to_max_int_digit_count = to_precision - to_scale; | 1004 | 456 | bool narrow_integral = | 1005 | 456 | (to_max_int_digit_count < from_max_int_digit_count) || | 1006 | 456 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1007 | | // only in non-strict mode and may overflow, we set nullable | 1008 | 456 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1009 | | | 1010 | 456 | size_t size = col_from->size(); | 1011 | 456 | ColumnUInt8::MutablePtr col_null_map_to; | 1012 | 456 | NullMap::value_type* null_map_data = nullptr; | 1013 | 456 | if (narrow_integral) { | 1014 | 384 | col_null_map_to = ColumnUInt8::create(size, 0); | 1015 | 384 | null_map_data = col_null_map_to->get_data().data(); | 1016 | 384 | } | 1017 | 456 | CastParameters params; | 1018 | 456 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1019 | 456 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1020 | 456 | const auto& vec_from = col_from->get_data(); | 1021 | 456 | const auto* vec_from_data = vec_from.data(); | 1022 | 456 | auto& vec_to = col_to->get_data(); | 1023 | 456 | auto* vec_to_data = vec_to.data(); | 1024 | | | 1025 | 456 | using MaxFieldType = | 1026 | 456 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1027 | 456 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1028 | 456 | std::is_same_v<FromFieldType, Decimal128V3>), | 1029 | 456 | Decimal128V3, | 1030 | 456 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1031 | 456 | FromFieldType, ToFieldType>>; | 1032 | 456 | using MaxNativeType = typename MaxFieldType::NativeType; | 1033 | | | 1034 | 456 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1035 | 456 | bool multiply_may_overflow = false; | 1036 | 456 | if (to_scale > from_scale) { | 1037 | 152 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1038 | 152 | } | 1039 | | | 1040 | 456 | typename ToFieldType::NativeType max_result = | 1041 | 456 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1042 | 456 | typename ToFieldType::NativeType min_result = -max_result; | 1043 | | | 1044 | 456 | MaxNativeType multiplier {}; | 1045 | 456 | if (from_scale < to_scale) { | 1046 | 152 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1047 | 152 | from_scale); | 1048 | 304 | } else if (from_scale > to_scale) { | 1049 | 192 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1050 | 192 | to_scale); | 1051 | 192 | } | 1052 | 456 | RETURN_IF_ERROR(std::visit( | 1053 | 456 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1054 | 456 | for (size_t i = 0; i < size; i++) { | 1055 | 456 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1056 | 456 | multiply_may_overflow, narrow_integral>( | 1057 | 456 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1058 | 456 | to_precision, to_scale, min_result, max_result, multiplier, | 1059 | 456 | params)) { | 1060 | 456 | if (set_nullable) { | 1061 | 456 | null_map_data[i] = 1; | 1062 | 456 | } else { | 1063 | 456 | return params.status; | 1064 | 456 | } | 1065 | 456 | } | 1066 | 456 | } | 1067 | 456 | return Status::OK(); | 1068 | 456 | }, | 1069 | 456 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1070 | 456 | if (narrow_integral) { | 1071 | 384 | block.get_by_position(result).column = | 1072 | 384 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1073 | 384 | } else { | 1074 | 72 | block.get_by_position(result).column = std::move(col_to); | 1075 | 72 | } | 1076 | 456 | return Status::OK(); | 1077 | 456 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEENS2_ILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 980 | 72 | const NullMap::value_type* null_map = nullptr) const override { | 981 | 72 | using FromFieldType = typename FromDataType::FieldType; | 982 | 72 | using ToFieldType = typename ToDataType::FieldType; | 983 | 72 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 984 | 72 | const auto* col_from = | 985 | 72 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 986 | 72 | if (!col_from) { | 987 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 988 | 0 | named_from.column->get_name()); | 989 | 0 | } | 990 | | | 991 | 72 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 992 | 72 | UInt32 from_precision = from_decimal_type.get_precision(); | 993 | 72 | UInt32 from_scale = from_decimal_type.get_scale(); | 994 | | | 995 | 72 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 996 | 72 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 997 | 72 | UInt32 to_precision = to_decimal_type.get_precision(); | 998 | 72 | ToDataType::check_type_precision(to_precision); | 999 | 72 | UInt32 to_scale = to_decimal_type.get_scale(); | 1000 | 72 | ToDataType::check_type_scale(to_scale); | 1001 | | | 1002 | 72 | auto from_max_int_digit_count = from_precision - from_scale; | 1003 | 72 | auto to_max_int_digit_count = to_precision - to_scale; | 1004 | 72 | bool narrow_integral = | 1005 | 72 | (to_max_int_digit_count < from_max_int_digit_count) || | 1006 | 72 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1007 | | // only in non-strict mode and may overflow, we set nullable | 1008 | 72 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1009 | | | 1010 | 72 | size_t size = col_from->size(); | 1011 | 72 | ColumnUInt8::MutablePtr col_null_map_to; | 1012 | 72 | NullMap::value_type* null_map_data = nullptr; | 1013 | 72 | if (narrow_integral) { | 1014 | 72 | col_null_map_to = ColumnUInt8::create(size, 0); | 1015 | 72 | null_map_data = col_null_map_to->get_data().data(); | 1016 | 72 | } | 1017 | 72 | CastParameters params; | 1018 | 72 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1019 | 72 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1020 | 72 | const auto& vec_from = col_from->get_data(); | 1021 | 72 | const auto* vec_from_data = vec_from.data(); | 1022 | 72 | auto& vec_to = col_to->get_data(); | 1023 | 72 | auto* vec_to_data = vec_to.data(); | 1024 | | | 1025 | 72 | using MaxFieldType = | 1026 | 72 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1027 | 72 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1028 | 72 | std::is_same_v<FromFieldType, Decimal128V3>), | 1029 | 72 | Decimal128V3, | 1030 | 72 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1031 | 72 | FromFieldType, ToFieldType>>; | 1032 | 72 | using MaxNativeType = typename MaxFieldType::NativeType; | 1033 | | | 1034 | 72 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1035 | 72 | bool multiply_may_overflow = false; | 1036 | 72 | if (to_scale > from_scale) { | 1037 | 72 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1038 | 72 | } | 1039 | | | 1040 | 72 | typename ToFieldType::NativeType max_result = | 1041 | 72 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1042 | 72 | typename ToFieldType::NativeType min_result = -max_result; | 1043 | | | 1044 | 72 | MaxNativeType multiplier {}; | 1045 | 72 | if (from_scale < to_scale) { | 1046 | 72 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1047 | 72 | from_scale); | 1048 | 72 | } else if (from_scale > to_scale) { | 1049 | 0 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1050 | 0 | to_scale); | 1051 | 0 | } | 1052 | 72 | RETURN_IF_ERROR(std::visit( | 1053 | 72 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1054 | 72 | for (size_t i = 0; i < size; i++) { | 1055 | 72 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1056 | 72 | multiply_may_overflow, narrow_integral>( | 1057 | 72 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1058 | 72 | to_precision, to_scale, min_result, max_result, multiplier, | 1059 | 72 | params)) { | 1060 | 72 | if (set_nullable) { | 1061 | 72 | null_map_data[i] = 1; | 1062 | 72 | } else { | 1063 | 72 | return params.status; | 1064 | 72 | } | 1065 | 72 | } | 1066 | 72 | } | 1067 | 72 | return Status::OK(); | 1068 | 72 | }, | 1069 | 72 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1070 | 0 | if (narrow_integral) { | 1071 | 0 | block.get_by_position(result).column = | 1072 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1073 | 0 | } else { | 1074 | 0 | block.get_by_position(result).column = std::move(col_to); | 1075 | 0 | } | 1076 | 0 | return Status::OK(); | 1077 | 72 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEENS2_ILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 980 | 264 | const NullMap::value_type* null_map = nullptr) const override { | 981 | 264 | using FromFieldType = typename FromDataType::FieldType; | 982 | 264 | using ToFieldType = typename ToDataType::FieldType; | 983 | 264 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 984 | 264 | const auto* col_from = | 985 | 264 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 986 | 264 | if (!col_from) { | 987 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 988 | 0 | named_from.column->get_name()); | 989 | 0 | } | 990 | | | 991 | 264 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 992 | 264 | UInt32 from_precision = from_decimal_type.get_precision(); | 993 | 264 | UInt32 from_scale = from_decimal_type.get_scale(); | 994 | | | 995 | 264 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 996 | 264 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 997 | 264 | UInt32 to_precision = to_decimal_type.get_precision(); | 998 | 264 | ToDataType::check_type_precision(to_precision); | 999 | 264 | UInt32 to_scale = to_decimal_type.get_scale(); | 1000 | 264 | ToDataType::check_type_scale(to_scale); | 1001 | | | 1002 | 264 | auto from_max_int_digit_count = from_precision - from_scale; | 1003 | 264 | auto to_max_int_digit_count = to_precision - to_scale; | 1004 | 264 | bool narrow_integral = | 1005 | 264 | (to_max_int_digit_count < from_max_int_digit_count) || | 1006 | 264 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1007 | | // only in non-strict mode and may overflow, we set nullable | 1008 | 264 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1009 | | | 1010 | 264 | size_t size = col_from->size(); | 1011 | 264 | ColumnUInt8::MutablePtr col_null_map_to; | 1012 | 264 | NullMap::value_type* null_map_data = nullptr; | 1013 | 264 | if (narrow_integral) { | 1014 | 64 | col_null_map_to = ColumnUInt8::create(size, 0); | 1015 | 64 | null_map_data = col_null_map_to->get_data().data(); | 1016 | 64 | } | 1017 | 264 | CastParameters params; | 1018 | 264 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1019 | 264 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1020 | 264 | const auto& vec_from = col_from->get_data(); | 1021 | 264 | const auto* vec_from_data = vec_from.data(); | 1022 | 264 | auto& vec_to = col_to->get_data(); | 1023 | 264 | auto* vec_to_data = vec_to.data(); | 1024 | | | 1025 | 264 | using MaxFieldType = | 1026 | 264 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1027 | 264 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1028 | 264 | std::is_same_v<FromFieldType, Decimal128V3>), | 1029 | 264 | Decimal128V3, | 1030 | 264 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1031 | 264 | FromFieldType, ToFieldType>>; | 1032 | 264 | using MaxNativeType = typename MaxFieldType::NativeType; | 1033 | | | 1034 | 264 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1035 | 264 | bool multiply_may_overflow = false; | 1036 | 264 | if (to_scale > from_scale) { | 1037 | 140 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1038 | 140 | } | 1039 | | | 1040 | 264 | typename ToFieldType::NativeType max_result = | 1041 | 264 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1042 | 264 | typename ToFieldType::NativeType min_result = -max_result; | 1043 | | | 1044 | 264 | MaxNativeType multiplier {}; | 1045 | 264 | if (from_scale < to_scale) { | 1046 | 140 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1047 | 140 | from_scale); | 1048 | 140 | } else if (from_scale > to_scale) { | 1049 | 60 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1050 | 60 | to_scale); | 1051 | 60 | } | 1052 | 264 | RETURN_IF_ERROR(std::visit( | 1053 | 264 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1054 | 264 | for (size_t i = 0; i < size; i++) { | 1055 | 264 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1056 | 264 | multiply_may_overflow, narrow_integral>( | 1057 | 264 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1058 | 264 | to_precision, to_scale, min_result, max_result, multiplier, | 1059 | 264 | params)) { | 1060 | 264 | if (set_nullable) { | 1061 | 264 | null_map_data[i] = 1; | 1062 | 264 | } else { | 1063 | 264 | return params.status; | 1064 | 264 | } | 1065 | 264 | } | 1066 | 264 | } | 1067 | 264 | return Status::OK(); | 1068 | 264 | }, | 1069 | 264 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1070 | 264 | if (narrow_integral) { | 1071 | 64 | block.get_by_position(result).column = | 1072 | 64 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1073 | 200 | } else { | 1074 | 200 | block.get_by_position(result).column = std::move(col_to); | 1075 | 200 | } | 1076 | 264 | return Status::OK(); | 1077 | 264 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEENS2_ILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 980 | 120 | const NullMap::value_type* null_map = nullptr) const override { | 981 | 120 | using FromFieldType = typename FromDataType::FieldType; | 982 | 120 | using ToFieldType = typename ToDataType::FieldType; | 983 | 120 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 984 | 120 | const auto* col_from = | 985 | 120 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 986 | 120 | if (!col_from) { | 987 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 988 | 0 | named_from.column->get_name()); | 989 | 0 | } | 990 | | | 991 | 120 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 992 | 120 | UInt32 from_precision = from_decimal_type.get_precision(); | 993 | 120 | UInt32 from_scale = from_decimal_type.get_scale(); | 994 | | | 995 | 120 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 996 | 120 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 997 | 120 | UInt32 to_precision = to_decimal_type.get_precision(); | 998 | 120 | ToDataType::check_type_precision(to_precision); | 999 | 120 | UInt32 to_scale = to_decimal_type.get_scale(); | 1000 | 120 | ToDataType::check_type_scale(to_scale); | 1001 | | | 1002 | 120 | auto from_max_int_digit_count = from_precision - from_scale; | 1003 | 120 | auto to_max_int_digit_count = to_precision - to_scale; | 1004 | 120 | bool narrow_integral = | 1005 | 120 | (to_max_int_digit_count < from_max_int_digit_count) || | 1006 | 120 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1007 | | // only in non-strict mode and may overflow, we set nullable | 1008 | 120 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1009 | | | 1010 | 120 | size_t size = col_from->size(); | 1011 | 120 | ColumnUInt8::MutablePtr col_null_map_to; | 1012 | 120 | NullMap::value_type* null_map_data = nullptr; | 1013 | 120 | if (narrow_integral) { | 1014 | 120 | col_null_map_to = ColumnUInt8::create(size, 0); | 1015 | 120 | null_map_data = col_null_map_to->get_data().data(); | 1016 | 120 | } | 1017 | 120 | CastParameters params; | 1018 | 120 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1019 | 120 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1020 | 120 | const auto& vec_from = col_from->get_data(); | 1021 | 120 | const auto* vec_from_data = vec_from.data(); | 1022 | 120 | auto& vec_to = col_to->get_data(); | 1023 | 120 | auto* vec_to_data = vec_to.data(); | 1024 | | | 1025 | 120 | using MaxFieldType = | 1026 | 120 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1027 | 120 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1028 | 120 | std::is_same_v<FromFieldType, Decimal128V3>), | 1029 | 120 | Decimal128V3, | 1030 | 120 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1031 | 120 | FromFieldType, ToFieldType>>; | 1032 | 120 | using MaxNativeType = typename MaxFieldType::NativeType; | 1033 | | | 1034 | 120 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1035 | 120 | bool multiply_may_overflow = false; | 1036 | 120 | if (to_scale > from_scale) { | 1037 | 120 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1038 | 120 | } | 1039 | | | 1040 | 120 | typename ToFieldType::NativeType max_result = | 1041 | 120 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1042 | 120 | typename ToFieldType::NativeType min_result = -max_result; | 1043 | | | 1044 | 120 | MaxNativeType multiplier {}; | 1045 | 120 | if (from_scale < to_scale) { | 1046 | 120 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1047 | 120 | from_scale); | 1048 | 120 | } else if (from_scale > to_scale) { | 1049 | 0 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1050 | 0 | to_scale); | 1051 | 0 | } | 1052 | 120 | RETURN_IF_ERROR(std::visit( | 1053 | 120 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1054 | 120 | for (size_t i = 0; i < size; i++) { | 1055 | 120 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1056 | 120 | multiply_may_overflow, narrow_integral>( | 1057 | 120 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1058 | 120 | to_precision, to_scale, min_result, max_result, multiplier, | 1059 | 120 | params)) { | 1060 | 120 | if (set_nullable) { | 1061 | 120 | null_map_data[i] = 1; | 1062 | 120 | } else { | 1063 | 120 | return params.status; | 1064 | 120 | } | 1065 | 120 | } | 1066 | 120 | } | 1067 | 120 | return Status::OK(); | 1068 | 120 | }, | 1069 | 120 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1070 | 0 | if (narrow_integral) { | 1071 | 0 | block.get_by_position(result).column = | 1072 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1073 | 0 | } else { | 1074 | 0 | block.get_by_position(result).column = std::move(col_to); | 1075 | 0 | } | 1076 | 0 | return Status::OK(); | 1077 | 120 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEENS2_ILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 980 | 408 | const NullMap::value_type* null_map = nullptr) const override { | 981 | 408 | using FromFieldType = typename FromDataType::FieldType; | 982 | 408 | using ToFieldType = typename ToDataType::FieldType; | 983 | 408 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 984 | 408 | const auto* col_from = | 985 | 408 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 986 | 408 | if (!col_from) { | 987 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 988 | 0 | named_from.column->get_name()); | 989 | 0 | } | 990 | | | 991 | 408 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 992 | 408 | UInt32 from_precision = from_decimal_type.get_precision(); | 993 | 408 | UInt32 from_scale = from_decimal_type.get_scale(); | 994 | | | 995 | 408 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 996 | 408 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 997 | 408 | UInt32 to_precision = to_decimal_type.get_precision(); | 998 | 408 | ToDataType::check_type_precision(to_precision); | 999 | 408 | UInt32 to_scale = to_decimal_type.get_scale(); | 1000 | 408 | ToDataType::check_type_scale(to_scale); | 1001 | | | 1002 | 408 | auto from_max_int_digit_count = from_precision - from_scale; | 1003 | 408 | auto to_max_int_digit_count = to_precision - to_scale; | 1004 | 408 | bool narrow_integral = | 1005 | 408 | (to_max_int_digit_count < from_max_int_digit_count) || | 1006 | 408 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1007 | | // only in non-strict mode and may overflow, we set nullable | 1008 | 408 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1009 | | | 1010 | 408 | size_t size = col_from->size(); | 1011 | 408 | ColumnUInt8::MutablePtr col_null_map_to; | 1012 | 408 | NullMap::value_type* null_map_data = nullptr; | 1013 | 408 | if (narrow_integral) { | 1014 | 112 | col_null_map_to = ColumnUInt8::create(size, 0); | 1015 | 112 | null_map_data = col_null_map_to->get_data().data(); | 1016 | 112 | } | 1017 | 408 | CastParameters params; | 1018 | 408 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1019 | 408 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1020 | 408 | const auto& vec_from = col_from->get_data(); | 1021 | 408 | const auto* vec_from_data = vec_from.data(); | 1022 | 408 | auto& vec_to = col_to->get_data(); | 1023 | 408 | auto* vec_to_data = vec_to.data(); | 1024 | | | 1025 | 408 | using MaxFieldType = | 1026 | 408 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1027 | 408 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1028 | 408 | std::is_same_v<FromFieldType, Decimal128V3>), | 1029 | 408 | Decimal128V3, | 1030 | 408 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1031 | 408 | FromFieldType, ToFieldType>>; | 1032 | 408 | using MaxNativeType = typename MaxFieldType::NativeType; | 1033 | | | 1034 | 408 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1035 | 408 | bool multiply_may_overflow = false; | 1036 | 408 | if (to_scale > from_scale) { | 1037 | 198 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1038 | 198 | } | 1039 | | | 1040 | 408 | typename ToFieldType::NativeType max_result = | 1041 | 408 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1042 | 408 | typename ToFieldType::NativeType min_result = -max_result; | 1043 | | | 1044 | 408 | MaxNativeType multiplier {}; | 1045 | 408 | if (from_scale < to_scale) { | 1046 | 198 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1047 | 198 | from_scale); | 1048 | 210 | } else if (from_scale > to_scale) { | 1049 | 112 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1050 | 112 | to_scale); | 1051 | 112 | } | 1052 | 408 | RETURN_IF_ERROR(std::visit( | 1053 | 408 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1054 | 408 | for (size_t i = 0; i < size; i++) { | 1055 | 408 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1056 | 408 | multiply_may_overflow, narrow_integral>( | 1057 | 408 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1058 | 408 | to_precision, to_scale, min_result, max_result, multiplier, | 1059 | 408 | params)) { | 1060 | 408 | if (set_nullable) { | 1061 | 408 | null_map_data[i] = 1; | 1062 | 408 | } else { | 1063 | 408 | return params.status; | 1064 | 408 | } | 1065 | 408 | } | 1066 | 408 | } | 1067 | 408 | return Status::OK(); | 1068 | 408 | }, | 1069 | 408 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1070 | 408 | if (narrow_integral) { | 1071 | 112 | block.get_by_position(result).column = | 1072 | 112 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1073 | 296 | } else { | 1074 | 296 | block.get_by_position(result).column = std::move(col_to); | 1075 | 296 | } | 1076 | 408 | return Status::OK(); | 1077 | 408 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEES4_E12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 980 | 184 | const NullMap::value_type* null_map = nullptr) const override { | 981 | 184 | using FromFieldType = typename FromDataType::FieldType; | 982 | 184 | using ToFieldType = typename ToDataType::FieldType; | 983 | 184 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 984 | 184 | const auto* col_from = | 985 | 184 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 986 | 184 | if (!col_from) { | 987 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 988 | 0 | named_from.column->get_name()); | 989 | 0 | } | 990 | | | 991 | 184 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 992 | 184 | UInt32 from_precision = from_decimal_type.get_precision(); | 993 | 184 | UInt32 from_scale = from_decimal_type.get_scale(); | 994 | | | 995 | 184 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 996 | 184 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 997 | 184 | UInt32 to_precision = to_decimal_type.get_precision(); | 998 | 184 | ToDataType::check_type_precision(to_precision); | 999 | 184 | UInt32 to_scale = to_decimal_type.get_scale(); | 1000 | 184 | ToDataType::check_type_scale(to_scale); | 1001 | | | 1002 | 184 | auto from_max_int_digit_count = from_precision - from_scale; | 1003 | 184 | auto to_max_int_digit_count = to_precision - to_scale; | 1004 | 184 | bool narrow_integral = | 1005 | 184 | (to_max_int_digit_count < from_max_int_digit_count) || | 1006 | 184 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1007 | | // only in non-strict mode and may overflow, we set nullable | 1008 | 184 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1009 | | | 1010 | 184 | size_t size = col_from->size(); | 1011 | 184 | ColumnUInt8::MutablePtr col_null_map_to; | 1012 | 184 | NullMap::value_type* null_map_data = nullptr; | 1013 | 184 | if (narrow_integral) { | 1014 | 184 | col_null_map_to = ColumnUInt8::create(size, 0); | 1015 | 184 | null_map_data = col_null_map_to->get_data().data(); | 1016 | 184 | } | 1017 | 184 | CastParameters params; | 1018 | 184 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1019 | 184 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1020 | 184 | const auto& vec_from = col_from->get_data(); | 1021 | 184 | const auto* vec_from_data = vec_from.data(); | 1022 | 184 | auto& vec_to = col_to->get_data(); | 1023 | 184 | auto* vec_to_data = vec_to.data(); | 1024 | | | 1025 | 184 | using MaxFieldType = | 1026 | 184 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1027 | 184 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1028 | 184 | std::is_same_v<FromFieldType, Decimal128V3>), | 1029 | 184 | Decimal128V3, | 1030 | 184 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1031 | 184 | FromFieldType, ToFieldType>>; | 1032 | 184 | using MaxNativeType = typename MaxFieldType::NativeType; | 1033 | | | 1034 | 184 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1035 | 184 | bool multiply_may_overflow = false; | 1036 | 184 | if (to_scale > from_scale) { | 1037 | 132 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1038 | 132 | } | 1039 | | | 1040 | 184 | typename ToFieldType::NativeType max_result = | 1041 | 184 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1042 | 184 | typename ToFieldType::NativeType min_result = -max_result; | 1043 | | | 1044 | 184 | MaxNativeType multiplier {}; | 1045 | 184 | if (from_scale < to_scale) { | 1046 | 132 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1047 | 132 | from_scale); | 1048 | 132 | } else if (from_scale > to_scale) { | 1049 | 40 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1050 | 40 | to_scale); | 1051 | 40 | } | 1052 | 184 | RETURN_IF_ERROR(std::visit( | 1053 | 184 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1054 | 184 | for (size_t i = 0; i < size; i++) { | 1055 | 184 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1056 | 184 | multiply_may_overflow, narrow_integral>( | 1057 | 184 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1058 | 184 | to_precision, to_scale, min_result, max_result, multiplier, | 1059 | 184 | params)) { | 1060 | 184 | if (set_nullable) { | 1061 | 184 | null_map_data[i] = 1; | 1062 | 184 | } else { | 1063 | 184 | return params.status; | 1064 | 184 | } | 1065 | 184 | } | 1066 | 184 | } | 1067 | 184 | return Status::OK(); | 1068 | 184 | }, | 1069 | 184 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1070 | 0 | if (narrow_integral) { | 1071 | 0 | block.get_by_position(result).column = | 1072 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1073 | 0 | } else { | 1074 | 0 | block.get_by_position(result).column = std::move(col_to); | 1075 | 0 | } | 1076 | 0 | return Status::OK(); | 1077 | 184 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEES4_E12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 980 | 360 | const NullMap::value_type* null_map = nullptr) const override { | 981 | 360 | using FromFieldType = typename FromDataType::FieldType; | 982 | 360 | using ToFieldType = typename ToDataType::FieldType; | 983 | 360 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 984 | 360 | const auto* col_from = | 985 | 360 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 986 | 360 | if (!col_from) { | 987 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 988 | 0 | named_from.column->get_name()); | 989 | 0 | } | 990 | | | 991 | 360 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 992 | 360 | UInt32 from_precision = from_decimal_type.get_precision(); | 993 | 360 | UInt32 from_scale = from_decimal_type.get_scale(); | 994 | | | 995 | 360 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 996 | 360 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 997 | 360 | UInt32 to_precision = to_decimal_type.get_precision(); | 998 | 360 | ToDataType::check_type_precision(to_precision); | 999 | 360 | UInt32 to_scale = to_decimal_type.get_scale(); | 1000 | 360 | ToDataType::check_type_scale(to_scale); | 1001 | | | 1002 | 360 | auto from_max_int_digit_count = from_precision - from_scale; | 1003 | 360 | auto to_max_int_digit_count = to_precision - to_scale; | 1004 | 360 | bool narrow_integral = | 1005 | 360 | (to_max_int_digit_count < from_max_int_digit_count) || | 1006 | 360 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1007 | | // only in non-strict mode and may overflow, we set nullable | 1008 | 360 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1009 | | | 1010 | 360 | size_t size = col_from->size(); | 1011 | 360 | ColumnUInt8::MutablePtr col_null_map_to; | 1012 | 360 | NullMap::value_type* null_map_data = nullptr; | 1013 | 360 | if (narrow_integral) { | 1014 | 208 | col_null_map_to = ColumnUInt8::create(size, 0); | 1015 | 208 | null_map_data = col_null_map_to->get_data().data(); | 1016 | 208 | } | 1017 | 360 | CastParameters params; | 1018 | 360 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1019 | 360 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1020 | 360 | const auto& vec_from = col_from->get_data(); | 1021 | 360 | const auto* vec_from_data = vec_from.data(); | 1022 | 360 | auto& vec_to = col_to->get_data(); | 1023 | 360 | auto* vec_to_data = vec_to.data(); | 1024 | | | 1025 | 360 | using MaxFieldType = | 1026 | 360 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1027 | 360 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1028 | 360 | std::is_same_v<FromFieldType, Decimal128V3>), | 1029 | 360 | Decimal128V3, | 1030 | 360 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1031 | 360 | FromFieldType, ToFieldType>>; | 1032 | 360 | using MaxNativeType = typename MaxFieldType::NativeType; | 1033 | | | 1034 | 360 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1035 | 360 | bool multiply_may_overflow = false; | 1036 | 360 | if (to_scale > from_scale) { | 1037 | 172 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1038 | 172 | } | 1039 | | | 1040 | 360 | typename ToFieldType::NativeType max_result = | 1041 | 360 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1042 | 360 | typename ToFieldType::NativeType min_result = -max_result; | 1043 | | | 1044 | 360 | MaxNativeType multiplier {}; | 1045 | 360 | if (from_scale < to_scale) { | 1046 | 172 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1047 | 172 | from_scale); | 1048 | 188 | } else if (from_scale > to_scale) { | 1049 | 136 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1050 | 136 | to_scale); | 1051 | 136 | } | 1052 | 360 | RETURN_IF_ERROR(std::visit( | 1053 | 360 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1054 | 360 | for (size_t i = 0; i < size; i++) { | 1055 | 360 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1056 | 360 | multiply_may_overflow, narrow_integral>( | 1057 | 360 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1058 | 360 | to_precision, to_scale, min_result, max_result, multiplier, | 1059 | 360 | params)) { | 1060 | 360 | if (set_nullable) { | 1061 | 360 | null_map_data[i] = 1; | 1062 | 360 | } else { | 1063 | 360 | return params.status; | 1064 | 360 | } | 1065 | 360 | } | 1066 | 360 | } | 1067 | 360 | return Status::OK(); | 1068 | 360 | }, | 1069 | 360 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1070 | 360 | if (narrow_integral) { | 1071 | 208 | block.get_by_position(result).column = | 1072 | 208 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1073 | 208 | } else { | 1074 | 152 | block.get_by_position(result).column = std::move(col_to); | 1075 | 152 | } | 1076 | 360 | return Status::OK(); | 1077 | 360 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEENS2_ILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 980 | 306 | const NullMap::value_type* null_map = nullptr) const override { | 981 | 306 | using FromFieldType = typename FromDataType::FieldType; | 982 | 306 | using ToFieldType = typename ToDataType::FieldType; | 983 | 306 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 984 | 306 | const auto* col_from = | 985 | 306 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 986 | 306 | if (!col_from) { | 987 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 988 | 0 | named_from.column->get_name()); | 989 | 0 | } | 990 | | | 991 | 306 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 992 | 306 | UInt32 from_precision = from_decimal_type.get_precision(); | 993 | 306 | UInt32 from_scale = from_decimal_type.get_scale(); | 994 | | | 995 | 306 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 996 | 306 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 997 | 306 | UInt32 to_precision = to_decimal_type.get_precision(); | 998 | 306 | ToDataType::check_type_precision(to_precision); | 999 | 306 | UInt32 to_scale = to_decimal_type.get_scale(); | 1000 | 306 | ToDataType::check_type_scale(to_scale); | 1001 | | | 1002 | 306 | auto from_max_int_digit_count = from_precision - from_scale; | 1003 | 306 | auto to_max_int_digit_count = to_precision - to_scale; | 1004 | 306 | bool narrow_integral = | 1005 | 306 | (to_max_int_digit_count < from_max_int_digit_count) || | 1006 | 306 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1007 | | // only in non-strict mode and may overflow, we set nullable | 1008 | 306 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1009 | | | 1010 | 306 | size_t size = col_from->size(); | 1011 | 306 | ColumnUInt8::MutablePtr col_null_map_to; | 1012 | 306 | NullMap::value_type* null_map_data = nullptr; | 1013 | 306 | if (narrow_integral) { | 1014 | 306 | col_null_map_to = ColumnUInt8::create(size, 0); | 1015 | 306 | null_map_data = col_null_map_to->get_data().data(); | 1016 | 306 | } | 1017 | 306 | CastParameters params; | 1018 | 306 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1019 | 306 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1020 | 306 | const auto& vec_from = col_from->get_data(); | 1021 | 306 | const auto* vec_from_data = vec_from.data(); | 1022 | 306 | auto& vec_to = col_to->get_data(); | 1023 | 306 | auto* vec_to_data = vec_to.data(); | 1024 | | | 1025 | 306 | using MaxFieldType = | 1026 | 306 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1027 | 306 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1028 | 306 | std::is_same_v<FromFieldType, Decimal128V3>), | 1029 | 306 | Decimal128V3, | 1030 | 306 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1031 | 306 | FromFieldType, ToFieldType>>; | 1032 | 306 | using MaxNativeType = typename MaxFieldType::NativeType; | 1033 | | | 1034 | 306 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1035 | 306 | bool multiply_may_overflow = false; | 1036 | 306 | if (to_scale > from_scale) { | 1037 | 120 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1038 | 120 | } | 1039 | | | 1040 | 306 | typename ToFieldType::NativeType max_result = | 1041 | 306 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1042 | 306 | typename ToFieldType::NativeType min_result = -max_result; | 1043 | | | 1044 | 306 | MaxNativeType multiplier {}; | 1045 | 306 | if (from_scale < to_scale) { | 1046 | 120 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1047 | 120 | from_scale); | 1048 | 186 | } else if (from_scale > to_scale) { | 1049 | 132 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1050 | 132 | to_scale); | 1051 | 132 | } | 1052 | 306 | RETURN_IF_ERROR(std::visit( | 1053 | 306 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1054 | 306 | for (size_t i = 0; i < size; i++) { | 1055 | 306 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1056 | 306 | multiply_may_overflow, narrow_integral>( | 1057 | 306 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1058 | 306 | to_precision, to_scale, min_result, max_result, multiplier, | 1059 | 306 | params)) { | 1060 | 306 | if (set_nullable) { | 1061 | 306 | null_map_data[i] = 1; | 1062 | 306 | } else { | 1063 | 306 | return params.status; | 1064 | 306 | } | 1065 | 306 | } | 1066 | 306 | } | 1067 | 306 | return Status::OK(); | 1068 | 306 | }, | 1069 | 306 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1070 | 0 | if (narrow_integral) { | 1071 | 0 | block.get_by_position(result).column = | 1072 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1073 | 0 | } else { | 1074 | 0 | block.get_by_position(result).column = std::move(col_to); | 1075 | 0 | } | 1076 | 0 | return Status::OK(); | 1077 | 306 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEENS2_ILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 980 | 456 | const NullMap::value_type* null_map = nullptr) const override { | 981 | 456 | using FromFieldType = typename FromDataType::FieldType; | 982 | 456 | using ToFieldType = typename ToDataType::FieldType; | 983 | 456 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 984 | 456 | const auto* col_from = | 985 | 456 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 986 | 456 | if (!col_from) { | 987 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 988 | 0 | named_from.column->get_name()); | 989 | 0 | } | 990 | | | 991 | 456 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 992 | 456 | UInt32 from_precision = from_decimal_type.get_precision(); | 993 | 456 | UInt32 from_scale = from_decimal_type.get_scale(); | 994 | | | 995 | 456 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 996 | 456 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 997 | 456 | UInt32 to_precision = to_decimal_type.get_precision(); | 998 | 456 | ToDataType::check_type_precision(to_precision); | 999 | 456 | UInt32 to_scale = to_decimal_type.get_scale(); | 1000 | 456 | ToDataType::check_type_scale(to_scale); | 1001 | | | 1002 | 456 | auto from_max_int_digit_count = from_precision - from_scale; | 1003 | 456 | auto to_max_int_digit_count = to_precision - to_scale; | 1004 | 456 | bool narrow_integral = | 1005 | 456 | (to_max_int_digit_count < from_max_int_digit_count) || | 1006 | 456 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1007 | | // only in non-strict mode and may overflow, we set nullable | 1008 | 456 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1009 | | | 1010 | 456 | size_t size = col_from->size(); | 1011 | 456 | ColumnUInt8::MutablePtr col_null_map_to; | 1012 | 456 | NullMap::value_type* null_map_data = nullptr; | 1013 | 456 | if (narrow_integral) { | 1014 | 384 | col_null_map_to = ColumnUInt8::create(size, 0); | 1015 | 384 | null_map_data = col_null_map_to->get_data().data(); | 1016 | 384 | } | 1017 | 456 | CastParameters params; | 1018 | 456 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1019 | 456 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1020 | 456 | const auto& vec_from = col_from->get_data(); | 1021 | 456 | const auto* vec_from_data = vec_from.data(); | 1022 | 456 | auto& vec_to = col_to->get_data(); | 1023 | 456 | auto* vec_to_data = vec_to.data(); | 1024 | | | 1025 | 456 | using MaxFieldType = | 1026 | 456 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1027 | 456 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1028 | 456 | std::is_same_v<FromFieldType, Decimal128V3>), | 1029 | 456 | Decimal128V3, | 1030 | 456 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1031 | 456 | FromFieldType, ToFieldType>>; | 1032 | 456 | using MaxNativeType = typename MaxFieldType::NativeType; | 1033 | | | 1034 | 456 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1035 | 456 | bool multiply_may_overflow = false; | 1036 | 456 | if (to_scale > from_scale) { | 1037 | 152 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1038 | 152 | } | 1039 | | | 1040 | 456 | typename ToFieldType::NativeType max_result = | 1041 | 456 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1042 | 456 | typename ToFieldType::NativeType min_result = -max_result; | 1043 | | | 1044 | 456 | MaxNativeType multiplier {}; | 1045 | 456 | if (from_scale < to_scale) { | 1046 | 152 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1047 | 152 | from_scale); | 1048 | 304 | } else if (from_scale > to_scale) { | 1049 | 188 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1050 | 188 | to_scale); | 1051 | 188 | } | 1052 | 456 | RETURN_IF_ERROR(std::visit( | 1053 | 456 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1054 | 456 | for (size_t i = 0; i < size; i++) { | 1055 | 456 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1056 | 456 | multiply_may_overflow, narrow_integral>( | 1057 | 456 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1058 | 456 | to_precision, to_scale, min_result, max_result, multiplier, | 1059 | 456 | params)) { | 1060 | 456 | if (set_nullable) { | 1061 | 456 | null_map_data[i] = 1; | 1062 | 456 | } else { | 1063 | 456 | return params.status; | 1064 | 456 | } | 1065 | 456 | } | 1066 | 456 | } | 1067 | 456 | return Status::OK(); | 1068 | 456 | }, | 1069 | 456 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1070 | 456 | if (narrow_integral) { | 1071 | 384 | block.get_by_position(result).column = | 1072 | 384 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1073 | 384 | } else { | 1074 | 72 | block.get_by_position(result).column = std::move(col_to); | 1075 | 72 | } | 1076 | 456 | return Status::OK(); | 1077 | 456 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEENS2_ILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 980 | 72 | const NullMap::value_type* null_map = nullptr) const override { | 981 | 72 | using FromFieldType = typename FromDataType::FieldType; | 982 | 72 | using ToFieldType = typename ToDataType::FieldType; | 983 | 72 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 984 | 72 | const auto* col_from = | 985 | 72 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 986 | 72 | if (!col_from) { | 987 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 988 | 0 | named_from.column->get_name()); | 989 | 0 | } | 990 | | | 991 | 72 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 992 | 72 | UInt32 from_precision = from_decimal_type.get_precision(); | 993 | 72 | UInt32 from_scale = from_decimal_type.get_scale(); | 994 | | | 995 | 72 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 996 | 72 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 997 | 72 | UInt32 to_precision = to_decimal_type.get_precision(); | 998 | 72 | ToDataType::check_type_precision(to_precision); | 999 | 72 | UInt32 to_scale = to_decimal_type.get_scale(); | 1000 | 72 | ToDataType::check_type_scale(to_scale); | 1001 | | | 1002 | 72 | auto from_max_int_digit_count = from_precision - from_scale; | 1003 | 72 | auto to_max_int_digit_count = to_precision - to_scale; | 1004 | 72 | bool narrow_integral = | 1005 | 72 | (to_max_int_digit_count < from_max_int_digit_count) || | 1006 | 72 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1007 | | // only in non-strict mode and may overflow, we set nullable | 1008 | 72 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1009 | | | 1010 | 72 | size_t size = col_from->size(); | 1011 | 72 | ColumnUInt8::MutablePtr col_null_map_to; | 1012 | 72 | NullMap::value_type* null_map_data = nullptr; | 1013 | 72 | if (narrow_integral) { | 1014 | 72 | col_null_map_to = ColumnUInt8::create(size, 0); | 1015 | 72 | null_map_data = col_null_map_to->get_data().data(); | 1016 | 72 | } | 1017 | 72 | CastParameters params; | 1018 | 72 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1019 | 72 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1020 | 72 | const auto& vec_from = col_from->get_data(); | 1021 | 72 | const auto* vec_from_data = vec_from.data(); | 1022 | 72 | auto& vec_to = col_to->get_data(); | 1023 | 72 | auto* vec_to_data = vec_to.data(); | 1024 | | | 1025 | 72 | using MaxFieldType = | 1026 | 72 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1027 | 72 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1028 | 72 | std::is_same_v<FromFieldType, Decimal128V3>), | 1029 | 72 | Decimal128V3, | 1030 | 72 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1031 | 72 | FromFieldType, ToFieldType>>; | 1032 | 72 | using MaxNativeType = typename MaxFieldType::NativeType; | 1033 | | | 1034 | 72 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1035 | 72 | bool multiply_may_overflow = false; | 1036 | 72 | if (to_scale > from_scale) { | 1037 | 72 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1038 | 72 | } | 1039 | | | 1040 | 72 | typename ToFieldType::NativeType max_result = | 1041 | 72 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1042 | 72 | typename ToFieldType::NativeType min_result = -max_result; | 1043 | | | 1044 | 72 | MaxNativeType multiplier {}; | 1045 | 72 | if (from_scale < to_scale) { | 1046 | 72 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1047 | 72 | from_scale); | 1048 | 72 | } else if (from_scale > to_scale) { | 1049 | 0 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1050 | 0 | to_scale); | 1051 | 0 | } | 1052 | 72 | RETURN_IF_ERROR(std::visit( | 1053 | 72 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1054 | 72 | for (size_t i = 0; i < size; i++) { | 1055 | 72 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1056 | 72 | multiply_may_overflow, narrow_integral>( | 1057 | 72 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1058 | 72 | to_precision, to_scale, min_result, max_result, multiplier, | 1059 | 72 | params)) { | 1060 | 72 | if (set_nullable) { | 1061 | 72 | null_map_data[i] = 1; | 1062 | 72 | } else { | 1063 | 72 | return params.status; | 1064 | 72 | } | 1065 | 72 | } | 1066 | 72 | } | 1067 | 72 | return Status::OK(); | 1068 | 72 | }, | 1069 | 72 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1070 | 0 | if (narrow_integral) { | 1071 | 0 | block.get_by_position(result).column = | 1072 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1073 | 0 | } else { | 1074 | 0 | block.get_by_position(result).column = std::move(col_to); | 1075 | 0 | } | 1076 | 0 | return Status::OK(); | 1077 | 72 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEENS2_ILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 980 | 264 | const NullMap::value_type* null_map = nullptr) const override { | 981 | 264 | using FromFieldType = typename FromDataType::FieldType; | 982 | 264 | using ToFieldType = typename ToDataType::FieldType; | 983 | 264 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 984 | 264 | const auto* col_from = | 985 | 264 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 986 | 264 | if (!col_from) { | 987 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 988 | 0 | named_from.column->get_name()); | 989 | 0 | } | 990 | | | 991 | 264 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 992 | 264 | UInt32 from_precision = from_decimal_type.get_precision(); | 993 | 264 | UInt32 from_scale = from_decimal_type.get_scale(); | 994 | | | 995 | 264 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 996 | 264 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 997 | 264 | UInt32 to_precision = to_decimal_type.get_precision(); | 998 | 264 | ToDataType::check_type_precision(to_precision); | 999 | 264 | UInt32 to_scale = to_decimal_type.get_scale(); | 1000 | 264 | ToDataType::check_type_scale(to_scale); | 1001 | | | 1002 | 264 | auto from_max_int_digit_count = from_precision - from_scale; | 1003 | 264 | auto to_max_int_digit_count = to_precision - to_scale; | 1004 | 264 | bool narrow_integral = | 1005 | 264 | (to_max_int_digit_count < from_max_int_digit_count) || | 1006 | 264 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1007 | | // only in non-strict mode and may overflow, we set nullable | 1008 | 264 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1009 | | | 1010 | 264 | size_t size = col_from->size(); | 1011 | 264 | ColumnUInt8::MutablePtr col_null_map_to; | 1012 | 264 | NullMap::value_type* null_map_data = nullptr; | 1013 | 264 | if (narrow_integral) { | 1014 | 64 | col_null_map_to = ColumnUInt8::create(size, 0); | 1015 | 64 | null_map_data = col_null_map_to->get_data().data(); | 1016 | 64 | } | 1017 | 264 | CastParameters params; | 1018 | 264 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1019 | 264 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1020 | 264 | const auto& vec_from = col_from->get_data(); | 1021 | 264 | const auto* vec_from_data = vec_from.data(); | 1022 | 264 | auto& vec_to = col_to->get_data(); | 1023 | 264 | auto* vec_to_data = vec_to.data(); | 1024 | | | 1025 | 264 | using MaxFieldType = | 1026 | 264 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1027 | 264 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1028 | 264 | std::is_same_v<FromFieldType, Decimal128V3>), | 1029 | 264 | Decimal128V3, | 1030 | 264 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1031 | 264 | FromFieldType, ToFieldType>>; | 1032 | 264 | using MaxNativeType = typename MaxFieldType::NativeType; | 1033 | | | 1034 | 264 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1035 | 264 | bool multiply_may_overflow = false; | 1036 | 264 | if (to_scale > from_scale) { | 1037 | 140 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1038 | 140 | } | 1039 | | | 1040 | 264 | typename ToFieldType::NativeType max_result = | 1041 | 264 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1042 | 264 | typename ToFieldType::NativeType min_result = -max_result; | 1043 | | | 1044 | 264 | MaxNativeType multiplier {}; | 1045 | 264 | if (from_scale < to_scale) { | 1046 | 140 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1047 | 140 | from_scale); | 1048 | 140 | } else if (from_scale > to_scale) { | 1049 | 60 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1050 | 60 | to_scale); | 1051 | 60 | } | 1052 | 264 | RETURN_IF_ERROR(std::visit( | 1053 | 264 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1054 | 264 | for (size_t i = 0; i < size; i++) { | 1055 | 264 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1056 | 264 | multiply_may_overflow, narrow_integral>( | 1057 | 264 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1058 | 264 | to_precision, to_scale, min_result, max_result, multiplier, | 1059 | 264 | params)) { | 1060 | 264 | if (set_nullable) { | 1061 | 264 | null_map_data[i] = 1; | 1062 | 264 | } else { | 1063 | 264 | return params.status; | 1064 | 264 | } | 1065 | 264 | } | 1066 | 264 | } | 1067 | 264 | return Status::OK(); | 1068 | 264 | }, | 1069 | 264 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1070 | 264 | if (narrow_integral) { | 1071 | 64 | block.get_by_position(result).column = | 1072 | 64 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1073 | 200 | } else { | 1074 | 200 | block.get_by_position(result).column = std::move(col_to); | 1075 | 200 | } | 1076 | 264 | return Status::OK(); | 1077 | 264 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEENS2_ILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 980 | 120 | const NullMap::value_type* null_map = nullptr) const override { | 981 | 120 | using FromFieldType = typename FromDataType::FieldType; | 982 | 120 | using ToFieldType = typename ToDataType::FieldType; | 983 | 120 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 984 | 120 | const auto* col_from = | 985 | 120 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 986 | 120 | if (!col_from) { | 987 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 988 | 0 | named_from.column->get_name()); | 989 | 0 | } | 990 | | | 991 | 120 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 992 | 120 | UInt32 from_precision = from_decimal_type.get_precision(); | 993 | 120 | UInt32 from_scale = from_decimal_type.get_scale(); | 994 | | | 995 | 120 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 996 | 120 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 997 | 120 | UInt32 to_precision = to_decimal_type.get_precision(); | 998 | 120 | ToDataType::check_type_precision(to_precision); | 999 | 120 | UInt32 to_scale = to_decimal_type.get_scale(); | 1000 | 120 | ToDataType::check_type_scale(to_scale); | 1001 | | | 1002 | 120 | auto from_max_int_digit_count = from_precision - from_scale; | 1003 | 120 | auto to_max_int_digit_count = to_precision - to_scale; | 1004 | 120 | bool narrow_integral = | 1005 | 120 | (to_max_int_digit_count < from_max_int_digit_count) || | 1006 | 120 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1007 | | // only in non-strict mode and may overflow, we set nullable | 1008 | 120 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1009 | | | 1010 | 120 | size_t size = col_from->size(); | 1011 | 120 | ColumnUInt8::MutablePtr col_null_map_to; | 1012 | 120 | NullMap::value_type* null_map_data = nullptr; | 1013 | 120 | if (narrow_integral) { | 1014 | 120 | col_null_map_to = ColumnUInt8::create(size, 0); | 1015 | 120 | null_map_data = col_null_map_to->get_data().data(); | 1016 | 120 | } | 1017 | 120 | CastParameters params; | 1018 | 120 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1019 | 120 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1020 | 120 | const auto& vec_from = col_from->get_data(); | 1021 | 120 | const auto* vec_from_data = vec_from.data(); | 1022 | 120 | auto& vec_to = col_to->get_data(); | 1023 | 120 | auto* vec_to_data = vec_to.data(); | 1024 | | | 1025 | 120 | using MaxFieldType = | 1026 | 120 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1027 | 120 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1028 | 120 | std::is_same_v<FromFieldType, Decimal128V3>), | 1029 | 120 | Decimal128V3, | 1030 | 120 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1031 | 120 | FromFieldType, ToFieldType>>; | 1032 | 120 | using MaxNativeType = typename MaxFieldType::NativeType; | 1033 | | | 1034 | 120 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1035 | 120 | bool multiply_may_overflow = false; | 1036 | 120 | if (to_scale > from_scale) { | 1037 | 120 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1038 | 120 | } | 1039 | | | 1040 | 120 | typename ToFieldType::NativeType max_result = | 1041 | 120 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1042 | 120 | typename ToFieldType::NativeType min_result = -max_result; | 1043 | | | 1044 | 120 | MaxNativeType multiplier {}; | 1045 | 120 | if (from_scale < to_scale) { | 1046 | 120 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1047 | 120 | from_scale); | 1048 | 120 | } else if (from_scale > to_scale) { | 1049 | 0 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1050 | 0 | to_scale); | 1051 | 0 | } | 1052 | 120 | RETURN_IF_ERROR(std::visit( | 1053 | 120 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1054 | 120 | for (size_t i = 0; i < size; i++) { | 1055 | 120 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1056 | 120 | multiply_may_overflow, narrow_integral>( | 1057 | 120 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1058 | 120 | to_precision, to_scale, min_result, max_result, multiplier, | 1059 | 120 | params)) { | 1060 | 120 | if (set_nullable) { | 1061 | 120 | null_map_data[i] = 1; | 1062 | 120 | } else { | 1063 | 120 | return params.status; | 1064 | 120 | } | 1065 | 120 | } | 1066 | 120 | } | 1067 | 120 | return Status::OK(); | 1068 | 120 | }, | 1069 | 120 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1070 | 0 | if (narrow_integral) { | 1071 | 0 | block.get_by_position(result).column = | 1072 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1073 | 0 | } else { | 1074 | 0 | block.get_by_position(result).column = std::move(col_to); | 1075 | 0 | } | 1076 | 0 | return Status::OK(); | 1077 | 120 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEENS2_ILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 980 | 408 | const NullMap::value_type* null_map = nullptr) const override { | 981 | 408 | using FromFieldType = typename FromDataType::FieldType; | 982 | 408 | using ToFieldType = typename ToDataType::FieldType; | 983 | 408 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 984 | 408 | const auto* col_from = | 985 | 408 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 986 | 408 | if (!col_from) { | 987 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 988 | 0 | named_from.column->get_name()); | 989 | 0 | } | 990 | | | 991 | 408 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 992 | 408 | UInt32 from_precision = from_decimal_type.get_precision(); | 993 | 408 | UInt32 from_scale = from_decimal_type.get_scale(); | 994 | | | 995 | 408 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 996 | 408 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 997 | 408 | UInt32 to_precision = to_decimal_type.get_precision(); | 998 | 408 | ToDataType::check_type_precision(to_precision); | 999 | 408 | UInt32 to_scale = to_decimal_type.get_scale(); | 1000 | 408 | ToDataType::check_type_scale(to_scale); | 1001 | | | 1002 | 408 | auto from_max_int_digit_count = from_precision - from_scale; | 1003 | 408 | auto to_max_int_digit_count = to_precision - to_scale; | 1004 | 408 | bool narrow_integral = | 1005 | 408 | (to_max_int_digit_count < from_max_int_digit_count) || | 1006 | 408 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1007 | | // only in non-strict mode and may overflow, we set nullable | 1008 | 408 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1009 | | | 1010 | 408 | size_t size = col_from->size(); | 1011 | 408 | ColumnUInt8::MutablePtr col_null_map_to; | 1012 | 408 | NullMap::value_type* null_map_data = nullptr; | 1013 | 408 | if (narrow_integral) { | 1014 | 112 | col_null_map_to = ColumnUInt8::create(size, 0); | 1015 | 112 | null_map_data = col_null_map_to->get_data().data(); | 1016 | 112 | } | 1017 | 408 | CastParameters params; | 1018 | 408 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1019 | 408 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1020 | 408 | const auto& vec_from = col_from->get_data(); | 1021 | 408 | const auto* vec_from_data = vec_from.data(); | 1022 | 408 | auto& vec_to = col_to->get_data(); | 1023 | 408 | auto* vec_to_data = vec_to.data(); | 1024 | | | 1025 | 408 | using MaxFieldType = | 1026 | 408 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1027 | 408 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1028 | 408 | std::is_same_v<FromFieldType, Decimal128V3>), | 1029 | 408 | Decimal128V3, | 1030 | 408 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1031 | 408 | FromFieldType, ToFieldType>>; | 1032 | 408 | using MaxNativeType = typename MaxFieldType::NativeType; | 1033 | | | 1034 | 408 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1035 | 408 | bool multiply_may_overflow = false; | 1036 | 408 | if (to_scale > from_scale) { | 1037 | 200 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1038 | 200 | } | 1039 | | | 1040 | 408 | typename ToFieldType::NativeType max_result = | 1041 | 408 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1042 | 408 | typename ToFieldType::NativeType min_result = -max_result; | 1043 | | | 1044 | 408 | MaxNativeType multiplier {}; | 1045 | 408 | if (from_scale < to_scale) { | 1046 | 200 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1047 | 200 | from_scale); | 1048 | 208 | } else if (from_scale > to_scale) { | 1049 | 112 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1050 | 112 | to_scale); | 1051 | 112 | } | 1052 | 408 | RETURN_IF_ERROR(std::visit( | 1053 | 408 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1054 | 408 | for (size_t i = 0; i < size; i++) { | 1055 | 408 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1056 | 408 | multiply_may_overflow, narrow_integral>( | 1057 | 408 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1058 | 408 | to_precision, to_scale, min_result, max_result, multiplier, | 1059 | 408 | params)) { | 1060 | 408 | if (set_nullable) { | 1061 | 408 | null_map_data[i] = 1; | 1062 | 408 | } else { | 1063 | 408 | return params.status; | 1064 | 408 | } | 1065 | 408 | } | 1066 | 408 | } | 1067 | 408 | return Status::OK(); | 1068 | 408 | }, | 1069 | 408 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1070 | 408 | if (narrow_integral) { | 1071 | 112 | block.get_by_position(result).column = | 1072 | 112 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1073 | 296 | } else { | 1074 | 296 | block.get_by_position(result).column = std::move(col_to); | 1075 | 296 | } | 1076 | 408 | return Status::OK(); | 1077 | 408 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEENS2_ILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 980 | 120 | const NullMap::value_type* null_map = nullptr) const override { | 981 | 120 | using FromFieldType = typename FromDataType::FieldType; | 982 | 120 | using ToFieldType = typename ToDataType::FieldType; | 983 | 120 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 984 | 120 | const auto* col_from = | 985 | 120 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 986 | 120 | if (!col_from) { | 987 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 988 | 0 | named_from.column->get_name()); | 989 | 0 | } | 990 | | | 991 | 120 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 992 | 120 | UInt32 from_precision = from_decimal_type.get_precision(); | 993 | 120 | UInt32 from_scale = from_decimal_type.get_scale(); | 994 | | | 995 | 120 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 996 | 120 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 997 | 120 | UInt32 to_precision = to_decimal_type.get_precision(); | 998 | 120 | ToDataType::check_type_precision(to_precision); | 999 | 120 | UInt32 to_scale = to_decimal_type.get_scale(); | 1000 | 120 | ToDataType::check_type_scale(to_scale); | 1001 | | | 1002 | 120 | auto from_max_int_digit_count = from_precision - from_scale; | 1003 | 120 | auto to_max_int_digit_count = to_precision - to_scale; | 1004 | 120 | bool narrow_integral = | 1005 | 120 | (to_max_int_digit_count < from_max_int_digit_count) || | 1006 | 120 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1007 | | // only in non-strict mode and may overflow, we set nullable | 1008 | 120 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1009 | | | 1010 | 120 | size_t size = col_from->size(); | 1011 | 120 | ColumnUInt8::MutablePtr col_null_map_to; | 1012 | 120 | NullMap::value_type* null_map_data = nullptr; | 1013 | 120 | if (narrow_integral) { | 1014 | 120 | col_null_map_to = ColumnUInt8::create(size, 0); | 1015 | 120 | null_map_data = col_null_map_to->get_data().data(); | 1016 | 120 | } | 1017 | 120 | CastParameters params; | 1018 | 120 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1019 | 120 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1020 | 120 | const auto& vec_from = col_from->get_data(); | 1021 | 120 | const auto* vec_from_data = vec_from.data(); | 1022 | 120 | auto& vec_to = col_to->get_data(); | 1023 | 120 | auto* vec_to_data = vec_to.data(); | 1024 | | | 1025 | 120 | using MaxFieldType = | 1026 | 120 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1027 | 120 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1028 | 120 | std::is_same_v<FromFieldType, Decimal128V3>), | 1029 | 120 | Decimal128V3, | 1030 | 120 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1031 | 120 | FromFieldType, ToFieldType>>; | 1032 | 120 | using MaxNativeType = typename MaxFieldType::NativeType; | 1033 | | | 1034 | 120 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1035 | 120 | bool multiply_may_overflow = false; | 1036 | 120 | if (to_scale > from_scale) { | 1037 | 120 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1038 | 120 | } | 1039 | | | 1040 | 120 | typename ToFieldType::NativeType max_result = | 1041 | 120 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1042 | 120 | typename ToFieldType::NativeType min_result = -max_result; | 1043 | | | 1044 | 120 | MaxNativeType multiplier {}; | 1045 | 120 | if (from_scale < to_scale) { | 1046 | 120 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1047 | 120 | from_scale); | 1048 | 120 | } else if (from_scale > to_scale) { | 1049 | 0 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1050 | 0 | to_scale); | 1051 | 0 | } | 1052 | 120 | RETURN_IF_ERROR(std::visit( | 1053 | 120 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1054 | 120 | for (size_t i = 0; i < size; i++) { | 1055 | 120 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1056 | 120 | multiply_may_overflow, narrow_integral>( | 1057 | 120 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1058 | 120 | to_precision, to_scale, min_result, max_result, multiplier, | 1059 | 120 | params)) { | 1060 | 120 | if (set_nullable) { | 1061 | 120 | null_map_data[i] = 1; | 1062 | 120 | } else { | 1063 | 120 | return params.status; | 1064 | 120 | } | 1065 | 120 | } | 1066 | 120 | } | 1067 | 120 | return Status::OK(); | 1068 | 120 | }, | 1069 | 120 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1070 | 0 | if (narrow_integral) { | 1071 | 0 | block.get_by_position(result).column = | 1072 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1073 | 0 | } else { | 1074 | 0 | block.get_by_position(result).column = std::move(col_to); | 1075 | 0 | } | 1076 | 0 | return Status::OK(); | 1077 | 120 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEENS2_ILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 980 | 408 | const NullMap::value_type* null_map = nullptr) const override { | 981 | 408 | using FromFieldType = typename FromDataType::FieldType; | 982 | 408 | using ToFieldType = typename ToDataType::FieldType; | 983 | 408 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 984 | 408 | const auto* col_from = | 985 | 408 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 986 | 408 | if (!col_from) { | 987 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 988 | 0 | named_from.column->get_name()); | 989 | 0 | } | 990 | | | 991 | 408 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 992 | 408 | UInt32 from_precision = from_decimal_type.get_precision(); | 993 | 408 | UInt32 from_scale = from_decimal_type.get_scale(); | 994 | | | 995 | 408 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 996 | 408 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 997 | 408 | UInt32 to_precision = to_decimal_type.get_precision(); | 998 | 408 | ToDataType::check_type_precision(to_precision); | 999 | 408 | UInt32 to_scale = to_decimal_type.get_scale(); | 1000 | 408 | ToDataType::check_type_scale(to_scale); | 1001 | | | 1002 | 408 | auto from_max_int_digit_count = from_precision - from_scale; | 1003 | 408 | auto to_max_int_digit_count = to_precision - to_scale; | 1004 | 408 | bool narrow_integral = | 1005 | 408 | (to_max_int_digit_count < from_max_int_digit_count) || | 1006 | 408 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1007 | | // only in non-strict mode and may overflow, we set nullable | 1008 | 408 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1009 | | | 1010 | 408 | size_t size = col_from->size(); | 1011 | 408 | ColumnUInt8::MutablePtr col_null_map_to; | 1012 | 408 | NullMap::value_type* null_map_data = nullptr; | 1013 | 408 | if (narrow_integral) { | 1014 | 112 | col_null_map_to = ColumnUInt8::create(size, 0); | 1015 | 112 | null_map_data = col_null_map_to->get_data().data(); | 1016 | 112 | } | 1017 | 408 | CastParameters params; | 1018 | 408 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1019 | 408 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1020 | 408 | const auto& vec_from = col_from->get_data(); | 1021 | 408 | const auto* vec_from_data = vec_from.data(); | 1022 | 408 | auto& vec_to = col_to->get_data(); | 1023 | 408 | auto* vec_to_data = vec_to.data(); | 1024 | | | 1025 | 408 | using MaxFieldType = | 1026 | 408 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1027 | 408 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1028 | 408 | std::is_same_v<FromFieldType, Decimal128V3>), | 1029 | 408 | Decimal128V3, | 1030 | 408 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1031 | 408 | FromFieldType, ToFieldType>>; | 1032 | 408 | using MaxNativeType = typename MaxFieldType::NativeType; | 1033 | | | 1034 | 408 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1035 | 408 | bool multiply_may_overflow = false; | 1036 | 408 | if (to_scale > from_scale) { | 1037 | 198 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1038 | 198 | } | 1039 | | | 1040 | 408 | typename ToFieldType::NativeType max_result = | 1041 | 408 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1042 | 408 | typename ToFieldType::NativeType min_result = -max_result; | 1043 | | | 1044 | 408 | MaxNativeType multiplier {}; | 1045 | 408 | if (from_scale < to_scale) { | 1046 | 198 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1047 | 198 | from_scale); | 1048 | 210 | } else if (from_scale > to_scale) { | 1049 | 112 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1050 | 112 | to_scale); | 1051 | 112 | } | 1052 | 408 | RETURN_IF_ERROR(std::visit( | 1053 | 408 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1054 | 408 | for (size_t i = 0; i < size; i++) { | 1055 | 408 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1056 | 408 | multiply_may_overflow, narrow_integral>( | 1057 | 408 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1058 | 408 | to_precision, to_scale, min_result, max_result, multiplier, | 1059 | 408 | params)) { | 1060 | 408 | if (set_nullable) { | 1061 | 408 | null_map_data[i] = 1; | 1062 | 408 | } else { | 1063 | 408 | return params.status; | 1064 | 408 | } | 1065 | 408 | } | 1066 | 408 | } | 1067 | 408 | return Status::OK(); | 1068 | 408 | }, | 1069 | 408 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1070 | 408 | if (narrow_integral) { | 1071 | 112 | block.get_by_position(result).column = | 1072 | 112 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1073 | 296 | } else { | 1074 | 296 | block.get_by_position(result).column = std::move(col_to); | 1075 | 296 | } | 1076 | 408 | return Status::OK(); | 1077 | 408 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEES4_E12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 980 | 184 | const NullMap::value_type* null_map = nullptr) const override { | 981 | 184 | using FromFieldType = typename FromDataType::FieldType; | 982 | 184 | using ToFieldType = typename ToDataType::FieldType; | 983 | 184 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 984 | 184 | const auto* col_from = | 985 | 184 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 986 | 184 | if (!col_from) { | 987 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 988 | 0 | named_from.column->get_name()); | 989 | 0 | } | 990 | | | 991 | 184 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 992 | 184 | UInt32 from_precision = from_decimal_type.get_precision(); | 993 | 184 | UInt32 from_scale = from_decimal_type.get_scale(); | 994 | | | 995 | 184 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 996 | 184 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 997 | 184 | UInt32 to_precision = to_decimal_type.get_precision(); | 998 | 184 | ToDataType::check_type_precision(to_precision); | 999 | 184 | UInt32 to_scale = to_decimal_type.get_scale(); | 1000 | 184 | ToDataType::check_type_scale(to_scale); | 1001 | | | 1002 | 184 | auto from_max_int_digit_count = from_precision - from_scale; | 1003 | 184 | auto to_max_int_digit_count = to_precision - to_scale; | 1004 | 184 | bool narrow_integral = | 1005 | 184 | (to_max_int_digit_count < from_max_int_digit_count) || | 1006 | 184 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1007 | | // only in non-strict mode and may overflow, we set nullable | 1008 | 184 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1009 | | | 1010 | 184 | size_t size = col_from->size(); | 1011 | 184 | ColumnUInt8::MutablePtr col_null_map_to; | 1012 | 184 | NullMap::value_type* null_map_data = nullptr; | 1013 | 184 | if (narrow_integral) { | 1014 | 184 | col_null_map_to = ColumnUInt8::create(size, 0); | 1015 | 184 | null_map_data = col_null_map_to->get_data().data(); | 1016 | 184 | } | 1017 | 184 | CastParameters params; | 1018 | 184 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1019 | 184 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1020 | 184 | const auto& vec_from = col_from->get_data(); | 1021 | 184 | const auto* vec_from_data = vec_from.data(); | 1022 | 184 | auto& vec_to = col_to->get_data(); | 1023 | 184 | auto* vec_to_data = vec_to.data(); | 1024 | | | 1025 | 184 | using MaxFieldType = | 1026 | 184 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1027 | 184 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1028 | 184 | std::is_same_v<FromFieldType, Decimal128V3>), | 1029 | 184 | Decimal128V3, | 1030 | 184 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1031 | 184 | FromFieldType, ToFieldType>>; | 1032 | 184 | using MaxNativeType = typename MaxFieldType::NativeType; | 1033 | | | 1034 | 184 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1035 | 184 | bool multiply_may_overflow = false; | 1036 | 184 | if (to_scale > from_scale) { | 1037 | 132 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1038 | 132 | } | 1039 | | | 1040 | 184 | typename ToFieldType::NativeType max_result = | 1041 | 184 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1042 | 184 | typename ToFieldType::NativeType min_result = -max_result; | 1043 | | | 1044 | 184 | MaxNativeType multiplier {}; | 1045 | 184 | if (from_scale < to_scale) { | 1046 | 132 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1047 | 132 | from_scale); | 1048 | 132 | } else if (from_scale > to_scale) { | 1049 | 40 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1050 | 40 | to_scale); | 1051 | 40 | } | 1052 | 184 | RETURN_IF_ERROR(std::visit( | 1053 | 184 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1054 | 184 | for (size_t i = 0; i < size; i++) { | 1055 | 184 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1056 | 184 | multiply_may_overflow, narrow_integral>( | 1057 | 184 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1058 | 184 | to_precision, to_scale, min_result, max_result, multiplier, | 1059 | 184 | params)) { | 1060 | 184 | if (set_nullable) { | 1061 | 184 | null_map_data[i] = 1; | 1062 | 184 | } else { | 1063 | 184 | return params.status; | 1064 | 184 | } | 1065 | 184 | } | 1066 | 184 | } | 1067 | 184 | return Status::OK(); | 1068 | 184 | }, | 1069 | 184 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1070 | 0 | if (narrow_integral) { | 1071 | 0 | block.get_by_position(result).column = | 1072 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1073 | 0 | } else { | 1074 | 0 | block.get_by_position(result).column = std::move(col_to); | 1075 | 0 | } | 1076 | 0 | return Status::OK(); | 1077 | 184 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEES4_E12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 980 | 360 | const NullMap::value_type* null_map = nullptr) const override { | 981 | 360 | using FromFieldType = typename FromDataType::FieldType; | 982 | 360 | using ToFieldType = typename ToDataType::FieldType; | 983 | 360 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 984 | 360 | const auto* col_from = | 985 | 360 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 986 | 360 | if (!col_from) { | 987 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 988 | 0 | named_from.column->get_name()); | 989 | 0 | } | 990 | | | 991 | 360 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 992 | 360 | UInt32 from_precision = from_decimal_type.get_precision(); | 993 | 360 | UInt32 from_scale = from_decimal_type.get_scale(); | 994 | | | 995 | 360 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 996 | 360 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 997 | 360 | UInt32 to_precision = to_decimal_type.get_precision(); | 998 | 360 | ToDataType::check_type_precision(to_precision); | 999 | 360 | UInt32 to_scale = to_decimal_type.get_scale(); | 1000 | 360 | ToDataType::check_type_scale(to_scale); | 1001 | | | 1002 | 360 | auto from_max_int_digit_count = from_precision - from_scale; | 1003 | 360 | auto to_max_int_digit_count = to_precision - to_scale; | 1004 | 360 | bool narrow_integral = | 1005 | 360 | (to_max_int_digit_count < from_max_int_digit_count) || | 1006 | 360 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1007 | | // only in non-strict mode and may overflow, we set nullable | 1008 | 360 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1009 | | | 1010 | 360 | size_t size = col_from->size(); | 1011 | 360 | ColumnUInt8::MutablePtr col_null_map_to; | 1012 | 360 | NullMap::value_type* null_map_data = nullptr; | 1013 | 360 | if (narrow_integral) { | 1014 | 208 | col_null_map_to = ColumnUInt8::create(size, 0); | 1015 | 208 | null_map_data = col_null_map_to->get_data().data(); | 1016 | 208 | } | 1017 | 360 | CastParameters params; | 1018 | 360 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1019 | 360 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1020 | 360 | const auto& vec_from = col_from->get_data(); | 1021 | 360 | const auto* vec_from_data = vec_from.data(); | 1022 | 360 | auto& vec_to = col_to->get_data(); | 1023 | 360 | auto* vec_to_data = vec_to.data(); | 1024 | | | 1025 | 360 | using MaxFieldType = | 1026 | 360 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1027 | 360 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1028 | 360 | std::is_same_v<FromFieldType, Decimal128V3>), | 1029 | 360 | Decimal128V3, | 1030 | 360 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1031 | 360 | FromFieldType, ToFieldType>>; | 1032 | 360 | using MaxNativeType = typename MaxFieldType::NativeType; | 1033 | | | 1034 | 360 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1035 | 360 | bool multiply_may_overflow = false; | 1036 | 360 | if (to_scale > from_scale) { | 1037 | 172 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1038 | 172 | } | 1039 | | | 1040 | 360 | typename ToFieldType::NativeType max_result = | 1041 | 360 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1042 | 360 | typename ToFieldType::NativeType min_result = -max_result; | 1043 | | | 1044 | 360 | MaxNativeType multiplier {}; | 1045 | 360 | if (from_scale < to_scale) { | 1046 | 172 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1047 | 172 | from_scale); | 1048 | 188 | } else if (from_scale > to_scale) { | 1049 | 136 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1050 | 136 | to_scale); | 1051 | 136 | } | 1052 | 360 | RETURN_IF_ERROR(std::visit( | 1053 | 360 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1054 | 360 | for (size_t i = 0; i < size; i++) { | 1055 | 360 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1056 | 360 | multiply_may_overflow, narrow_integral>( | 1057 | 360 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1058 | 360 | to_precision, to_scale, min_result, max_result, multiplier, | 1059 | 360 | params)) { | 1060 | 360 | if (set_nullable) { | 1061 | 360 | null_map_data[i] = 1; | 1062 | 360 | } else { | 1063 | 360 | return params.status; | 1064 | 360 | } | 1065 | 360 | } | 1066 | 360 | } | 1067 | 360 | return Status::OK(); | 1068 | 360 | }, | 1069 | 360 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1070 | 360 | if (narrow_integral) { | 1071 | 208 | block.get_by_position(result).column = | 1072 | 208 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1073 | 208 | } else { | 1074 | 152 | block.get_by_position(result).column = std::move(col_to); | 1075 | 152 | } | 1076 | 360 | return Status::OK(); | 1077 | 360 | } |
|
1078 | | }; |
1079 | | |
1080 | | } // namespace doris |