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 | | |
29 | | namespace doris { |
30 | | |
31 | | #define DECIMAL_CONVERT_OVERFLOW_ERROR(value, from_type_name, precision, scale) \ |
32 | 4.28k | Status(ErrorCode::ARITHMETIC_OVERFLOW_ERRROR, \ |
33 | 4.28k | fmt::format( \ |
34 | 4.28k | "Arithmetic overflow when converting value {} from type {} to decimal({}, {})", \ |
35 | 4.28k | value, from_type_name, precision, scale)) |
36 | | |
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 | StringParser::ParseResult result = StringParser::PARSE_SUCCESS; |
44 | 28 | to = DecimalV2Value(StringParser::string_to_decimal<TYPE_DECIMALV2>( |
45 | 28 | from.data, (int)from.size, DecimalV2Value::PRECISION, DecimalV2Value::SCALE, |
46 | 28 | &result)); |
47 | 28 | return result == StringParser::PARSE_SUCCESS; |
48 | 28 | } |
49 | | |
50 | 59.5k | if constexpr (IsDecimal32<ToCppT>) { |
51 | 59.5k | StringParser::ParseResult result = StringParser::PARSE_SUCCESS; |
52 | 59.5k | to.value = StringParser::string_to_decimal<TYPE_DECIMAL32>(from.data, (int)from.size, |
53 | 59.5k | precision, scale, &result); |
54 | 59.5k | return result == StringParser::PARSE_SUCCESS; |
55 | 59.5k | } |
56 | | |
57 | 53.8k | if constexpr (IsDecimal64<ToCppT>) { |
58 | 53.8k | StringParser::ParseResult result = StringParser::PARSE_SUCCESS; |
59 | 53.8k | to.value = StringParser::string_to_decimal<TYPE_DECIMAL64>(from.data, (int)from.size, |
60 | 53.8k | precision, scale, &result); |
61 | 53.8k | return result == StringParser::PARSE_SUCCESS; |
62 | 53.8k | } |
63 | | |
64 | 53.8k | if constexpr (IsDecimal128V3<ToCppT>) { |
65 | 53.8k | StringParser::ParseResult result = StringParser::PARSE_SUCCESS; |
66 | 53.8k | to.value = StringParser::string_to_decimal<TYPE_DECIMAL128I>(from.data, (int)from.size, |
67 | 53.8k | precision, scale, &result); |
68 | 53.8k | return result == StringParser::PARSE_SUCCESS; |
69 | 53.8k | } |
70 | | |
71 | 53.7k | if constexpr (IsDecimal256<ToCppT>) { |
72 | 53.7k | StringParser::ParseResult result = StringParser::PARSE_SUCCESS; |
73 | 53.7k | to.value = StringParser::string_to_decimal<TYPE_DECIMAL256>(from.data, (int)from.size, |
74 | 53.7k | precision, scale, &result); |
75 | 53.7k | return result == StringParser::PARSE_SUCCESS; |
76 | 53.7k | } |
77 | 221k | } _ZN5doris13CastToDecimal11from_stringINS_7DecimalIiEEQ15IsDecimalNumberIT_EEEbRKNS_9StringRefERS4_jjRNS_14CastParametersE Line | Count | Source | 41 | 59.5k | UInt32 scale, CastParameters& params) { | 42 | | if constexpr (IsDecimalV2<ToCppT>) { | 43 | | StringParser::ParseResult result = StringParser::PARSE_SUCCESS; | 44 | | to = DecimalV2Value(StringParser::string_to_decimal<TYPE_DECIMALV2>( | 45 | | from.data, (int)from.size, DecimalV2Value::PRECISION, DecimalV2Value::SCALE, | 46 | | &result)); | 47 | | return result == StringParser::PARSE_SUCCESS; | 48 | | } | 49 | | | 50 | 59.5k | if constexpr (IsDecimal32<ToCppT>) { | 51 | 59.5k | StringParser::ParseResult result = StringParser::PARSE_SUCCESS; | 52 | 59.5k | to.value = StringParser::string_to_decimal<TYPE_DECIMAL32>(from.data, (int)from.size, | 53 | 59.5k | precision, scale, &result); | 54 | 59.5k | return result == StringParser::PARSE_SUCCESS; | 55 | 59.5k | } | 56 | | | 57 | | if constexpr (IsDecimal64<ToCppT>) { | 58 | | StringParser::ParseResult result = StringParser::PARSE_SUCCESS; | 59 | | to.value = StringParser::string_to_decimal<TYPE_DECIMAL64>(from.data, (int)from.size, | 60 | | precision, scale, &result); | 61 | | return result == StringParser::PARSE_SUCCESS; | 62 | | } | 63 | | | 64 | | if constexpr (IsDecimal128V3<ToCppT>) { | 65 | | StringParser::ParseResult result = StringParser::PARSE_SUCCESS; | 66 | | to.value = StringParser::string_to_decimal<TYPE_DECIMAL128I>(from.data, (int)from.size, | 67 | | precision, scale, &result); | 68 | | return result == StringParser::PARSE_SUCCESS; | 69 | | } | 70 | | | 71 | | if constexpr (IsDecimal256<ToCppT>) { | 72 | | StringParser::ParseResult result = StringParser::PARSE_SUCCESS; | 73 | | to.value = StringParser::string_to_decimal<TYPE_DECIMAL256>(from.data, (int)from.size, | 74 | | precision, scale, &result); | 75 | | return result == StringParser::PARSE_SUCCESS; | 76 | | } | 77 | 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 | | StringParser::ParseResult result = StringParser::PARSE_SUCCESS; | 44 | | to = DecimalV2Value(StringParser::string_to_decimal<TYPE_DECIMALV2>( | 45 | | from.data, (int)from.size, DecimalV2Value::PRECISION, DecimalV2Value::SCALE, | 46 | | &result)); | 47 | | return result == StringParser::PARSE_SUCCESS; | 48 | | } | 49 | | | 50 | | if constexpr (IsDecimal32<ToCppT>) { | 51 | | StringParser::ParseResult result = StringParser::PARSE_SUCCESS; | 52 | | to.value = StringParser::string_to_decimal<TYPE_DECIMAL32>(from.data, (int)from.size, | 53 | | precision, scale, &result); | 54 | | return result == StringParser::PARSE_SUCCESS; | 55 | | } | 56 | | | 57 | 53.8k | if constexpr (IsDecimal64<ToCppT>) { | 58 | 53.8k | StringParser::ParseResult result = StringParser::PARSE_SUCCESS; | 59 | 53.8k | to.value = StringParser::string_to_decimal<TYPE_DECIMAL64>(from.data, (int)from.size, | 60 | 53.8k | precision, scale, &result); | 61 | 53.8k | return result == StringParser::PARSE_SUCCESS; | 62 | 53.8k | } | 63 | | | 64 | | if constexpr (IsDecimal128V3<ToCppT>) { | 65 | | StringParser::ParseResult result = StringParser::PARSE_SUCCESS; | 66 | | to.value = StringParser::string_to_decimal<TYPE_DECIMAL128I>(from.data, (int)from.size, | 67 | | precision, scale, &result); | 68 | | return result == StringParser::PARSE_SUCCESS; | 69 | | } | 70 | | | 71 | | if constexpr (IsDecimal256<ToCppT>) { | 72 | | StringParser::ParseResult result = StringParser::PARSE_SUCCESS; | 73 | | to.value = StringParser::string_to_decimal<TYPE_DECIMAL256>(from.data, (int)from.size, | 74 | | precision, scale, &result); | 75 | | return result == StringParser::PARSE_SUCCESS; | 76 | | } | 77 | 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 | | StringParser::ParseResult result = StringParser::PARSE_SUCCESS; | 44 | | to = DecimalV2Value(StringParser::string_to_decimal<TYPE_DECIMALV2>( | 45 | | from.data, (int)from.size, DecimalV2Value::PRECISION, DecimalV2Value::SCALE, | 46 | | &result)); | 47 | | return result == StringParser::PARSE_SUCCESS; | 48 | | } | 49 | | | 50 | | if constexpr (IsDecimal32<ToCppT>) { | 51 | | StringParser::ParseResult result = StringParser::PARSE_SUCCESS; | 52 | | to.value = StringParser::string_to_decimal<TYPE_DECIMAL32>(from.data, (int)from.size, | 53 | | precision, scale, &result); | 54 | | return result == StringParser::PARSE_SUCCESS; | 55 | | } | 56 | | | 57 | | if constexpr (IsDecimal64<ToCppT>) { | 58 | | StringParser::ParseResult result = StringParser::PARSE_SUCCESS; | 59 | | to.value = StringParser::string_to_decimal<TYPE_DECIMAL64>(from.data, (int)from.size, | 60 | | precision, scale, &result); | 61 | | return result == StringParser::PARSE_SUCCESS; | 62 | | } | 63 | | | 64 | 53.8k | if constexpr (IsDecimal128V3<ToCppT>) { | 65 | 53.8k | StringParser::ParseResult result = StringParser::PARSE_SUCCESS; | 66 | 53.8k | to.value = StringParser::string_to_decimal<TYPE_DECIMAL128I>(from.data, (int)from.size, | 67 | 53.8k | precision, scale, &result); | 68 | 53.8k | return result == StringParser::PARSE_SUCCESS; | 69 | 53.8k | } | 70 | | | 71 | | if constexpr (IsDecimal256<ToCppT>) { | 72 | | StringParser::ParseResult result = StringParser::PARSE_SUCCESS; | 73 | | to.value = StringParser::string_to_decimal<TYPE_DECIMAL256>(from.data, (int)from.size, | 74 | | precision, scale, &result); | 75 | | return result == StringParser::PARSE_SUCCESS; | 76 | | } | 77 | 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 | StringParser::ParseResult result = StringParser::PARSE_SUCCESS; | 44 | 28 | to = DecimalV2Value(StringParser::string_to_decimal<TYPE_DECIMALV2>( | 45 | 28 | from.data, (int)from.size, DecimalV2Value::PRECISION, DecimalV2Value::SCALE, | 46 | 28 | &result)); | 47 | 28 | return result == StringParser::PARSE_SUCCESS; | 48 | 28 | } | 49 | | | 50 | | if constexpr (IsDecimal32<ToCppT>) { | 51 | | StringParser::ParseResult result = StringParser::PARSE_SUCCESS; | 52 | | to.value = StringParser::string_to_decimal<TYPE_DECIMAL32>(from.data, (int)from.size, | 53 | | precision, scale, &result); | 54 | | return result == StringParser::PARSE_SUCCESS; | 55 | | } | 56 | | | 57 | | if constexpr (IsDecimal64<ToCppT>) { | 58 | | StringParser::ParseResult result = StringParser::PARSE_SUCCESS; | 59 | | to.value = StringParser::string_to_decimal<TYPE_DECIMAL64>(from.data, (int)from.size, | 60 | | precision, scale, &result); | 61 | | return result == StringParser::PARSE_SUCCESS; | 62 | | } | 63 | | | 64 | | if constexpr (IsDecimal128V3<ToCppT>) { | 65 | | StringParser::ParseResult result = StringParser::PARSE_SUCCESS; | 66 | | to.value = StringParser::string_to_decimal<TYPE_DECIMAL128I>(from.data, (int)from.size, | 67 | | precision, scale, &result); | 68 | | return result == StringParser::PARSE_SUCCESS; | 69 | | } | 70 | | | 71 | | if constexpr (IsDecimal256<ToCppT>) { | 72 | | StringParser::ParseResult result = StringParser::PARSE_SUCCESS; | 73 | | to.value = StringParser::string_to_decimal<TYPE_DECIMAL256>(from.data, (int)from.size, | 74 | | precision, scale, &result); | 75 | | return result == StringParser::PARSE_SUCCESS; | 76 | | } | 77 | 28 | } |
_ZN5doris13CastToDecimal11from_stringINS_7DecimalIN4wide7integerILm256EiEEEEQ15IsDecimalNumberIT_EEEbRKNS_9StringRefERS7_jjRNS_14CastParametersE Line | Count | Source | 41 | 53.7k | UInt32 scale, CastParameters& params) { | 42 | | if constexpr (IsDecimalV2<ToCppT>) { | 43 | | StringParser::ParseResult result = StringParser::PARSE_SUCCESS; | 44 | | to = DecimalV2Value(StringParser::string_to_decimal<TYPE_DECIMALV2>( | 45 | | from.data, (int)from.size, DecimalV2Value::PRECISION, DecimalV2Value::SCALE, | 46 | | &result)); | 47 | | return result == StringParser::PARSE_SUCCESS; | 48 | | } | 49 | | | 50 | | if constexpr (IsDecimal32<ToCppT>) { | 51 | | StringParser::ParseResult result = StringParser::PARSE_SUCCESS; | 52 | | to.value = StringParser::string_to_decimal<TYPE_DECIMAL32>(from.data, (int)from.size, | 53 | | precision, scale, &result); | 54 | | return result == StringParser::PARSE_SUCCESS; | 55 | | } | 56 | | | 57 | | if constexpr (IsDecimal64<ToCppT>) { | 58 | | StringParser::ParseResult result = StringParser::PARSE_SUCCESS; | 59 | | to.value = StringParser::string_to_decimal<TYPE_DECIMAL64>(from.data, (int)from.size, | 60 | | precision, scale, &result); | 61 | | return result == StringParser::PARSE_SUCCESS; | 62 | | } | 63 | | | 64 | | if constexpr (IsDecimal128V3<ToCppT>) { | 65 | | StringParser::ParseResult result = StringParser::PARSE_SUCCESS; | 66 | | to.value = StringParser::string_to_decimal<TYPE_DECIMAL128I>(from.data, (int)from.size, | 67 | | precision, scale, &result); | 68 | | return result == StringParser::PARSE_SUCCESS; | 69 | | } | 70 | | | 71 | 53.7k | if constexpr (IsDecimal256<ToCppT>) { | 72 | 53.7k | StringParser::ParseResult result = StringParser::PARSE_SUCCESS; | 73 | 53.7k | to.value = StringParser::string_to_decimal<TYPE_DECIMAL256>(from.data, (int)from.size, | 74 | 53.7k | precision, scale, &result); | 75 | 53.7k | return result == StringParser::PARSE_SUCCESS; | 76 | 53.7k | } | 77 | 53.7k | } |
|
78 | | |
79 | | // cast int to decimal |
80 | | template <typename FromCppT, typename ToCppT, |
81 | | typename MaxNativeType = |
82 | | std::conditional_t<(sizeof(FromCppT) > sizeof(typename ToCppT::NativeType)), |
83 | | FromCppT, typename ToCppT::NativeType>> |
84 | | requires(IsDecimalNumber<ToCppT> && |
85 | | (IsCppTypeInt<FromCppT> || std::is_same_v<FromCppT, UInt8>)) |
86 | | static inline bool from_int(const FromCppT& from, ToCppT& to, UInt32 to_precision, |
87 | 14 | UInt32 to_scale, CastParameters& params) { |
88 | 14 | MaxNativeType scale_multiplier = |
89 | 14 | DataTypeDecimal<ToCppT::PType>::get_scale_multiplier(to_scale); |
90 | 14 | typename ToCppT::NativeType max_result = |
91 | 14 | DataTypeDecimal<ToCppT::PType>::get_max_digits_number(to_precision); |
92 | 14 | typename ToCppT::NativeType min_result = -max_result; |
93 | | |
94 | 14 | UInt32 from_precision = NumberTraits::max_ascii_len<FromCppT>(); |
95 | 14 | constexpr UInt32 from_scale = 0; |
96 | 14 | constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToCppT::NativeType>(); |
97 | | |
98 | 14 | auto from_max_int_digit_count = from_precision - from_scale; |
99 | 14 | auto to_max_int_digit_count = to_precision - to_scale; |
100 | 14 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); |
101 | 14 | bool multiply_may_overflow = false; |
102 | 14 | if (to_scale > from_scale) { |
103 | 14 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; |
104 | 14 | } |
105 | 14 | return std::visit( |
106 | 14 | [&](auto multiply_may_overflow, auto narrow_integral) { |
107 | 14 | return _from_int<FromCppT, ToCppT, multiply_may_overflow, narrow_integral>( |
108 | 14 | from, to, to_precision, to_scale, scale_multiplier, min_result, |
109 | 14 | max_result, params); |
110 | 14 | }, _ZZN5doris13CastToDecimal8from_intIhNS_7DecimalIiEEiQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRNS_14CastParametersEENKUlS5_S4_E_clISt17integral_constantIbLb0EESE_EEDaS5_S4_ Line | Count | Source | 106 | 4 | [&](auto multiply_may_overflow, auto narrow_integral) { | 107 | 4 | return _from_int<FromCppT, ToCppT, multiply_may_overflow, narrow_integral>( | 108 | 4 | from, to, to_precision, to_scale, scale_multiplier, min_result, | 109 | 4 | max_result, params); | 110 | 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 | 106 | 2 | [&](auto multiply_may_overflow, auto narrow_integral) { | 107 | 2 | return _from_int<FromCppT, ToCppT, multiply_may_overflow, narrow_integral>( | 108 | 2 | from, to, to_precision, to_scale, scale_multiplier, min_result, | 109 | 2 | max_result, params); | 110 | 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 | 106 | 2 | [&](auto multiply_may_overflow, auto narrow_integral) { | 107 | 2 | return _from_int<FromCppT, ToCppT, multiply_may_overflow, narrow_integral>( | 108 | 2 | from, to, to_precision, to_scale, scale_multiplier, min_result, | 109 | 2 | max_result, params); | 110 | 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 | 106 | 2 | [&](auto multiply_may_overflow, auto narrow_integral) { | 107 | 2 | return _from_int<FromCppT, ToCppT, multiply_may_overflow, narrow_integral>( | 108 | 2 | from, to, to_precision, to_scale, scale_multiplier, min_result, | 109 | 2 | max_result, params); | 110 | 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 | 106 | 2 | [&](auto multiply_may_overflow, auto narrow_integral) { | 107 | 2 | return _from_int<FromCppT, ToCppT, multiply_may_overflow, narrow_integral>( | 108 | 2 | from, to, to_precision, to_scale, scale_multiplier, min_result, | 109 | 2 | max_result, params); | 110 | 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 | 106 | 2 | [&](auto multiply_may_overflow, auto narrow_integral) { | 107 | 2 | return _from_int<FromCppT, ToCppT, multiply_may_overflow, narrow_integral>( | 108 | 2 | from, to, to_precision, to_scale, scale_multiplier, min_result, | 109 | 2 | max_result, params); | 110 | 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_ |
111 | 14 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral)); |
112 | 14 | } _ZN5doris13CastToDecimal8from_intIhNS_7DecimalIiEEiQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRNS_14CastParametersE Line | Count | Source | 87 | 4 | UInt32 to_scale, CastParameters& params) { | 88 | 4 | MaxNativeType scale_multiplier = | 89 | 4 | DataTypeDecimal<ToCppT::PType>::get_scale_multiplier(to_scale); | 90 | 4 | typename ToCppT::NativeType max_result = | 91 | 4 | DataTypeDecimal<ToCppT::PType>::get_max_digits_number(to_precision); | 92 | 4 | typename ToCppT::NativeType min_result = -max_result; | 93 | | | 94 | 4 | UInt32 from_precision = NumberTraits::max_ascii_len<FromCppT>(); | 95 | 4 | constexpr UInt32 from_scale = 0; | 96 | 4 | constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToCppT::NativeType>(); | 97 | | | 98 | 4 | auto from_max_int_digit_count = from_precision - from_scale; | 99 | 4 | auto to_max_int_digit_count = to_precision - to_scale; | 100 | 4 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 101 | 4 | bool multiply_may_overflow = false; | 102 | 4 | if (to_scale > from_scale) { | 103 | 4 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 104 | 4 | } | 105 | 4 | return std::visit( | 106 | 4 | [&](auto multiply_may_overflow, auto narrow_integral) { | 107 | 4 | return _from_int<FromCppT, ToCppT, multiply_may_overflow, narrow_integral>( | 108 | 4 | from, to, to_precision, to_scale, scale_multiplier, min_result, | 109 | 4 | max_result, params); | 110 | 4 | }, | 111 | 4 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral)); | 112 | 4 | } |
_ZN5doris13CastToDecimal8from_intIaNS_7DecimalIiEEiQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRNS_14CastParametersE Line | Count | Source | 87 | 2 | UInt32 to_scale, CastParameters& params) { | 88 | 2 | MaxNativeType scale_multiplier = | 89 | 2 | DataTypeDecimal<ToCppT::PType>::get_scale_multiplier(to_scale); | 90 | 2 | typename ToCppT::NativeType max_result = | 91 | 2 | DataTypeDecimal<ToCppT::PType>::get_max_digits_number(to_precision); | 92 | 2 | typename ToCppT::NativeType min_result = -max_result; | 93 | | | 94 | 2 | UInt32 from_precision = NumberTraits::max_ascii_len<FromCppT>(); | 95 | 2 | constexpr UInt32 from_scale = 0; | 96 | 2 | constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToCppT::NativeType>(); | 97 | | | 98 | 2 | auto from_max_int_digit_count = from_precision - from_scale; | 99 | 2 | auto to_max_int_digit_count = to_precision - to_scale; | 100 | 2 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 101 | 2 | bool multiply_may_overflow = false; | 102 | 2 | if (to_scale > from_scale) { | 103 | 2 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 104 | 2 | } | 105 | 2 | return std::visit( | 106 | 2 | [&](auto multiply_may_overflow, auto narrow_integral) { | 107 | 2 | return _from_int<FromCppT, ToCppT, multiply_may_overflow, narrow_integral>( | 108 | 2 | from, to, to_precision, to_scale, scale_multiplier, min_result, | 109 | 2 | max_result, params); | 110 | 2 | }, | 111 | 2 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral)); | 112 | 2 | } |
_ZN5doris13CastToDecimal8from_intIsNS_7DecimalIiEEiQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRNS_14CastParametersE Line | Count | Source | 87 | 2 | UInt32 to_scale, CastParameters& params) { | 88 | 2 | MaxNativeType scale_multiplier = | 89 | 2 | DataTypeDecimal<ToCppT::PType>::get_scale_multiplier(to_scale); | 90 | 2 | typename ToCppT::NativeType max_result = | 91 | 2 | DataTypeDecimal<ToCppT::PType>::get_max_digits_number(to_precision); | 92 | 2 | typename ToCppT::NativeType min_result = -max_result; | 93 | | | 94 | 2 | UInt32 from_precision = NumberTraits::max_ascii_len<FromCppT>(); | 95 | 2 | constexpr UInt32 from_scale = 0; | 96 | 2 | constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToCppT::NativeType>(); | 97 | | | 98 | 2 | auto from_max_int_digit_count = from_precision - from_scale; | 99 | 2 | auto to_max_int_digit_count = to_precision - to_scale; | 100 | 2 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 101 | 2 | bool multiply_may_overflow = false; | 102 | 2 | if (to_scale > from_scale) { | 103 | 2 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 104 | 2 | } | 105 | 2 | return std::visit( | 106 | 2 | [&](auto multiply_may_overflow, auto narrow_integral) { | 107 | 2 | return _from_int<FromCppT, ToCppT, multiply_may_overflow, narrow_integral>( | 108 | 2 | from, to, to_precision, to_scale, scale_multiplier, min_result, | 109 | 2 | max_result, params); | 110 | 2 | }, | 111 | 2 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral)); | 112 | 2 | } |
_ZN5doris13CastToDecimal8from_intIiNS_7DecimalIiEEiQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRNS_14CastParametersE Line | Count | Source | 87 | 2 | UInt32 to_scale, CastParameters& params) { | 88 | 2 | MaxNativeType scale_multiplier = | 89 | 2 | DataTypeDecimal<ToCppT::PType>::get_scale_multiplier(to_scale); | 90 | 2 | typename ToCppT::NativeType max_result = | 91 | 2 | DataTypeDecimal<ToCppT::PType>::get_max_digits_number(to_precision); | 92 | 2 | typename ToCppT::NativeType min_result = -max_result; | 93 | | | 94 | 2 | UInt32 from_precision = NumberTraits::max_ascii_len<FromCppT>(); | 95 | 2 | constexpr UInt32 from_scale = 0; | 96 | 2 | constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToCppT::NativeType>(); | 97 | | | 98 | 2 | auto from_max_int_digit_count = from_precision - from_scale; | 99 | 2 | auto to_max_int_digit_count = to_precision - to_scale; | 100 | 2 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 101 | 2 | bool multiply_may_overflow = false; | 102 | 2 | if (to_scale > from_scale) { | 103 | 2 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 104 | 2 | } | 105 | 2 | return std::visit( | 106 | 2 | [&](auto multiply_may_overflow, auto narrow_integral) { | 107 | 2 | return _from_int<FromCppT, ToCppT, multiply_may_overflow, narrow_integral>( | 108 | 2 | from, to, to_precision, to_scale, scale_multiplier, min_result, | 109 | 2 | max_result, params); | 110 | 2 | }, | 111 | 2 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral)); | 112 | 2 | } |
_ZN5doris13CastToDecimal8from_intIlNS_7DecimalIiEElQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRNS_14CastParametersE Line | Count | Source | 87 | 2 | UInt32 to_scale, CastParameters& params) { | 88 | 2 | MaxNativeType scale_multiplier = | 89 | 2 | DataTypeDecimal<ToCppT::PType>::get_scale_multiplier(to_scale); | 90 | 2 | typename ToCppT::NativeType max_result = | 91 | 2 | DataTypeDecimal<ToCppT::PType>::get_max_digits_number(to_precision); | 92 | 2 | typename ToCppT::NativeType min_result = -max_result; | 93 | | | 94 | 2 | UInt32 from_precision = NumberTraits::max_ascii_len<FromCppT>(); | 95 | 2 | constexpr UInt32 from_scale = 0; | 96 | 2 | constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToCppT::NativeType>(); | 97 | | | 98 | 2 | auto from_max_int_digit_count = from_precision - from_scale; | 99 | 2 | auto to_max_int_digit_count = to_precision - to_scale; | 100 | 2 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 101 | 2 | bool multiply_may_overflow = false; | 102 | 2 | if (to_scale > from_scale) { | 103 | 2 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 104 | 2 | } | 105 | 2 | return std::visit( | 106 | 2 | [&](auto multiply_may_overflow, auto narrow_integral) { | 107 | 2 | return _from_int<FromCppT, ToCppT, multiply_may_overflow, narrow_integral>( | 108 | 2 | from, to, to_precision, to_scale, scale_multiplier, min_result, | 109 | 2 | max_result, params); | 110 | 2 | }, | 111 | 2 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral)); | 112 | 2 | } |
_ZN5doris13CastToDecimal8from_intInNS_7DecimalIiEEnQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRNS_14CastParametersE Line | Count | Source | 87 | 2 | UInt32 to_scale, CastParameters& params) { | 88 | 2 | MaxNativeType scale_multiplier = | 89 | 2 | DataTypeDecimal<ToCppT::PType>::get_scale_multiplier(to_scale); | 90 | 2 | typename ToCppT::NativeType max_result = | 91 | 2 | DataTypeDecimal<ToCppT::PType>::get_max_digits_number(to_precision); | 92 | 2 | typename ToCppT::NativeType min_result = -max_result; | 93 | | | 94 | 2 | UInt32 from_precision = NumberTraits::max_ascii_len<FromCppT>(); | 95 | 2 | constexpr UInt32 from_scale = 0; | 96 | 2 | constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToCppT::NativeType>(); | 97 | | | 98 | 2 | auto from_max_int_digit_count = from_precision - from_scale; | 99 | 2 | auto to_max_int_digit_count = to_precision - to_scale; | 100 | 2 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 101 | 2 | bool multiply_may_overflow = false; | 102 | 2 | if (to_scale > from_scale) { | 103 | 2 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 104 | 2 | } | 105 | 2 | return std::visit( | 106 | 2 | [&](auto multiply_may_overflow, auto narrow_integral) { | 107 | 2 | return _from_int<FromCppT, ToCppT, multiply_may_overflow, narrow_integral>( | 108 | 2 | from, to, to_precision, to_scale, scale_multiplier, min_result, | 109 | 2 | max_result, params); | 110 | 2 | }, | 111 | 2 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral)); | 112 | 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 |
113 | | |
114 | | // cast bool to decimal |
115 | | template <typename FromCppT, typename ToCppT, |
116 | | typename MaxNativeType = |
117 | | std::conditional_t<(sizeof(FromCppT) > sizeof(typename ToCppT::NativeType)), |
118 | | FromCppT, typename ToCppT::NativeType>> |
119 | | requires(IsDecimalNumber<ToCppT> && std::is_same_v<FromCppT, UInt8>) |
120 | | static inline bool from_bool(const FromCppT& from, ToCppT& to, UInt32 to_precision, |
121 | 4 | UInt32 to_scale, CastParameters& params) { |
122 | 4 | return from_int<FromCppT, ToCppT, MaxNativeType>(from, to, to_precision, to_scale, params); |
123 | 4 | } _ZN5doris13CastToDecimal9from_boolIhNS_7DecimalIiEEiQaa15IsDecimalNumberIT0_Esr3stdE9is_same_vIT_hEEEbRKS5_RS4_jjRNS_14CastParametersE Line | Count | Source | 121 | 4 | UInt32 to_scale, CastParameters& params) { | 122 | 4 | return from_int<FromCppT, ToCppT, MaxNativeType>(from, to, to_precision, to_scale, params); | 123 | 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 |
124 | | |
125 | | template <typename FromCppT, typename ToCppT> |
126 | | requires(IsDecimalNumber<ToCppT> && IsCppTypeFloat<FromCppT>) |
127 | | static inline bool from_float(const FromCppT& from, ToCppT& to, UInt32 to_precision, |
128 | 4 | UInt32 to_scale, CastParameters& params) { |
129 | 4 | typename ToCppT::NativeType scale_multiplier = |
130 | 4 | DataTypeDecimal<ToCppT::PType>::get_scale_multiplier(to_scale); |
131 | 4 | typename ToCppT::NativeType max_result = |
132 | 4 | DataTypeDecimal<ToCppT::PType>::get_max_digits_number(to_precision); |
133 | 4 | typename ToCppT::NativeType min_result = -max_result; |
134 | | |
135 | 4 | return _from_float(from, to, to_precision, to_scale, scale_multiplier, min_result, |
136 | 4 | max_result, params); |
137 | 4 | } _ZN5doris13CastToDecimal10from_floatIdNS_7DecimalIiEEQaa15IsDecimalNumberIT0_E14IsCppTypeFloatIT_EEEbRKS5_RS4_jjRNS_14CastParametersE Line | Count | Source | 128 | 2 | UInt32 to_scale, CastParameters& params) { | 129 | 2 | typename ToCppT::NativeType scale_multiplier = | 130 | 2 | DataTypeDecimal<ToCppT::PType>::get_scale_multiplier(to_scale); | 131 | 2 | typename ToCppT::NativeType max_result = | 132 | 2 | DataTypeDecimal<ToCppT::PType>::get_max_digits_number(to_precision); | 133 | 2 | typename ToCppT::NativeType min_result = -max_result; | 134 | | | 135 | 2 | return _from_float(from, to, to_precision, to_scale, scale_multiplier, min_result, | 136 | 2 | max_result, params); | 137 | 2 | } |
_ZN5doris13CastToDecimal10from_floatIfNS_7DecimalIiEEQaa15IsDecimalNumberIT0_E14IsCppTypeFloatIT_EEEbRKS5_RS4_jjRNS_14CastParametersE Line | Count | Source | 128 | 2 | UInt32 to_scale, CastParameters& params) { | 129 | 2 | typename ToCppT::NativeType scale_multiplier = | 130 | 2 | DataTypeDecimal<ToCppT::PType>::get_scale_multiplier(to_scale); | 131 | 2 | typename ToCppT::NativeType max_result = | 132 | 2 | DataTypeDecimal<ToCppT::PType>::get_max_digits_number(to_precision); | 133 | 2 | typename ToCppT::NativeType min_result = -max_result; | 134 | | | 135 | 2 | return _from_float(from, to, to_precision, to_scale, scale_multiplier, min_result, | 136 | 2 | max_result, params); | 137 | 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 |
138 | | |
139 | | template <typename FromCppT, typename ToCppT, |
140 | | typename MaxFieldType = std::conditional_t< |
141 | | (sizeof(FromCppT) == sizeof(ToCppT)) && |
142 | | (std::is_same_v<ToCppT, Decimal128V3> || |
143 | | std::is_same_v<FromCppT, Decimal128V3>), |
144 | | Decimal128V3, |
145 | | std::conditional_t<(sizeof(FromCppT) > sizeof(ToCppT)), FromCppT, ToCppT>>> |
146 | | requires(IsDecimalNumber<ToCppT> && IsDecimalNumber<FromCppT>) |
147 | | static inline bool from_decimal(const FromCppT& from, const UInt32 from_precision, |
148 | | const UInt32 from_scale, ToCppT& to, UInt32 to_precision, |
149 | 10 | UInt32 to_scale, CastParameters& params) { |
150 | 10 | return _from_decimalv3<FromCppT, ToCppT, MaxFieldType>(from, from_precision, from_scale, to, |
151 | 10 | to_precision, to_scale, params); |
152 | 10 | } _ZN5doris13CastToDecimal12from_decimalINS_7DecimalIiEES3_S3_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRNS_14CastParametersE Line | Count | Source | 149 | 2 | UInt32 to_scale, CastParameters& params) { | 150 | 2 | return _from_decimalv3<FromCppT, ToCppT, MaxFieldType>(from, from_precision, from_scale, to, | 151 | 2 | to_precision, to_scale, params); | 152 | 2 | } |
_ZN5doris13CastToDecimal12from_decimalINS_7DecimalIlEENS2_IiEES3_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRNS_14CastParametersE Line | Count | Source | 149 | 2 | UInt32 to_scale, CastParameters& params) { | 150 | 2 | return _from_decimalv3<FromCppT, ToCppT, MaxFieldType>(from, from_precision, from_scale, to, | 151 | 2 | to_precision, to_scale, params); | 152 | 2 | } |
_ZN5doris13CastToDecimal12from_decimalINS_12Decimal128V3ENS_7DecimalIiEES2_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRNS_14CastParametersE Line | Count | Source | 149 | 2 | UInt32 to_scale, CastParameters& params) { | 150 | 2 | return _from_decimalv3<FromCppT, ToCppT, MaxFieldType>(from, from_precision, from_scale, to, | 151 | 2 | to_precision, to_scale, params); | 152 | 2 | } |
_ZN5doris13CastToDecimal12from_decimalINS_7DecimalIN4wide7integerILm256EiEEEENS2_IiEES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRNS_14CastParametersE Line | Count | Source | 149 | 2 | UInt32 to_scale, CastParameters& params) { | 150 | 2 | return _from_decimalv3<FromCppT, ToCppT, MaxFieldType>(from, from_precision, from_scale, to, | 151 | 2 | to_precision, to_scale, params); | 152 | 2 | } |
Unexecuted instantiation: _ZN5doris13CastToDecimal12from_decimalINS_7DecimalIiEENS2_IlEES4_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal12from_decimalINS_7DecimalIlEES3_S3_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal12from_decimalINS_12Decimal128V3ENS_7DecimalIlEES2_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal12from_decimalINS_7DecimalIN4wide7integerILm256EiEEEENS2_IlEES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal12from_decimalINS_7DecimalIiEENS_12Decimal128V3ES4_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal12from_decimalINS_7DecimalIlEENS_12Decimal128V3ES4_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRNS_14CastParametersE _ZN5doris13CastToDecimal12from_decimalINS_12Decimal128V3ES2_S2_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS4_jjRS3_jjRNS_14CastParametersE Line | Count | Source | 149 | 2 | UInt32 to_scale, CastParameters& params) { | 150 | 2 | return _from_decimalv3<FromCppT, ToCppT, MaxFieldType>(from, from_precision, from_scale, to, | 151 | 2 | to_precision, to_scale, params); | 152 | 2 | } |
Unexecuted instantiation: _ZN5doris13CastToDecimal12from_decimalINS_7DecimalIN4wide7integerILm256EiEEEENS_12Decimal128V3ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal12from_decimalINS_7DecimalIiEENS2_IN4wide7integerILm256EiEEEES7_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal12from_decimalINS_7DecimalIlEENS2_IN4wide7integerILm256EiEEEES7_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal12from_decimalINS_12Decimal128V3ENS_7DecimalIN4wide7integerILm256EiEEEES7_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal12from_decimalINS_7DecimalIN4wide7integerILm256EiEEEES6_S6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS8_jjRS7_jjRNS_14CastParametersE |
153 | | |
154 | | template <typename FromCppT, typename ToCppT, |
155 | | typename MaxFieldType = std::conditional_t< |
156 | | (sizeof(FromCppT) == sizeof(ToCppT)) && |
157 | | (std::is_same_v<ToCppT, Decimal128V3> || |
158 | | std::is_same_v<FromCppT, Decimal128V3>), |
159 | | Decimal128V3, |
160 | | std::conditional_t<(sizeof(FromCppT) > sizeof(ToCppT)), FromCppT, ToCppT>>> |
161 | | requires(IsDecimalNumber<ToCppT> && IsDecimalNumber<FromCppT>) |
162 | | static inline bool _from_decimalv3(const FromCppT& from, const UInt32 from_precision, |
163 | | const UInt32 from_scale, ToCppT& to, UInt32 to_precision, |
164 | 10 | UInt32 to_scale, CastParameters& params) { |
165 | 10 | using MaxNativeType = typename MaxFieldType::NativeType; |
166 | | |
167 | 10 | auto from_max_int_digit_count = from_precision - from_scale; |
168 | 10 | auto to_max_int_digit_count = to_precision - to_scale; |
169 | 10 | bool narrow_integral = |
170 | 10 | (to_max_int_digit_count < from_max_int_digit_count) || |
171 | 10 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); |
172 | | |
173 | 10 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToCppT::NativeType>(); |
174 | 10 | bool multiply_may_overflow = false; |
175 | 10 | if (to_scale > from_scale) { |
176 | 0 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; |
177 | 0 | } |
178 | | |
179 | 10 | typename ToCppT::NativeType max_result = |
180 | 10 | DataTypeDecimal<ToCppT::PType>::get_max_digits_number(to_precision); |
181 | 10 | typename ToCppT::NativeType min_result = -max_result; |
182 | | |
183 | 10 | MaxNativeType multiplier {}; |
184 | 10 | if (from_scale < to_scale) { |
185 | 0 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - |
186 | 0 | from_scale); |
187 | 10 | } else if (from_scale > to_scale) { |
188 | 6 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - |
189 | 6 | to_scale); |
190 | 6 | } |
191 | | |
192 | 10 | return std::visit( |
193 | 10 | [&](auto multiply_may_overflow, auto narrow_integral) { |
194 | 10 | return _from_decimal<FromCppT, ToCppT, multiply_may_overflow, narrow_integral>( |
195 | 10 | from, from_precision, from_scale, to, to_precision, to_scale, |
196 | 10 | min_result, max_result, multiplier, params); |
197 | 10 | }, _ZZN5doris13CastToDecimal15_from_decimalv3INS_7DecimalIiEES3_S3_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRNS_14CastParametersEENKUlS5_S4_E_clISt17integral_constantIbLb0EESE_EEDaS5_S4_ Line | Count | Source | 193 | 2 | [&](auto multiply_may_overflow, auto narrow_integral) { | 194 | 2 | return _from_decimal<FromCppT, ToCppT, multiply_may_overflow, narrow_integral>( | 195 | 2 | from, from_precision, from_scale, to, to_precision, to_scale, | 196 | 2 | min_result, max_result, multiplier, params); | 197 | 2 | }, |
Unexecuted instantiation: _ZZN5doris13CastToDecimal15_from_decimalv3INS_7DecimalIiEES3_S3_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRNS_14CastParametersEENKUlS5_S4_E_clISt17integral_constantIbLb0EESD_IbLb1EEEEDaS5_S4_ Unexecuted instantiation: _ZZN5doris13CastToDecimal15_from_decimalv3INS_7DecimalIiEES3_S3_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRNS_14CastParametersEENKUlS5_S4_E_clISt17integral_constantIbLb1EESD_IbLb0EEEEDaS5_S4_ Unexecuted instantiation: _ZZN5doris13CastToDecimal15_from_decimalv3INS_7DecimalIiEES3_S3_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRNS_14CastParametersEENKUlS5_S4_E_clISt17integral_constantIbLb1EESE_EEDaS5_S4_ Unexecuted instantiation: _ZZN5doris13CastToDecimal15_from_decimalv3INS_7DecimalIlEENS2_IiEES3_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRNS_14CastParametersEENKUlS6_S5_E_clISt17integral_constantIbLb0EESF_EEDaS6_S5_ _ZZN5doris13CastToDecimal15_from_decimalv3INS_7DecimalIlEENS2_IiEES3_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRNS_14CastParametersEENKUlS6_S5_E_clISt17integral_constantIbLb0EESE_IbLb1EEEEDaS6_S5_ Line | Count | Source | 193 | 2 | [&](auto multiply_may_overflow, auto narrow_integral) { | 194 | 2 | return _from_decimal<FromCppT, ToCppT, multiply_may_overflow, narrow_integral>( | 195 | 2 | from, from_precision, from_scale, to, to_precision, to_scale, | 196 | 2 | min_result, max_result, multiplier, params); | 197 | 2 | }, |
Unexecuted instantiation: _ZZN5doris13CastToDecimal15_from_decimalv3INS_7DecimalIlEENS2_IiEES3_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRNS_14CastParametersEENKUlS6_S5_E_clISt17integral_constantIbLb1EESE_IbLb0EEEEDaS6_S5_ Unexecuted instantiation: _ZZN5doris13CastToDecimal15_from_decimalv3INS_7DecimalIlEENS2_IiEES3_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRNS_14CastParametersEENKUlS6_S5_E_clISt17integral_constantIbLb1EESF_EEDaS6_S5_ Unexecuted instantiation: _ZZN5doris13CastToDecimal15_from_decimalv3INS_12Decimal128V3ENS_7DecimalIiEES2_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRNS_14CastParametersEENKUlS6_S5_E_clISt17integral_constantIbLb0EESF_EEDaS6_S5_ _ZZN5doris13CastToDecimal15_from_decimalv3INS_12Decimal128V3ENS_7DecimalIiEES2_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRNS_14CastParametersEENKUlS6_S5_E_clISt17integral_constantIbLb0EESE_IbLb1EEEEDaS6_S5_ Line | Count | Source | 193 | 2 | [&](auto multiply_may_overflow, auto narrow_integral) { | 194 | 2 | return _from_decimal<FromCppT, ToCppT, multiply_may_overflow, narrow_integral>( | 195 | 2 | from, from_precision, from_scale, to, to_precision, to_scale, | 196 | 2 | min_result, max_result, multiplier, params); | 197 | 2 | }, |
Unexecuted instantiation: _ZZN5doris13CastToDecimal15_from_decimalv3INS_12Decimal128V3ENS_7DecimalIiEES2_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRNS_14CastParametersEENKUlS6_S5_E_clISt17integral_constantIbLb1EESE_IbLb0EEEEDaS6_S5_ Unexecuted instantiation: _ZZN5doris13CastToDecimal15_from_decimalv3INS_12Decimal128V3ENS_7DecimalIiEES2_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRNS_14CastParametersEENKUlS6_S5_E_clISt17integral_constantIbLb1EESF_EEDaS6_S5_ Unexecuted instantiation: _ZZN5doris13CastToDecimal15_from_decimalv3INS_7DecimalIN4wide7integerILm256EiEEEENS2_IiEES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRNS_14CastParametersEENKUlS9_S8_E_clISt17integral_constantIbLb0EESI_EEDaS9_S8_ _ZZN5doris13CastToDecimal15_from_decimalv3INS_7DecimalIN4wide7integerILm256EiEEEENS2_IiEES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRNS_14CastParametersEENKUlS9_S8_E_clISt17integral_constantIbLb0EESH_IbLb1EEEEDaS9_S8_ Line | Count | Source | 193 | 2 | [&](auto multiply_may_overflow, auto narrow_integral) { | 194 | 2 | return _from_decimal<FromCppT, ToCppT, multiply_may_overflow, narrow_integral>( | 195 | 2 | from, from_precision, from_scale, to, to_precision, to_scale, | 196 | 2 | min_result, max_result, multiplier, params); | 197 | 2 | }, |
Unexecuted instantiation: _ZZN5doris13CastToDecimal15_from_decimalv3INS_7DecimalIN4wide7integerILm256EiEEEENS2_IiEES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRNS_14CastParametersEENKUlS9_S8_E_clISt17integral_constantIbLb1EESH_IbLb0EEEEDaS9_S8_ Unexecuted instantiation: _ZZN5doris13CastToDecimal15_from_decimalv3INS_7DecimalIN4wide7integerILm256EiEEEENS2_IiEES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRNS_14CastParametersEENKUlS9_S8_E_clISt17integral_constantIbLb1EESI_EEDaS9_S8_ Unexecuted instantiation: _ZZN5doris13CastToDecimal15_from_decimalv3INS_7DecimalIiEENS2_IlEES4_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRNS_14CastParametersEENKUlS6_S5_E_clISt17integral_constantIbLb0EESF_EEDaS6_S5_ Unexecuted instantiation: _ZZN5doris13CastToDecimal15_from_decimalv3INS_7DecimalIiEENS2_IlEES4_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRNS_14CastParametersEENKUlS6_S5_E_clISt17integral_constantIbLb0EESE_IbLb1EEEEDaS6_S5_ Unexecuted instantiation: _ZZN5doris13CastToDecimal15_from_decimalv3INS_7DecimalIiEENS2_IlEES4_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRNS_14CastParametersEENKUlS6_S5_E_clISt17integral_constantIbLb1EESE_IbLb0EEEEDaS6_S5_ Unexecuted instantiation: _ZZN5doris13CastToDecimal15_from_decimalv3INS_7DecimalIiEENS2_IlEES4_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRNS_14CastParametersEENKUlS6_S5_E_clISt17integral_constantIbLb1EESF_EEDaS6_S5_ Unexecuted instantiation: _ZZN5doris13CastToDecimal15_from_decimalv3INS_7DecimalIlEES3_S3_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRNS_14CastParametersEENKUlS5_S4_E_clISt17integral_constantIbLb0EESE_EEDaS5_S4_ Unexecuted instantiation: _ZZN5doris13CastToDecimal15_from_decimalv3INS_7DecimalIlEES3_S3_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRNS_14CastParametersEENKUlS5_S4_E_clISt17integral_constantIbLb0EESD_IbLb1EEEEDaS5_S4_ Unexecuted instantiation: _ZZN5doris13CastToDecimal15_from_decimalv3INS_7DecimalIlEES3_S3_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRNS_14CastParametersEENKUlS5_S4_E_clISt17integral_constantIbLb1EESD_IbLb0EEEEDaS5_S4_ Unexecuted instantiation: _ZZN5doris13CastToDecimal15_from_decimalv3INS_7DecimalIlEES3_S3_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRNS_14CastParametersEENKUlS5_S4_E_clISt17integral_constantIbLb1EESE_EEDaS5_S4_ Unexecuted instantiation: _ZZN5doris13CastToDecimal15_from_decimalv3INS_12Decimal128V3ENS_7DecimalIlEES2_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRNS_14CastParametersEENKUlS6_S5_E_clISt17integral_constantIbLb0EESF_EEDaS6_S5_ Unexecuted instantiation: _ZZN5doris13CastToDecimal15_from_decimalv3INS_12Decimal128V3ENS_7DecimalIlEES2_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRNS_14CastParametersEENKUlS6_S5_E_clISt17integral_constantIbLb0EESE_IbLb1EEEEDaS6_S5_ Unexecuted instantiation: _ZZN5doris13CastToDecimal15_from_decimalv3INS_12Decimal128V3ENS_7DecimalIlEES2_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRNS_14CastParametersEENKUlS6_S5_E_clISt17integral_constantIbLb1EESE_IbLb0EEEEDaS6_S5_ Unexecuted instantiation: _ZZN5doris13CastToDecimal15_from_decimalv3INS_12Decimal128V3ENS_7DecimalIlEES2_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRNS_14CastParametersEENKUlS6_S5_E_clISt17integral_constantIbLb1EESF_EEDaS6_S5_ Unexecuted instantiation: _ZZN5doris13CastToDecimal15_from_decimalv3INS_7DecimalIN4wide7integerILm256EiEEEENS2_IlEES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRNS_14CastParametersEENKUlS9_S8_E_clISt17integral_constantIbLb0EESI_EEDaS9_S8_ Unexecuted instantiation: _ZZN5doris13CastToDecimal15_from_decimalv3INS_7DecimalIN4wide7integerILm256EiEEEENS2_IlEES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRNS_14CastParametersEENKUlS9_S8_E_clISt17integral_constantIbLb0EESH_IbLb1EEEEDaS9_S8_ Unexecuted instantiation: _ZZN5doris13CastToDecimal15_from_decimalv3INS_7DecimalIN4wide7integerILm256EiEEEENS2_IlEES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRNS_14CastParametersEENKUlS9_S8_E_clISt17integral_constantIbLb1EESH_IbLb0EEEEDaS9_S8_ Unexecuted instantiation: _ZZN5doris13CastToDecimal15_from_decimalv3INS_7DecimalIN4wide7integerILm256EiEEEENS2_IlEES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRNS_14CastParametersEENKUlS9_S8_E_clISt17integral_constantIbLb1EESI_EEDaS9_S8_ Unexecuted instantiation: _ZZN5doris13CastToDecimal15_from_decimalv3INS_7DecimalIiEENS_12Decimal128V3ES4_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRNS_14CastParametersEENKUlS6_S5_E_clISt17integral_constantIbLb0EESF_EEDaS6_S5_ Unexecuted instantiation: _ZZN5doris13CastToDecimal15_from_decimalv3INS_7DecimalIiEENS_12Decimal128V3ES4_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRNS_14CastParametersEENKUlS6_S5_E_clISt17integral_constantIbLb0EESE_IbLb1EEEEDaS6_S5_ Unexecuted instantiation: _ZZN5doris13CastToDecimal15_from_decimalv3INS_7DecimalIiEENS_12Decimal128V3ES4_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRNS_14CastParametersEENKUlS6_S5_E_clISt17integral_constantIbLb1EESE_IbLb0EEEEDaS6_S5_ Unexecuted instantiation: _ZZN5doris13CastToDecimal15_from_decimalv3INS_7DecimalIiEENS_12Decimal128V3ES4_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRNS_14CastParametersEENKUlS6_S5_E_clISt17integral_constantIbLb1EESF_EEDaS6_S5_ Unexecuted instantiation: _ZZN5doris13CastToDecimal15_from_decimalv3INS_7DecimalIlEENS_12Decimal128V3ES4_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRNS_14CastParametersEENKUlS6_S5_E_clISt17integral_constantIbLb0EESF_EEDaS6_S5_ Unexecuted instantiation: _ZZN5doris13CastToDecimal15_from_decimalv3INS_7DecimalIlEENS_12Decimal128V3ES4_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRNS_14CastParametersEENKUlS6_S5_E_clISt17integral_constantIbLb0EESE_IbLb1EEEEDaS6_S5_ Unexecuted instantiation: _ZZN5doris13CastToDecimal15_from_decimalv3INS_7DecimalIlEENS_12Decimal128V3ES4_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRNS_14CastParametersEENKUlS6_S5_E_clISt17integral_constantIbLb1EESE_IbLb0EEEEDaS6_S5_ Unexecuted instantiation: _ZZN5doris13CastToDecimal15_from_decimalv3INS_7DecimalIlEENS_12Decimal128V3ES4_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRNS_14CastParametersEENKUlS6_S5_E_clISt17integral_constantIbLb1EESF_EEDaS6_S5_ _ZZN5doris13CastToDecimal15_from_decimalv3INS_12Decimal128V3ES2_S2_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS4_jjRS3_jjRNS_14CastParametersEENKUlS4_S3_E_clISt17integral_constantIbLb0EESD_EEDaS4_S3_ Line | Count | Source | 193 | 2 | [&](auto multiply_may_overflow, auto narrow_integral) { | 194 | 2 | return _from_decimal<FromCppT, ToCppT, multiply_may_overflow, narrow_integral>( | 195 | 2 | from, from_precision, from_scale, to, to_precision, to_scale, | 196 | 2 | min_result, max_result, multiplier, params); | 197 | 2 | }, |
Unexecuted instantiation: _ZZN5doris13CastToDecimal15_from_decimalv3INS_12Decimal128V3ES2_S2_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS4_jjRS3_jjRNS_14CastParametersEENKUlS4_S3_E_clISt17integral_constantIbLb0EESC_IbLb1EEEEDaS4_S3_ Unexecuted instantiation: _ZZN5doris13CastToDecimal15_from_decimalv3INS_12Decimal128V3ES2_S2_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS4_jjRS3_jjRNS_14CastParametersEENKUlS4_S3_E_clISt17integral_constantIbLb1EESC_IbLb0EEEEDaS4_S3_ Unexecuted instantiation: _ZZN5doris13CastToDecimal15_from_decimalv3INS_12Decimal128V3ES2_S2_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS4_jjRS3_jjRNS_14CastParametersEENKUlS4_S3_E_clISt17integral_constantIbLb1EESD_EEDaS4_S3_ Unexecuted instantiation: _ZZN5doris13CastToDecimal15_from_decimalv3INS_7DecimalIN4wide7integerILm256EiEEEENS_12Decimal128V3ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRNS_14CastParametersEENKUlS9_S8_E_clISt17integral_constantIbLb0EESI_EEDaS9_S8_ Unexecuted instantiation: _ZZN5doris13CastToDecimal15_from_decimalv3INS_7DecimalIN4wide7integerILm256EiEEEENS_12Decimal128V3ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRNS_14CastParametersEENKUlS9_S8_E_clISt17integral_constantIbLb0EESH_IbLb1EEEEDaS9_S8_ Unexecuted instantiation: _ZZN5doris13CastToDecimal15_from_decimalv3INS_7DecimalIN4wide7integerILm256EiEEEENS_12Decimal128V3ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRNS_14CastParametersEENKUlS9_S8_E_clISt17integral_constantIbLb1EESH_IbLb0EEEEDaS9_S8_ Unexecuted instantiation: _ZZN5doris13CastToDecimal15_from_decimalv3INS_7DecimalIN4wide7integerILm256EiEEEENS_12Decimal128V3ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRNS_14CastParametersEENKUlS9_S8_E_clISt17integral_constantIbLb1EESI_EEDaS9_S8_ Unexecuted instantiation: _ZZN5doris13CastToDecimal15_from_decimalv3INS_7DecimalIiEENS2_IN4wide7integerILm256EiEEEES7_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRNS_14CastParametersEENKUlS9_S8_E_clISt17integral_constantIbLb0EESI_EEDaS9_S8_ Unexecuted instantiation: _ZZN5doris13CastToDecimal15_from_decimalv3INS_7DecimalIiEENS2_IN4wide7integerILm256EiEEEES7_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRNS_14CastParametersEENKUlS9_S8_E_clISt17integral_constantIbLb0EESH_IbLb1EEEEDaS9_S8_ Unexecuted instantiation: _ZZN5doris13CastToDecimal15_from_decimalv3INS_7DecimalIiEENS2_IN4wide7integerILm256EiEEEES7_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRNS_14CastParametersEENKUlS9_S8_E_clISt17integral_constantIbLb1EESH_IbLb0EEEEDaS9_S8_ Unexecuted instantiation: _ZZN5doris13CastToDecimal15_from_decimalv3INS_7DecimalIiEENS2_IN4wide7integerILm256EiEEEES7_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRNS_14CastParametersEENKUlS9_S8_E_clISt17integral_constantIbLb1EESI_EEDaS9_S8_ Unexecuted instantiation: _ZZN5doris13CastToDecimal15_from_decimalv3INS_7DecimalIlEENS2_IN4wide7integerILm256EiEEEES7_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRNS_14CastParametersEENKUlS9_S8_E_clISt17integral_constantIbLb0EESI_EEDaS9_S8_ Unexecuted instantiation: _ZZN5doris13CastToDecimal15_from_decimalv3INS_7DecimalIlEENS2_IN4wide7integerILm256EiEEEES7_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRNS_14CastParametersEENKUlS9_S8_E_clISt17integral_constantIbLb0EESH_IbLb1EEEEDaS9_S8_ Unexecuted instantiation: _ZZN5doris13CastToDecimal15_from_decimalv3INS_7DecimalIlEENS2_IN4wide7integerILm256EiEEEES7_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRNS_14CastParametersEENKUlS9_S8_E_clISt17integral_constantIbLb1EESH_IbLb0EEEEDaS9_S8_ Unexecuted instantiation: _ZZN5doris13CastToDecimal15_from_decimalv3INS_7DecimalIlEENS2_IN4wide7integerILm256EiEEEES7_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRNS_14CastParametersEENKUlS9_S8_E_clISt17integral_constantIbLb1EESI_EEDaS9_S8_ Unexecuted instantiation: _ZZN5doris13CastToDecimal15_from_decimalv3INS_12Decimal128V3ENS_7DecimalIN4wide7integerILm256EiEEEES7_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRNS_14CastParametersEENKUlS9_S8_E_clISt17integral_constantIbLb0EESI_EEDaS9_S8_ Unexecuted instantiation: _ZZN5doris13CastToDecimal15_from_decimalv3INS_12Decimal128V3ENS_7DecimalIN4wide7integerILm256EiEEEES7_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRNS_14CastParametersEENKUlS9_S8_E_clISt17integral_constantIbLb0EESH_IbLb1EEEEDaS9_S8_ Unexecuted instantiation: _ZZN5doris13CastToDecimal15_from_decimalv3INS_12Decimal128V3ENS_7DecimalIN4wide7integerILm256EiEEEES7_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRNS_14CastParametersEENKUlS9_S8_E_clISt17integral_constantIbLb1EESH_IbLb0EEEEDaS9_S8_ Unexecuted instantiation: _ZZN5doris13CastToDecimal15_from_decimalv3INS_12Decimal128V3ENS_7DecimalIN4wide7integerILm256EiEEEES7_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRNS_14CastParametersEENKUlS9_S8_E_clISt17integral_constantIbLb1EESI_EEDaS9_S8_ Unexecuted instantiation: _ZZN5doris13CastToDecimal15_from_decimalv3INS_7DecimalIN4wide7integerILm256EiEEEES6_S6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS8_jjRS7_jjRNS_14CastParametersEENKUlS8_S7_E_clISt17integral_constantIbLb0EESH_EEDaS8_S7_ Unexecuted instantiation: _ZZN5doris13CastToDecimal15_from_decimalv3INS_7DecimalIN4wide7integerILm256EiEEEES6_S6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS8_jjRS7_jjRNS_14CastParametersEENKUlS8_S7_E_clISt17integral_constantIbLb0EESG_IbLb1EEEEDaS8_S7_ Unexecuted instantiation: _ZZN5doris13CastToDecimal15_from_decimalv3INS_7DecimalIN4wide7integerILm256EiEEEES6_S6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS8_jjRS7_jjRNS_14CastParametersEENKUlS8_S7_E_clISt17integral_constantIbLb1EESG_IbLb0EEEEDaS8_S7_ Unexecuted instantiation: _ZZN5doris13CastToDecimal15_from_decimalv3INS_7DecimalIN4wide7integerILm256EiEEEES6_S6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS8_jjRS7_jjRNS_14CastParametersEENKUlS8_S7_E_clISt17integral_constantIbLb1EESH_EEDaS8_S7_ |
198 | 10 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral)); |
199 | 10 | } _ZN5doris13CastToDecimal15_from_decimalv3INS_7DecimalIiEES3_S3_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRNS_14CastParametersE Line | Count | Source | 164 | 2 | UInt32 to_scale, CastParameters& params) { | 165 | 2 | using MaxNativeType = typename MaxFieldType::NativeType; | 166 | | | 167 | 2 | auto from_max_int_digit_count = from_precision - from_scale; | 168 | 2 | auto to_max_int_digit_count = to_precision - to_scale; | 169 | 2 | bool narrow_integral = | 170 | 2 | (to_max_int_digit_count < from_max_int_digit_count) || | 171 | 2 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 172 | | | 173 | 2 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToCppT::NativeType>(); | 174 | 2 | bool multiply_may_overflow = false; | 175 | 2 | if (to_scale > from_scale) { | 176 | 0 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 177 | 0 | } | 178 | | | 179 | 2 | typename ToCppT::NativeType max_result = | 180 | 2 | DataTypeDecimal<ToCppT::PType>::get_max_digits_number(to_precision); | 181 | 2 | typename ToCppT::NativeType min_result = -max_result; | 182 | | | 183 | 2 | MaxNativeType multiplier {}; | 184 | 2 | if (from_scale < to_scale) { | 185 | 0 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 186 | 0 | from_scale); | 187 | 2 | } else if (from_scale > to_scale) { | 188 | 0 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 189 | 0 | to_scale); | 190 | 0 | } | 191 | | | 192 | 2 | return std::visit( | 193 | 2 | [&](auto multiply_may_overflow, auto narrow_integral) { | 194 | 2 | return _from_decimal<FromCppT, ToCppT, multiply_may_overflow, narrow_integral>( | 195 | 2 | from, from_precision, from_scale, to, to_precision, to_scale, | 196 | 2 | min_result, max_result, multiplier, params); | 197 | 2 | }, | 198 | 2 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral)); | 199 | 2 | } |
_ZN5doris13CastToDecimal15_from_decimalv3INS_7DecimalIlEENS2_IiEES3_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRNS_14CastParametersE Line | Count | Source | 164 | 2 | UInt32 to_scale, CastParameters& params) { | 165 | 2 | using MaxNativeType = typename MaxFieldType::NativeType; | 166 | | | 167 | 2 | auto from_max_int_digit_count = from_precision - from_scale; | 168 | 2 | auto to_max_int_digit_count = to_precision - to_scale; | 169 | 2 | bool narrow_integral = | 170 | 2 | (to_max_int_digit_count < from_max_int_digit_count) || | 171 | 2 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 172 | | | 173 | 2 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToCppT::NativeType>(); | 174 | 2 | bool multiply_may_overflow = false; | 175 | 2 | if (to_scale > from_scale) { | 176 | 0 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 177 | 0 | } | 178 | | | 179 | 2 | typename ToCppT::NativeType max_result = | 180 | 2 | DataTypeDecimal<ToCppT::PType>::get_max_digits_number(to_precision); | 181 | 2 | typename ToCppT::NativeType min_result = -max_result; | 182 | | | 183 | 2 | MaxNativeType multiplier {}; | 184 | 2 | if (from_scale < to_scale) { | 185 | 0 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 186 | 0 | from_scale); | 187 | 2 | } else if (from_scale > to_scale) { | 188 | 2 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 189 | 2 | to_scale); | 190 | 2 | } | 191 | | | 192 | 2 | return std::visit( | 193 | 2 | [&](auto multiply_may_overflow, auto narrow_integral) { | 194 | 2 | return _from_decimal<FromCppT, ToCppT, multiply_may_overflow, narrow_integral>( | 195 | 2 | from, from_precision, from_scale, to, to_precision, to_scale, | 196 | 2 | min_result, max_result, multiplier, params); | 197 | 2 | }, | 198 | 2 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral)); | 199 | 2 | } |
_ZN5doris13CastToDecimal15_from_decimalv3INS_12Decimal128V3ENS_7DecimalIiEES2_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRNS_14CastParametersE Line | Count | Source | 164 | 2 | UInt32 to_scale, CastParameters& params) { | 165 | 2 | using MaxNativeType = typename MaxFieldType::NativeType; | 166 | | | 167 | 2 | auto from_max_int_digit_count = from_precision - from_scale; | 168 | 2 | auto to_max_int_digit_count = to_precision - to_scale; | 169 | 2 | bool narrow_integral = | 170 | 2 | (to_max_int_digit_count < from_max_int_digit_count) || | 171 | 2 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 172 | | | 173 | 2 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToCppT::NativeType>(); | 174 | 2 | bool multiply_may_overflow = false; | 175 | 2 | if (to_scale > from_scale) { | 176 | 0 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 177 | 0 | } | 178 | | | 179 | 2 | typename ToCppT::NativeType max_result = | 180 | 2 | DataTypeDecimal<ToCppT::PType>::get_max_digits_number(to_precision); | 181 | 2 | typename ToCppT::NativeType min_result = -max_result; | 182 | | | 183 | 2 | MaxNativeType multiplier {}; | 184 | 2 | if (from_scale < to_scale) { | 185 | 0 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 186 | 0 | from_scale); | 187 | 2 | } else if (from_scale > to_scale) { | 188 | 2 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 189 | 2 | to_scale); | 190 | 2 | } | 191 | | | 192 | 2 | return std::visit( | 193 | 2 | [&](auto multiply_may_overflow, auto narrow_integral) { | 194 | 2 | return _from_decimal<FromCppT, ToCppT, multiply_may_overflow, narrow_integral>( | 195 | 2 | from, from_precision, from_scale, to, to_precision, to_scale, | 196 | 2 | min_result, max_result, multiplier, params); | 197 | 2 | }, | 198 | 2 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral)); | 199 | 2 | } |
_ZN5doris13CastToDecimal15_from_decimalv3INS_7DecimalIN4wide7integerILm256EiEEEENS2_IiEES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRNS_14CastParametersE Line | Count | Source | 164 | 2 | UInt32 to_scale, CastParameters& params) { | 165 | 2 | using MaxNativeType = typename MaxFieldType::NativeType; | 166 | | | 167 | 2 | auto from_max_int_digit_count = from_precision - from_scale; | 168 | 2 | auto to_max_int_digit_count = to_precision - to_scale; | 169 | 2 | bool narrow_integral = | 170 | 2 | (to_max_int_digit_count < from_max_int_digit_count) || | 171 | 2 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 172 | | | 173 | 2 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToCppT::NativeType>(); | 174 | 2 | bool multiply_may_overflow = false; | 175 | 2 | if (to_scale > from_scale) { | 176 | 0 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 177 | 0 | } | 178 | | | 179 | 2 | typename ToCppT::NativeType max_result = | 180 | 2 | DataTypeDecimal<ToCppT::PType>::get_max_digits_number(to_precision); | 181 | 2 | typename ToCppT::NativeType min_result = -max_result; | 182 | | | 183 | 2 | MaxNativeType multiplier {}; | 184 | 2 | if (from_scale < to_scale) { | 185 | 0 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 186 | 0 | from_scale); | 187 | 2 | } else if (from_scale > to_scale) { | 188 | 2 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 189 | 2 | to_scale); | 190 | 2 | } | 191 | | | 192 | 2 | return std::visit( | 193 | 2 | [&](auto multiply_may_overflow, auto narrow_integral) { | 194 | 2 | return _from_decimal<FromCppT, ToCppT, multiply_may_overflow, narrow_integral>( | 195 | 2 | from, from_precision, from_scale, to, to_precision, to_scale, | 196 | 2 | min_result, max_result, multiplier, params); | 197 | 2 | }, | 198 | 2 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral)); | 199 | 2 | } |
Unexecuted instantiation: _ZN5doris13CastToDecimal15_from_decimalv3INS_7DecimalIiEENS2_IlEES4_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal15_from_decimalv3INS_7DecimalIlEES3_S3_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal15_from_decimalv3INS_12Decimal128V3ENS_7DecimalIlEES2_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal15_from_decimalv3INS_7DecimalIN4wide7integerILm256EiEEEENS2_IlEES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal15_from_decimalv3INS_7DecimalIiEENS_12Decimal128V3ES4_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal15_from_decimalv3INS_7DecimalIlEENS_12Decimal128V3ES4_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRNS_14CastParametersE _ZN5doris13CastToDecimal15_from_decimalv3INS_12Decimal128V3ES2_S2_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS4_jjRS3_jjRNS_14CastParametersE Line | Count | Source | 164 | 2 | UInt32 to_scale, CastParameters& params) { | 165 | 2 | using MaxNativeType = typename MaxFieldType::NativeType; | 166 | | | 167 | 2 | auto from_max_int_digit_count = from_precision - from_scale; | 168 | 2 | auto to_max_int_digit_count = to_precision - to_scale; | 169 | 2 | bool narrow_integral = | 170 | 2 | (to_max_int_digit_count < from_max_int_digit_count) || | 171 | 2 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 172 | | | 173 | 2 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToCppT::NativeType>(); | 174 | 2 | bool multiply_may_overflow = false; | 175 | 2 | if (to_scale > from_scale) { | 176 | 0 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 177 | 0 | } | 178 | | | 179 | 2 | typename ToCppT::NativeType max_result = | 180 | 2 | DataTypeDecimal<ToCppT::PType>::get_max_digits_number(to_precision); | 181 | 2 | typename ToCppT::NativeType min_result = -max_result; | 182 | | | 183 | 2 | MaxNativeType multiplier {}; | 184 | 2 | if (from_scale < to_scale) { | 185 | 0 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 186 | 0 | from_scale); | 187 | 2 | } else if (from_scale > to_scale) { | 188 | 0 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 189 | 0 | to_scale); | 190 | 0 | } | 191 | | | 192 | 2 | return std::visit( | 193 | 2 | [&](auto multiply_may_overflow, auto narrow_integral) { | 194 | 2 | return _from_decimal<FromCppT, ToCppT, multiply_may_overflow, narrow_integral>( | 195 | 2 | from, from_precision, from_scale, to, to_precision, to_scale, | 196 | 2 | min_result, max_result, multiplier, params); | 197 | 2 | }, | 198 | 2 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral)); | 199 | 2 | } |
Unexecuted instantiation: _ZN5doris13CastToDecimal15_from_decimalv3INS_7DecimalIN4wide7integerILm256EiEEEENS_12Decimal128V3ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal15_from_decimalv3INS_7DecimalIiEENS2_IN4wide7integerILm256EiEEEES7_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal15_from_decimalv3INS_7DecimalIlEENS2_IN4wide7integerILm256EiEEEES7_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal15_from_decimalv3INS_12Decimal128V3ENS_7DecimalIN4wide7integerILm256EiEEEES7_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal15_from_decimalv3INS_7DecimalIN4wide7integerILm256EiEEEES6_S6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS8_jjRS7_jjRNS_14CastParametersE |
200 | | |
201 | | template <typename FromCppT, typename ToCppT, bool multiply_may_overflow, bool narrow_integral, |
202 | | typename MaxFieldType = std::conditional_t< |
203 | | (sizeof(FromCppT) == sizeof(ToCppT)) && |
204 | | (std::is_same_v<ToCppT, Decimal128V3> || |
205 | | std::is_same_v<FromCppT, Decimal128V3>), |
206 | | Decimal128V3, |
207 | | std::conditional_t<(sizeof(FromCppT) > sizeof(ToCppT)), FromCppT, ToCppT>>> |
208 | | requires(IsDecimalNumber<ToCppT> && IsDecimalNumber<FromCppT>) |
209 | | static inline bool _from_decimal(const FromCppT& from, const UInt32 from_precision, |
210 | | const UInt32 from_scale, ToCppT& to, UInt32 to_precision, |
211 | | UInt32 to_scale, const ToCppT::NativeType& min_result, |
212 | | const ToCppT::NativeType& max_result, |
213 | | const typename MaxFieldType::NativeType& scale_multiplier, |
214 | 29.6k | CastParameters& params) { |
215 | 29.6k | using MaxNativeType = typename MaxFieldType::NativeType; |
216 | | |
217 | 29.6k | if (from_scale < to_scale) { |
218 | 9.19k | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, |
219 | 9.19k | narrow_integral>( |
220 | 9.19k | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, |
221 | 9.19k | min_result, max_result, params); |
222 | 20.5k | } else if (from_scale == to_scale) { |
223 | 3.73k | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( |
224 | 3.73k | from, from_precision, from_scale, to, to_precision, to_scale, min_result, |
225 | 3.73k | max_result, params); |
226 | 16.7k | } else { |
227 | 16.7k | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, |
228 | 16.7k | narrow_integral>( |
229 | 16.7k | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, |
230 | 16.7k | min_result, max_result, params); |
231 | 16.7k | } |
232 | 0 | return true; |
233 | 29.6k | } _ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIiEES3_Lb0ELb0ES3_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKNS4_10NativeTypeESB_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 214 | 268 | CastParameters& params) { | 215 | 268 | using MaxNativeType = typename MaxFieldType::NativeType; | 216 | | | 217 | 268 | if (from_scale < to_scale) { | 218 | 28 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 219 | 28 | narrow_integral>( | 220 | 28 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 221 | 28 | min_result, max_result, params); | 222 | 240 | } else if (from_scale == to_scale) { | 223 | 16 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 224 | 16 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 225 | 16 | max_result, params); | 226 | 224 | } else { | 227 | 224 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 228 | 224 | narrow_integral>( | 229 | 224 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 230 | 224 | min_result, max_result, params); | 231 | 224 | } | 232 | 0 | return true; | 233 | 268 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIiEES3_Lb0ELb1ES3_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKNS4_10NativeTypeESB_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 214 | 216 | CastParameters& params) { | 215 | 216 | using MaxNativeType = typename MaxFieldType::NativeType; | 216 | | | 217 | 216 | if (from_scale < to_scale) { | 218 | 14 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 219 | 14 | narrow_integral>( | 220 | 14 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 221 | 14 | min_result, max_result, params); | 222 | 202 | } else if (from_scale == to_scale) { | 223 | 38 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 224 | 38 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 225 | 38 | max_result, params); | 226 | 164 | } else { | 227 | 164 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 228 | 164 | narrow_integral>( | 229 | 164 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 230 | 164 | min_result, max_result, params); | 231 | 164 | } | 232 | 0 | return true; | 233 | 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 | 214 | 168 | CastParameters& params) { | 215 | 168 | using MaxNativeType = typename MaxFieldType::NativeType; | 216 | | | 217 | 168 | if (from_scale < to_scale) { | 218 | 168 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 219 | 168 | narrow_integral>( | 220 | 168 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 221 | 168 | min_result, max_result, params); | 222 | 168 | } else if (from_scale == to_scale) { | 223 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 224 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 225 | 0 | max_result, params); | 226 | 0 | } else { | 227 | 0 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 228 | 0 | narrow_integral>( | 229 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 230 | 0 | min_result, max_result, params); | 231 | 0 | } | 232 | 0 | return true; | 233 | 168 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIlEENS2_IiEELb0ELb0ES3_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 214 | 320 | CastParameters& params) { | 215 | 320 | using MaxNativeType = typename MaxFieldType::NativeType; | 216 | | | 217 | 320 | if (from_scale < to_scale) { | 218 | 0 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 219 | 0 | narrow_integral>( | 220 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 221 | 0 | min_result, max_result, params); | 222 | 320 | } else if (from_scale == to_scale) { | 223 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 224 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 225 | 0 | max_result, params); | 226 | 320 | } else { | 227 | 320 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 228 | 320 | narrow_integral>( | 229 | 320 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 230 | 320 | min_result, max_result, params); | 231 | 320 | } | 232 | 0 | return true; | 233 | 320 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIlEENS2_IiEELb0ELb1ES3_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 214 | 918 | CastParameters& params) { | 215 | 918 | using MaxNativeType = typename MaxFieldType::NativeType; | 216 | | | 217 | 918 | if (from_scale < to_scale) { | 218 | 0 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 219 | 0 | narrow_integral>( | 220 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 221 | 0 | min_result, max_result, params); | 222 | 918 | } else if (from_scale == to_scale) { | 223 | 272 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 224 | 272 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 225 | 272 | max_result, params); | 226 | 646 | } else { | 227 | 646 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 228 | 646 | narrow_integral>( | 229 | 646 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 230 | 646 | min_result, max_result, params); | 231 | 646 | } | 232 | 0 | return true; | 233 | 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 | 214 | 252 | CastParameters& params) { | 215 | 252 | using MaxNativeType = typename MaxFieldType::NativeType; | 216 | | | 217 | 252 | if (from_scale < to_scale) { | 218 | 252 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 219 | 252 | narrow_integral>( | 220 | 252 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 221 | 252 | min_result, max_result, params); | 222 | 252 | } else if (from_scale == to_scale) { | 223 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 224 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 225 | 0 | max_result, params); | 226 | 0 | } else { | 227 | 0 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 228 | 0 | narrow_integral>( | 229 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 230 | 0 | min_result, max_result, params); | 231 | 0 | } | 232 | 0 | return true; | 233 | 252 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_12Decimal128V3ENS_7DecimalIiEELb0ELb0ES2_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 214 | 320 | CastParameters& params) { | 215 | 320 | using MaxNativeType = typename MaxFieldType::NativeType; | 216 | | | 217 | 320 | if (from_scale < to_scale) { | 218 | 0 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 219 | 0 | narrow_integral>( | 220 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 221 | 0 | min_result, max_result, params); | 222 | 320 | } else if (from_scale == to_scale) { | 223 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 224 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 225 | 0 | max_result, params); | 226 | 320 | } else { | 227 | 320 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 228 | 320 | narrow_integral>( | 229 | 320 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 230 | 320 | min_result, max_result, params); | 231 | 320 | } | 232 | 0 | return true; | 233 | 320 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_12Decimal128V3ENS_7DecimalIiEELb0ELb1ES2_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 214 | 958 | CastParameters& params) { | 215 | 958 | using MaxNativeType = typename MaxFieldType::NativeType; | 216 | | | 217 | 958 | if (from_scale < to_scale) { | 218 | 0 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 219 | 0 | narrow_integral>( | 220 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 221 | 0 | min_result, max_result, params); | 222 | 958 | } else if (from_scale == to_scale) { | 223 | 244 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 224 | 244 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 225 | 244 | max_result, params); | 226 | 714 | } else { | 227 | 714 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 228 | 714 | narrow_integral>( | 229 | 714 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 230 | 714 | min_result, max_result, params); | 231 | 714 | } | 232 | 0 | return true; | 233 | 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 | 214 | 252 | CastParameters& params) { | 215 | 252 | using MaxNativeType = typename MaxFieldType::NativeType; | 216 | | | 217 | 252 | if (from_scale < to_scale) { | 218 | 252 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 219 | 252 | narrow_integral>( | 220 | 252 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 221 | 252 | min_result, max_result, params); | 222 | 252 | } else if (from_scale == to_scale) { | 223 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 224 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 225 | 0 | max_result, params); | 226 | 0 | } else { | 227 | 0 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 228 | 0 | narrow_integral>( | 229 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 230 | 0 | min_result, max_result, params); | 231 | 0 | } | 232 | 0 | return true; | 233 | 252 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIN4wide7integerILm256EiEEEENS2_IiEELb0ELb0ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKNS8_10NativeTypeESF_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 214 | 320 | CastParameters& params) { | 215 | 320 | using MaxNativeType = typename MaxFieldType::NativeType; | 216 | | | 217 | 320 | if (from_scale < to_scale) { | 218 | 0 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 219 | 0 | narrow_integral>( | 220 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 221 | 0 | min_result, max_result, params); | 222 | 320 | } else if (from_scale == to_scale) { | 223 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 224 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 225 | 0 | max_result, params); | 226 | 320 | } else { | 227 | 320 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 228 | 320 | narrow_integral>( | 229 | 320 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 230 | 320 | min_result, max_result, params); | 231 | 320 | } | 232 | 0 | return true; | 233 | 320 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIN4wide7integerILm256EiEEEENS2_IiEELb0ELb1ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKNS8_10NativeTypeESF_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 214 | 958 | CastParameters& params) { | 215 | 958 | using MaxNativeType = typename MaxFieldType::NativeType; | 216 | | | 217 | 958 | if (from_scale < to_scale) { | 218 | 0 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 219 | 0 | narrow_integral>( | 220 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 221 | 0 | min_result, max_result, params); | 222 | 958 | } else if (from_scale == to_scale) { | 223 | 244 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 224 | 244 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 225 | 244 | max_result, params); | 226 | 714 | } else { | 227 | 714 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 228 | 714 | narrow_integral>( | 229 | 714 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 230 | 714 | min_result, max_result, params); | 231 | 714 | } | 232 | 0 | return true; | 233 | 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 | 214 | 252 | CastParameters& params) { | 215 | 252 | using MaxNativeType = typename MaxFieldType::NativeType; | 216 | | | 217 | 252 | if (from_scale < to_scale) { | 218 | 252 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 219 | 252 | narrow_integral>( | 220 | 252 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 221 | 252 | min_result, max_result, params); | 222 | 252 | } else if (from_scale == to_scale) { | 223 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 224 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 225 | 0 | max_result, params); | 226 | 0 | } else { | 227 | 0 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 228 | 0 | narrow_integral>( | 229 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 230 | 0 | min_result, max_result, params); | 231 | 0 | } | 232 | 0 | return true; | 233 | 252 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIiEENS2_IlEELb0ELb0ES4_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 214 | 756 | CastParameters& params) { | 215 | 756 | using MaxNativeType = typename MaxFieldType::NativeType; | 216 | | | 217 | 756 | if (from_scale < to_scale) { | 218 | 224 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 219 | 224 | narrow_integral>( | 220 | 224 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 221 | 224 | min_result, max_result, params); | 222 | 532 | } else if (from_scale == to_scale) { | 223 | 164 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 224 | 164 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 225 | 164 | max_result, params); | 226 | 368 | } else { | 227 | 368 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 228 | 368 | narrow_integral>( | 229 | 368 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 230 | 368 | min_result, max_result, params); | 231 | 368 | } | 232 | 0 | return true; | 233 | 756 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIiEENS2_IlEELb0ELb1ES4_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 214 | 116 | CastParameters& params) { | 215 | 116 | using MaxNativeType = typename MaxFieldType::NativeType; | 216 | | | 217 | 116 | if (from_scale < to_scale) { | 218 | 116 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 219 | 116 | narrow_integral>( | 220 | 116 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 221 | 116 | min_result, max_result, params); | 222 | 116 | } else if (from_scale == to_scale) { | 223 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 224 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 225 | 0 | max_result, params); | 226 | 0 | } else { | 227 | 0 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 228 | 0 | narrow_integral>( | 229 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 230 | 0 | min_result, max_result, params); | 231 | 0 | } | 232 | 0 | return true; | 233 | 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 | 214 | 144 | CastParameters& params) { | 215 | 144 | using MaxNativeType = typename MaxFieldType::NativeType; | 216 | | | 217 | 144 | if (from_scale < to_scale) { | 218 | 144 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 219 | 144 | narrow_integral>( | 220 | 144 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 221 | 144 | min_result, max_result, params); | 222 | 144 | } else if (from_scale == to_scale) { | 223 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 224 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 225 | 0 | max_result, params); | 226 | 0 | } else { | 227 | 0 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 228 | 0 | narrow_integral>( | 229 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 230 | 0 | min_result, max_result, params); | 231 | 0 | } | 232 | 0 | return true; | 233 | 144 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIlEES3_Lb0ELb0ES3_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKNS4_10NativeTypeESB_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 214 | 856 | CastParameters& params) { | 215 | 856 | using MaxNativeType = typename MaxFieldType::NativeType; | 216 | | | 217 | 856 | if (from_scale < to_scale) { | 218 | 92 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 219 | 92 | narrow_integral>( | 220 | 92 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 221 | 92 | min_result, max_result, params); | 222 | 764 | } else if (from_scale == to_scale) { | 223 | 60 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 224 | 60 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 225 | 60 | max_result, params); | 226 | 704 | } else { | 227 | 704 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 228 | 704 | narrow_integral>( | 229 | 704 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 230 | 704 | min_result, max_result, params); | 231 | 704 | } | 232 | 0 | return true; | 233 | 856 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIlEES3_Lb0ELb1ES3_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKNS4_10NativeTypeESB_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 214 | 364 | CastParameters& params) { | 215 | 364 | using MaxNativeType = typename MaxFieldType::NativeType; | 216 | | | 217 | 364 | if (from_scale < to_scale) { | 218 | 88 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 219 | 88 | narrow_integral>( | 220 | 88 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 221 | 88 | min_result, max_result, params); | 222 | 276 | } else if (from_scale == to_scale) { | 223 | 84 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 224 | 84 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 225 | 84 | max_result, params); | 226 | 192 | } else { | 227 | 192 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 228 | 192 | narrow_integral>( | 229 | 192 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 230 | 192 | min_result, max_result, params); | 231 | 192 | } | 232 | 0 | return true; | 233 | 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 | 214 | 420 | CastParameters& params) { | 215 | 420 | using MaxNativeType = typename MaxFieldType::NativeType; | 216 | | | 217 | 420 | if (from_scale < to_scale) { | 218 | 420 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 219 | 420 | narrow_integral>( | 220 | 420 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 221 | 420 | min_result, max_result, params); | 222 | 420 | } else if (from_scale == to_scale) { | 223 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 224 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 225 | 0 | max_result, params); | 226 | 0 | } else { | 227 | 0 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 228 | 0 | narrow_integral>( | 229 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 230 | 0 | min_result, max_result, params); | 231 | 0 | } | 232 | 0 | return true; | 233 | 420 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_12Decimal128V3ENS_7DecimalIlEELb0ELb0ES2_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 214 | 576 | CastParameters& params) { | 215 | 576 | using MaxNativeType = typename MaxFieldType::NativeType; | 216 | | | 217 | 576 | if (from_scale < to_scale) { | 218 | 0 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 219 | 0 | narrow_integral>( | 220 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 221 | 0 | min_result, max_result, params); | 222 | 576 | } else if (from_scale == to_scale) { | 223 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 224 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 225 | 0 | max_result, params); | 226 | 576 | } else { | 227 | 576 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 228 | 576 | narrow_integral>( | 229 | 576 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 230 | 576 | min_result, max_result, params); | 231 | 576 | } | 232 | 0 | return true; | 233 | 576 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_12Decimal128V3ENS_7DecimalIlEELb0ELb1ES2_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 214 | 1.06k | CastParameters& params) { | 215 | 1.06k | using MaxNativeType = typename MaxFieldType::NativeType; | 216 | | | 217 | 1.06k | if (from_scale < to_scale) { | 218 | 0 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 219 | 0 | narrow_integral>( | 220 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 221 | 0 | min_result, max_result, params); | 222 | 1.06k | } else if (from_scale == to_scale) { | 223 | 364 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 224 | 364 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 225 | 364 | max_result, params); | 226 | 700 | } else { | 227 | 700 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 228 | 700 | narrow_integral>( | 229 | 700 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 230 | 700 | min_result, max_result, params); | 231 | 700 | } | 232 | 0 | return true; | 233 | 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 | 214 | 448 | CastParameters& params) { | 215 | 448 | using MaxNativeType = typename MaxFieldType::NativeType; | 216 | | | 217 | 448 | if (from_scale < to_scale) { | 218 | 448 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 219 | 448 | narrow_integral>( | 220 | 448 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 221 | 448 | min_result, max_result, params); | 222 | 448 | } else if (from_scale == to_scale) { | 223 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 224 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 225 | 0 | max_result, params); | 226 | 0 | } else { | 227 | 0 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 228 | 0 | narrow_integral>( | 229 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 230 | 0 | min_result, max_result, params); | 231 | 0 | } | 232 | 0 | return true; | 233 | 448 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIN4wide7integerILm256EiEEEENS2_IlEELb0ELb0ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKNS8_10NativeTypeESF_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 214 | 576 | CastParameters& params) { | 215 | 576 | using MaxNativeType = typename MaxFieldType::NativeType; | 216 | | | 217 | 576 | if (from_scale < to_scale) { | 218 | 0 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 219 | 0 | narrow_integral>( | 220 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 221 | 0 | min_result, max_result, params); | 222 | 576 | } else if (from_scale == to_scale) { | 223 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 224 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 225 | 0 | max_result, params); | 226 | 576 | } else { | 227 | 576 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 228 | 576 | narrow_integral>( | 229 | 576 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 230 | 576 | min_result, max_result, params); | 231 | 576 | } | 232 | 0 | return true; | 233 | 576 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIN4wide7integerILm256EiEEEENS2_IlEELb0ELb1ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKNS8_10NativeTypeESF_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 214 | 1.10k | CastParameters& params) { | 215 | 1.10k | using MaxNativeType = typename MaxFieldType::NativeType; | 216 | | | 217 | 1.10k | if (from_scale < to_scale) { | 218 | 0 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 219 | 0 | narrow_integral>( | 220 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 221 | 0 | min_result, max_result, params); | 222 | 1.10k | } else if (from_scale == to_scale) { | 223 | 336 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 224 | 336 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 225 | 336 | max_result, params); | 226 | 768 | } else { | 227 | 768 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 228 | 768 | narrow_integral>( | 229 | 768 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 230 | 768 | min_result, max_result, params); | 231 | 768 | } | 232 | 0 | return true; | 233 | 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 | 214 | 448 | CastParameters& params) { | 215 | 448 | using MaxNativeType = typename MaxFieldType::NativeType; | 216 | | | 217 | 448 | if (from_scale < to_scale) { | 218 | 448 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 219 | 448 | narrow_integral>( | 220 | 448 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 221 | 448 | min_result, max_result, params); | 222 | 448 | } else if (from_scale == to_scale) { | 223 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 224 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 225 | 0 | max_result, params); | 226 | 0 | } else { | 227 | 0 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 228 | 0 | narrow_integral>( | 229 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 230 | 0 | min_result, max_result, params); | 231 | 0 | } | 232 | 0 | return true; | 233 | 448 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIiEENS_12Decimal128V3ELb0ELb0ES4_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 214 | 756 | CastParameters& params) { | 215 | 756 | using MaxNativeType = typename MaxFieldType::NativeType; | 216 | | | 217 | 756 | if (from_scale < to_scale) { | 218 | 240 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 219 | 240 | narrow_integral>( | 220 | 240 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 221 | 240 | min_result, max_result, params); | 222 | 516 | } else if (from_scale == to_scale) { | 223 | 148 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 224 | 148 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 225 | 148 | max_result, params); | 226 | 368 | } else { | 227 | 368 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 228 | 368 | narrow_integral>( | 229 | 368 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 230 | 368 | min_result, max_result, params); | 231 | 368 | } | 232 | 0 | return true; | 233 | 756 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIiEENS_12Decimal128V3ELb0ELb1ES4_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 214 | 130 | CastParameters& params) { | 215 | 130 | using MaxNativeType = typename MaxFieldType::NativeType; | 216 | | | 217 | 130 | if (from_scale < to_scale) { | 218 | 130 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 219 | 130 | narrow_integral>( | 220 | 130 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 221 | 130 | min_result, max_result, params); | 222 | 130 | } else if (from_scale == to_scale) { | 223 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 224 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 225 | 0 | max_result, params); | 226 | 0 | } else { | 227 | 0 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 228 | 0 | narrow_integral>( | 229 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 230 | 0 | min_result, max_result, params); | 231 | 0 | } | 232 | 0 | return true; | 233 | 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 | 214 | 130 | CastParameters& params) { | 215 | 130 | using MaxNativeType = typename MaxFieldType::NativeType; | 216 | | | 217 | 130 | if (from_scale < to_scale) { | 218 | 130 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 219 | 130 | narrow_integral>( | 220 | 130 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 221 | 130 | min_result, max_result, params); | 222 | 130 | } else if (from_scale == to_scale) { | 223 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 224 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 225 | 0 | max_result, params); | 226 | 0 | } else { | 227 | 0 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 228 | 0 | narrow_integral>( | 229 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 230 | 0 | min_result, max_result, params); | 231 | 0 | } | 232 | 0 | return true; | 233 | 130 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIlEENS_12Decimal128V3ELb0ELb0ES4_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 214 | 1.31k | CastParameters& params) { | 215 | 1.31k | using MaxNativeType = typename MaxFieldType::NativeType; | 216 | | | 217 | 1.31k | if (from_scale < to_scale) { | 218 | 352 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 219 | 352 | narrow_integral>( | 220 | 352 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 221 | 352 | min_result, max_result, params); | 222 | 960 | } else if (from_scale == to_scale) { | 223 | 256 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 224 | 256 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 225 | 256 | max_result, params); | 226 | 704 | } else { | 227 | 704 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 228 | 704 | narrow_integral>( | 229 | 704 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 230 | 704 | min_result, max_result, params); | 231 | 704 | } | 232 | 0 | return true; | 233 | 1.31k | } |
_ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIlEENS_12Decimal128V3ELb0ELb1ES4_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 214 | 232 | CastParameters& params) { | 215 | 232 | using MaxNativeType = typename MaxFieldType::NativeType; | 216 | | | 217 | 232 | if (from_scale < to_scale) { | 218 | 232 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 219 | 232 | narrow_integral>( | 220 | 232 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 221 | 232 | min_result, max_result, params); | 222 | 232 | } else if (from_scale == to_scale) { | 223 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 224 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 225 | 0 | max_result, params); | 226 | 0 | } else { | 227 | 0 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 228 | 0 | narrow_integral>( | 229 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 230 | 0 | min_result, max_result, params); | 231 | 0 | } | 232 | 0 | return true; | 233 | 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 | 214 | 232 | CastParameters& params) { | 215 | 232 | using MaxNativeType = typename MaxFieldType::NativeType; | 216 | | | 217 | 232 | if (from_scale < to_scale) { | 218 | 232 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 219 | 232 | narrow_integral>( | 220 | 232 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 221 | 232 | min_result, max_result, params); | 222 | 232 | } else if (from_scale == to_scale) { | 223 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 224 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 225 | 0 | max_result, params); | 226 | 0 | } else { | 227 | 0 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 228 | 0 | narrow_integral>( | 229 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 230 | 0 | min_result, max_result, params); | 231 | 0 | } | 232 | 0 | return true; | 233 | 232 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_12Decimal128V3ES2_Lb0ELb0ES2_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS4_jjRS3_jjRKNS3_10NativeTypeESA_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 214 | 858 | CastParameters& params) { | 215 | 858 | using MaxNativeType = typename MaxFieldType::NativeType; | 216 | | | 217 | 858 | if (from_scale < to_scale) { | 218 | 92 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 219 | 92 | narrow_integral>( | 220 | 92 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 221 | 92 | min_result, max_result, params); | 222 | 766 | } else if (from_scale == to_scale) { | 223 | 62 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 224 | 62 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 225 | 62 | max_result, params); | 226 | 704 | } else { | 227 | 704 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 228 | 704 | narrow_integral>( | 229 | 704 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 230 | 704 | min_result, max_result, params); | 231 | 704 | } | 232 | 0 | return true; | 233 | 858 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_12Decimal128V3ES2_Lb0ELb1ES2_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS4_jjRS3_jjRKNS3_10NativeTypeESA_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 214 | 416 | CastParameters& params) { | 215 | 416 | using MaxNativeType = typename MaxFieldType::NativeType; | 216 | | | 217 | 416 | if (from_scale < to_scale) { | 218 | 140 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 219 | 140 | narrow_integral>( | 220 | 140 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 221 | 140 | min_result, max_result, params); | 222 | 276 | } else if (from_scale == to_scale) { | 223 | 84 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 224 | 84 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 225 | 84 | max_result, params); | 226 | 192 | } else { | 227 | 192 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 228 | 192 | narrow_integral>( | 229 | 192 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 230 | 192 | min_result, max_result, params); | 231 | 192 | } | 232 | 0 | return true; | 233 | 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 | 214 | 368 | CastParameters& params) { | 215 | 368 | using MaxNativeType = typename MaxFieldType::NativeType; | 216 | | | 217 | 368 | if (from_scale < to_scale) { | 218 | 368 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 219 | 368 | narrow_integral>( | 220 | 368 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 221 | 368 | min_result, max_result, params); | 222 | 368 | } else if (from_scale == to_scale) { | 223 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 224 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 225 | 0 | max_result, params); | 226 | 0 | } else { | 227 | 0 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 228 | 0 | narrow_integral>( | 229 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 230 | 0 | min_result, max_result, params); | 231 | 0 | } | 232 | 0 | return true; | 233 | 368 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIN4wide7integerILm256EiEEEENS_12Decimal128V3ELb0ELb0ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKNS8_10NativeTypeESF_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 214 | 576 | CastParameters& params) { | 215 | 576 | using MaxNativeType = typename MaxFieldType::NativeType; | 216 | | | 217 | 576 | if (from_scale < to_scale) { | 218 | 0 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 219 | 0 | narrow_integral>( | 220 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 221 | 0 | min_result, max_result, params); | 222 | 576 | } else if (from_scale == to_scale) { | 223 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 224 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 225 | 0 | max_result, params); | 226 | 576 | } else { | 227 | 576 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 228 | 576 | narrow_integral>( | 229 | 576 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 230 | 576 | min_result, max_result, params); | 231 | 576 | } | 232 | 0 | return true; | 233 | 576 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIN4wide7integerILm256EiEEEENS_12Decimal128V3ELb0ELb1ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKNS8_10NativeTypeESF_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 214 | 1.06k | CastParameters& params) { | 215 | 1.06k | using MaxNativeType = typename MaxFieldType::NativeType; | 216 | | | 217 | 1.06k | if (from_scale < to_scale) { | 218 | 0 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 219 | 0 | narrow_integral>( | 220 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 221 | 0 | min_result, max_result, params); | 222 | 1.06k | } else if (from_scale == to_scale) { | 223 | 364 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 224 | 364 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 225 | 364 | max_result, params); | 226 | 700 | } else { | 227 | 700 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 228 | 700 | narrow_integral>( | 229 | 700 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 230 | 700 | min_result, max_result, params); | 231 | 700 | } | 232 | 0 | return true; | 233 | 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 | 214 | 448 | CastParameters& params) { | 215 | 448 | using MaxNativeType = typename MaxFieldType::NativeType; | 216 | | | 217 | 448 | if (from_scale < to_scale) { | 218 | 448 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 219 | 448 | narrow_integral>( | 220 | 448 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 221 | 448 | min_result, max_result, params); | 222 | 448 | } else if (from_scale == to_scale) { | 223 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 224 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 225 | 0 | max_result, params); | 226 | 0 | } else { | 227 | 0 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 228 | 0 | narrow_integral>( | 229 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 230 | 0 | min_result, max_result, params); | 231 | 0 | } | 232 | 0 | return true; | 233 | 448 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIiEENS2_IN4wide7integerILm256EiEEEELb0ELb0ES7_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKNS8_10NativeTypeESF_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 214 | 756 | CastParameters& params) { | 215 | 756 | using MaxNativeType = typename MaxFieldType::NativeType; | 216 | | | 217 | 756 | if (from_scale < to_scale) { | 218 | 240 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 219 | 240 | narrow_integral>( | 220 | 240 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 221 | 240 | min_result, max_result, params); | 222 | 516 | } else if (from_scale == to_scale) { | 223 | 148 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 224 | 148 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 225 | 148 | max_result, params); | 226 | 368 | } else { | 227 | 368 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 228 | 368 | narrow_integral>( | 229 | 368 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 230 | 368 | min_result, max_result, params); | 231 | 368 | } | 232 | 0 | return true; | 233 | 756 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIiEENS2_IN4wide7integerILm256EiEEEELb0ELb1ES7_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKNS8_10NativeTypeESF_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 214 | 130 | CastParameters& params) { | 215 | 130 | using MaxNativeType = typename MaxFieldType::NativeType; | 216 | | | 217 | 130 | if (from_scale < to_scale) { | 218 | 130 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 219 | 130 | narrow_integral>( | 220 | 130 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 221 | 130 | min_result, max_result, params); | 222 | 130 | } else if (from_scale == to_scale) { | 223 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 224 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 225 | 0 | max_result, params); | 226 | 0 | } else { | 227 | 0 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 228 | 0 | narrow_integral>( | 229 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 230 | 0 | min_result, max_result, params); | 231 | 0 | } | 232 | 0 | return true; | 233 | 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 | 214 | 130 | CastParameters& params) { | 215 | 130 | using MaxNativeType = typename MaxFieldType::NativeType; | 216 | | | 217 | 130 | if (from_scale < to_scale) { | 218 | 130 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 219 | 130 | narrow_integral>( | 220 | 130 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 221 | 130 | min_result, max_result, params); | 222 | 130 | } else if (from_scale == to_scale) { | 223 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 224 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 225 | 0 | max_result, params); | 226 | 0 | } else { | 227 | 0 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 228 | 0 | narrow_integral>( | 229 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 230 | 0 | min_result, max_result, params); | 231 | 0 | } | 232 | 0 | return true; | 233 | 130 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIlEENS2_IN4wide7integerILm256EiEEEELb0ELb0ES7_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKNS8_10NativeTypeESF_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 214 | 1.31k | CastParameters& params) { | 215 | 1.31k | using MaxNativeType = typename MaxFieldType::NativeType; | 216 | | | 217 | 1.31k | if (from_scale < to_scale) { | 218 | 368 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 219 | 368 | narrow_integral>( | 220 | 368 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 221 | 368 | min_result, max_result, params); | 222 | 944 | } else if (from_scale == to_scale) { | 223 | 240 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 224 | 240 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 225 | 240 | max_result, params); | 226 | 704 | } else { | 227 | 704 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 228 | 704 | narrow_integral>( | 229 | 704 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 230 | 704 | min_result, max_result, params); | 231 | 704 | } | 232 | 0 | return true; | 233 | 1.31k | } |
_ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIlEENS2_IN4wide7integerILm256EiEEEELb0ELb1ES7_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKNS8_10NativeTypeESF_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 214 | 232 | CastParameters& params) { | 215 | 232 | using MaxNativeType = typename MaxFieldType::NativeType; | 216 | | | 217 | 232 | if (from_scale < to_scale) { | 218 | 232 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 219 | 232 | narrow_integral>( | 220 | 232 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 221 | 232 | min_result, max_result, params); | 222 | 232 | } else if (from_scale == to_scale) { | 223 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 224 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 225 | 0 | max_result, params); | 226 | 0 | } else { | 227 | 0 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 228 | 0 | narrow_integral>( | 229 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 230 | 0 | min_result, max_result, params); | 231 | 0 | } | 232 | 0 | return true; | 233 | 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 | 214 | 232 | CastParameters& params) { | 215 | 232 | using MaxNativeType = typename MaxFieldType::NativeType; | 216 | | | 217 | 232 | if (from_scale < to_scale) { | 218 | 232 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 219 | 232 | narrow_integral>( | 220 | 232 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 221 | 232 | min_result, max_result, params); | 222 | 232 | } else if (from_scale == to_scale) { | 223 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 224 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 225 | 0 | max_result, params); | 226 | 0 | } else { | 227 | 0 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 228 | 0 | narrow_integral>( | 229 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 230 | 0 | min_result, max_result, params); | 231 | 0 | } | 232 | 0 | return true; | 233 | 232 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_12Decimal128V3ENS_7DecimalIN4wide7integerILm256EiEEEELb0ELb0ES7_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKNS8_10NativeTypeESF_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 214 | 1.31k | CastParameters& params) { | 215 | 1.31k | using MaxNativeType = typename MaxFieldType::NativeType; | 216 | | | 217 | 1.31k | if (from_scale < to_scale) { | 218 | 352 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 219 | 352 | narrow_integral>( | 220 | 352 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 221 | 352 | min_result, max_result, params); | 222 | 960 | } else if (from_scale == to_scale) { | 223 | 256 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 224 | 256 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 225 | 256 | max_result, params); | 226 | 704 | } else { | 227 | 704 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 228 | 704 | narrow_integral>( | 229 | 704 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 230 | 704 | min_result, max_result, params); | 231 | 704 | } | 232 | 0 | return true; | 233 | 1.31k | } |
_ZN5doris13CastToDecimal13_from_decimalINS_12Decimal128V3ENS_7DecimalIN4wide7integerILm256EiEEEELb0ELb1ES7_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKNS8_10NativeTypeESF_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 214 | 218 | CastParameters& params) { | 215 | 218 | using MaxNativeType = typename MaxFieldType::NativeType; | 216 | | | 217 | 218 | if (from_scale < to_scale) { | 218 | 218 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 219 | 218 | narrow_integral>( | 220 | 218 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 221 | 218 | min_result, max_result, params); | 222 | 218 | } else if (from_scale == to_scale) { | 223 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 224 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 225 | 0 | max_result, params); | 226 | 0 | } else { | 227 | 0 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 228 | 0 | narrow_integral>( | 229 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 230 | 0 | min_result, max_result, params); | 231 | 0 | } | 232 | 0 | return true; | 233 | 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 | 214 | 246 | CastParameters& params) { | 215 | 246 | using MaxNativeType = typename MaxFieldType::NativeType; | 216 | | | 217 | 246 | if (from_scale < to_scale) { | 218 | 246 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 219 | 246 | narrow_integral>( | 220 | 246 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 221 | 246 | min_result, max_result, params); | 222 | 246 | } else if (from_scale == to_scale) { | 223 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 224 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 225 | 0 | max_result, params); | 226 | 0 | } else { | 227 | 0 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 228 | 0 | narrow_integral>( | 229 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 230 | 0 | min_result, max_result, params); | 231 | 0 | } | 232 | 0 | return true; | 233 | 246 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIN4wide7integerILm256EiEEEES6_Lb0ELb0ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS8_jjRS7_jjRKNS7_10NativeTypeESE_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 214 | 856 | CastParameters& params) { | 215 | 856 | using MaxNativeType = typename MaxFieldType::NativeType; | 216 | | | 217 | 856 | if (from_scale < to_scale) { | 218 | 92 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 219 | 92 | narrow_integral>( | 220 | 92 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 221 | 92 | min_result, max_result, params); | 222 | 764 | } else if (from_scale == to_scale) { | 223 | 60 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 224 | 60 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 225 | 60 | max_result, params); | 226 | 704 | } else { | 227 | 704 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 228 | 704 | narrow_integral>( | 229 | 704 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 230 | 704 | min_result, max_result, params); | 231 | 704 | } | 232 | 0 | return true; | 233 | 856 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIN4wide7integerILm256EiEEEES6_Lb0ELb1ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS8_jjRS7_jjRKNS7_10NativeTypeESE_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 214 | 364 | CastParameters& params) { | 215 | 364 | using MaxNativeType = typename MaxFieldType::NativeType; | 216 | | | 217 | 364 | if (from_scale < to_scale) { | 218 | 88 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 219 | 88 | narrow_integral>( | 220 | 88 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 221 | 88 | min_result, max_result, params); | 222 | 276 | } else if (from_scale == to_scale) { | 223 | 84 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 224 | 84 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 225 | 84 | max_result, params); | 226 | 192 | } else { | 227 | 192 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 228 | 192 | narrow_integral>( | 229 | 192 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 230 | 192 | min_result, max_result, params); | 231 | 192 | } | 232 | 0 | return true; | 233 | 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 | 214 | 420 | CastParameters& params) { | 215 | 420 | using MaxNativeType = typename MaxFieldType::NativeType; | 216 | | | 217 | 420 | if (from_scale < to_scale) { | 218 | 420 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 219 | 420 | narrow_integral>( | 220 | 420 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 221 | 420 | min_result, max_result, params); | 222 | 420 | } else if (from_scale == to_scale) { | 223 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 224 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 225 | 0 | max_result, params); | 226 | 0 | } else { | 227 | 0 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 228 | 0 | narrow_integral>( | 229 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 230 | 0 | min_result, max_result, params); | 231 | 0 | } | 232 | 0 | return true; | 233 | 420 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_14DecimalV2ValueENS_7DecimalIiEELb0ELb0ES2_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 214 | 72 | CastParameters& params) { | 215 | 72 | using MaxNativeType = typename MaxFieldType::NativeType; | 216 | | | 217 | 72 | if (from_scale < to_scale) { | 218 | 0 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 219 | 0 | narrow_integral>( | 220 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 221 | 0 | min_result, max_result, params); | 222 | 72 | } else if (from_scale == to_scale) { | 223 | 8 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 224 | 8 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 225 | 8 | max_result, params); | 226 | 64 | } else { | 227 | 64 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 228 | 64 | narrow_integral>( | 229 | 64 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 230 | 64 | min_result, max_result, params); | 231 | 64 | } | 232 | 0 | return true; | 233 | 72 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_14DecimalV2ValueENS_7DecimalIiEELb0ELb1ES2_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 214 | 940 | CastParameters& params) { | 215 | 940 | using MaxNativeType = typename MaxFieldType::NativeType; | 216 | | | 217 | 940 | if (from_scale < to_scale) { | 218 | 0 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 219 | 0 | narrow_integral>( | 220 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 221 | 0 | min_result, max_result, params); | 222 | 940 | } else if (from_scale == to_scale) { | 223 | 70 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 224 | 70 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 225 | 70 | max_result, params); | 226 | 870 | } else { | 227 | 870 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 228 | 870 | narrow_integral>( | 229 | 870 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 230 | 870 | min_result, max_result, params); | 231 | 870 | } | 232 | 0 | return true; | 233 | 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 | 214 | 262 | CastParameters& params) { | 215 | 262 | using MaxNativeType = typename MaxFieldType::NativeType; | 216 | | | 217 | 262 | if (from_scale < to_scale) { | 218 | 0 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 219 | 0 | narrow_integral>( | 220 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 221 | 0 | min_result, max_result, params); | 222 | 262 | } else if (from_scale == to_scale) { | 223 | 14 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 224 | 14 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 225 | 14 | max_result, params); | 226 | 248 | } else { | 227 | 248 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 228 | 248 | narrow_integral>( | 229 | 248 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 230 | 248 | min_result, max_result, params); | 231 | 248 | } | 232 | 0 | return true; | 233 | 262 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_14DecimalV2ValueENS_7DecimalIlEELb0ELb1ES2_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 214 | 828 | CastParameters& params) { | 215 | 828 | using MaxNativeType = typename MaxFieldType::NativeType; | 216 | | | 217 | 828 | if (from_scale < to_scale) { | 218 | 0 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 219 | 0 | narrow_integral>( | 220 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 221 | 0 | min_result, max_result, params); | 222 | 828 | } else if (from_scale == to_scale) { | 223 | 120 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 224 | 120 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 225 | 120 | max_result, params); | 226 | 708 | } else { | 227 | 708 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 228 | 708 | narrow_integral>( | 229 | 708 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 230 | 708 | min_result, max_result, params); | 231 | 708 | } | 232 | 0 | return true; | 233 | 828 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_14DecimalV2ValueENS_7DecimalIlEELb1ELb0ES2_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 214 | 30 | CastParameters& params) { | 215 | 30 | using MaxNativeType = typename MaxFieldType::NativeType; | 216 | | | 217 | 30 | if (from_scale < to_scale) { | 218 | 30 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 219 | 30 | narrow_integral>( | 220 | 30 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 221 | 30 | min_result, max_result, params); | 222 | 30 | } else if (from_scale == to_scale) { | 223 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 224 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 225 | 0 | max_result, params); | 226 | 0 | } else { | 227 | 0 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 228 | 0 | narrow_integral>( | 229 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 230 | 0 | min_result, max_result, params); | 231 | 0 | } | 232 | 0 | return true; | 233 | 30 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_14DecimalV2ValueENS_7DecimalIlEELb1ELb1ES2_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 214 | 260 | CastParameters& params) { | 215 | 260 | using MaxNativeType = typename MaxFieldType::NativeType; | 216 | | | 217 | 260 | if (from_scale < to_scale) { | 218 | 260 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 219 | 260 | narrow_integral>( | 220 | 260 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 221 | 260 | min_result, max_result, params); | 222 | 260 | } else if (from_scale == to_scale) { | 223 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 224 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 225 | 0 | max_result, params); | 226 | 0 | } else { | 227 | 0 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 228 | 0 | narrow_integral>( | 229 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 230 | 0 | min_result, max_result, params); | 231 | 0 | } | 232 | 0 | return true; | 233 | 260 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_14DecimalV2ValueENS_12Decimal128V3ELb0ELb0ES3_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKNS4_10NativeTypeESB_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 214 | 750 | CastParameters& params) { | 215 | 750 | using MaxNativeType = typename MaxFieldType::NativeType; | 216 | | | 217 | 750 | if (from_scale < to_scale) { | 218 | 22 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 219 | 22 | narrow_integral>( | 220 | 22 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 221 | 22 | min_result, max_result, params); | 222 | 728 | } else if (from_scale == to_scale) { | 223 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 224 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 225 | 0 | max_result, params); | 226 | 728 | } else { | 227 | 728 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 228 | 728 | narrow_integral>( | 229 | 728 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 230 | 728 | min_result, max_result, params); | 231 | 728 | } | 232 | 0 | return true; | 233 | 750 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_14DecimalV2ValueENS_12Decimal128V3ELb0ELb1ES3_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKNS4_10NativeTypeESB_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 214 | 290 | CastParameters& params) { | 215 | 290 | using MaxNativeType = typename MaxFieldType::NativeType; | 216 | | | 217 | 290 | if (from_scale < to_scale) { | 218 | 190 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 219 | 190 | narrow_integral>( | 220 | 190 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 221 | 190 | min_result, max_result, params); | 222 | 190 | } else if (from_scale == to_scale) { | 223 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 224 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 225 | 0 | max_result, params); | 226 | 100 | } else { | 227 | 100 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 228 | 100 | narrow_integral>( | 229 | 100 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 230 | 100 | min_result, max_result, params); | 231 | 100 | } | 232 | 0 | return true; | 233 | 290 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_14DecimalV2ValueENS_12Decimal128V3ELb1ELb0ES3_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKNS4_10NativeTypeESB_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 214 | 22 | CastParameters& params) { | 215 | 22 | using MaxNativeType = typename MaxFieldType::NativeType; | 216 | | | 217 | 22 | if (from_scale < to_scale) { | 218 | 22 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 219 | 22 | narrow_integral>( | 220 | 22 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 221 | 22 | min_result, max_result, params); | 222 | 22 | } else if (from_scale == to_scale) { | 223 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 224 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 225 | 0 | max_result, params); | 226 | 0 | } else { | 227 | 0 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 228 | 0 | narrow_integral>( | 229 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 230 | 0 | min_result, max_result, params); | 231 | 0 | } | 232 | 0 | return true; | 233 | 22 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_14DecimalV2ValueENS_12Decimal128V3ELb1ELb1ES3_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKNS4_10NativeTypeESB_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 214 | 190 | CastParameters& params) { | 215 | 190 | using MaxNativeType = typename MaxFieldType::NativeType; | 216 | | | 217 | 190 | if (from_scale < to_scale) { | 218 | 190 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 219 | 190 | narrow_integral>( | 220 | 190 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 221 | 190 | min_result, max_result, params); | 222 | 190 | } else if (from_scale == to_scale) { | 223 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 224 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 225 | 0 | max_result, params); | 226 | 0 | } else { | 227 | 0 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 228 | 0 | narrow_integral>( | 229 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 230 | 0 | min_result, max_result, params); | 231 | 0 | } | 232 | 0 | return true; | 233 | 190 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_14DecimalV2ValueENS_7DecimalIN4wide7integerILm256EiEEEELb0ELb0ES7_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKNS8_10NativeTypeESF_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 214 | 846 | CastParameters& params) { | 215 | 846 | using MaxNativeType = typename MaxFieldType::NativeType; | 216 | | | 217 | 846 | if (from_scale < to_scale) { | 218 | 22 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 219 | 22 | narrow_integral>( | 220 | 22 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 221 | 22 | min_result, max_result, params); | 222 | 824 | } else if (from_scale == to_scale) { | 223 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 224 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 225 | 0 | max_result, params); | 226 | 824 | } else { | 227 | 824 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 228 | 824 | narrow_integral>( | 229 | 824 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 230 | 824 | min_result, max_result, params); | 231 | 824 | } | 232 | 0 | return true; | 233 | 846 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_14DecimalV2ValueENS_7DecimalIN4wide7integerILm256EiEEEELb0ELb1ES7_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKNS8_10NativeTypeESF_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 214 | 190 | CastParameters& params) { | 215 | 190 | using MaxNativeType = typename MaxFieldType::NativeType; | 216 | | | 217 | 190 | if (from_scale < to_scale) { | 218 | 190 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 219 | 190 | narrow_integral>( | 220 | 190 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 221 | 190 | min_result, max_result, params); | 222 | 190 | } else if (from_scale == to_scale) { | 223 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 224 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 225 | 0 | max_result, params); | 226 | 0 | } else { | 227 | 0 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 228 | 0 | narrow_integral>( | 229 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 230 | 0 | min_result, max_result, params); | 231 | 0 | } | 232 | 0 | return true; | 233 | 190 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_14DecimalV2ValueENS_7DecimalIN4wide7integerILm256EiEEEELb1ELb0ES7_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKNS8_10NativeTypeESF_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 214 | 22 | CastParameters& params) { | 215 | 22 | using MaxNativeType = typename MaxFieldType::NativeType; | 216 | | | 217 | 22 | if (from_scale < to_scale) { | 218 | 22 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 219 | 22 | narrow_integral>( | 220 | 22 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 221 | 22 | min_result, max_result, params); | 222 | 22 | } else if (from_scale == to_scale) { | 223 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 224 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 225 | 0 | max_result, params); | 226 | 0 | } else { | 227 | 0 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 228 | 0 | narrow_integral>( | 229 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 230 | 0 | min_result, max_result, params); | 231 | 0 | } | 232 | 0 | return true; | 233 | 22 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_14DecimalV2ValueENS_7DecimalIN4wide7integerILm256EiEEEELb1ELb1ES7_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKNS8_10NativeTypeESF_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 214 | 190 | CastParameters& params) { | 215 | 190 | using MaxNativeType = typename MaxFieldType::NativeType; | 216 | | | 217 | 190 | if (from_scale < to_scale) { | 218 | 190 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 219 | 190 | narrow_integral>( | 220 | 190 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 221 | 190 | min_result, max_result, params); | 222 | 190 | } else if (from_scale == to_scale) { | 223 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 224 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 225 | 0 | max_result, params); | 226 | 0 | } else { | 227 | 0 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 228 | 0 | narrow_integral>( | 229 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 230 | 0 | min_result, max_result, params); | 231 | 0 | } | 232 | 0 | return true; | 233 | 190 | } |
|
234 | | |
235 | | template <typename FromCppT, typename ToCppT> |
236 | | requires(IsDecimalNumber<ToCppT> && IsCppTypeFloat<FromCppT> && !IsDecimal128V2<ToCppT>) |
237 | | static inline bool _from_float(const FromCppT& from, ToCppT& to, UInt32 to_precision, |
238 | | UInt32 to_scale, |
239 | | const typename ToCppT::NativeType& scale_multiplier, |
240 | | const typename ToCppT::NativeType& min_result, |
241 | | const typename ToCppT::NativeType& max_result, |
242 | 6.70k | CastParameters& params) { |
243 | 6.70k | if (!std::isfinite(from)) { |
244 | 392 | params.status = Status(ErrorCode::ARITHMETIC_OVERFLOW_ERRROR, |
245 | 392 | "Decimal convert overflow. Cannot convert infinity or NaN " |
246 | 392 | "to decimal"); |
247 | 392 | return false; |
248 | 392 | } |
249 | 6.31k | using DoubleType = std::conditional_t<IsDecimal256<ToCppT>, long double, double>; |
250 | 6.31k | DoubleType tmp = from * static_cast<DoubleType>(scale_multiplier); |
251 | 6.31k | if (tmp <= DoubleType(min_result) || tmp >= DoubleType(max_result)) { |
252 | 184 | if (params.is_strict) { |
253 | 92 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, "float/double", to_precision, |
254 | 92 | to_scale); |
255 | 92 | } |
256 | 184 | return false; |
257 | 184 | } |
258 | 6.13k | to.value = static_cast<typename ToCppT::NativeType>(static_cast<double>( |
259 | 6.13k | from * static_cast<DoubleType>(scale_multiplier) + ((from >= 0) ? 0.5 : -0.5))); |
260 | 6.13k | return true; |
261 | 6.31k | } _ZN5doris13CastToDecimal11_from_floatIdNS_7DecimalIiEEQaaaa15IsDecimalNumberIT0_E14IsCppTypeFloatIT_Ent14IsDecimal128V2IS4_EEEbRKS5_RS4_jjRKNS4_10NativeTypeESB_SB_RNS_14CastParametersE Line | Count | Source | 242 | 882 | CastParameters& params) { | 243 | 882 | if (!std::isfinite(from)) { | 244 | 48 | params.status = Status(ErrorCode::ARITHMETIC_OVERFLOW_ERRROR, | 245 | 48 | "Decimal convert overflow. Cannot convert infinity or NaN " | 246 | 48 | "to decimal"); | 247 | 48 | return false; | 248 | 48 | } | 249 | 834 | using DoubleType = std::conditional_t<IsDecimal256<ToCppT>, long double, double>; | 250 | 834 | DoubleType tmp = from * static_cast<DoubleType>(scale_multiplier); | 251 | 834 | if (tmp <= DoubleType(min_result) || tmp >= DoubleType(max_result)) { | 252 | 24 | if (params.is_strict) { | 253 | 12 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, "float/double", to_precision, | 254 | 12 | to_scale); | 255 | 12 | } | 256 | 24 | return false; | 257 | 24 | } | 258 | 810 | to.value = static_cast<typename ToCppT::NativeType>(static_cast<double>( | 259 | 810 | from * static_cast<DoubleType>(scale_multiplier) + ((from >= 0) ? 0.5 : -0.5))); | 260 | 810 | return true; | 261 | 834 | } |
_ZN5doris13CastToDecimal11_from_floatIfNS_7DecimalIiEEQaaaa15IsDecimalNumberIT0_E14IsCppTypeFloatIT_Ent14IsDecimal128V2IS4_EEEbRKS5_RS4_jjRKNS4_10NativeTypeESB_SB_RNS_14CastParametersE Line | Count | Source | 242 | 858 | CastParameters& params) { | 243 | 858 | if (!std::isfinite(from)) { | 244 | 48 | params.status = Status(ErrorCode::ARITHMETIC_OVERFLOW_ERRROR, | 245 | 48 | "Decimal convert overflow. Cannot convert infinity or NaN " | 246 | 48 | "to decimal"); | 247 | 48 | return false; | 248 | 48 | } | 249 | 810 | using DoubleType = std::conditional_t<IsDecimal256<ToCppT>, long double, double>; | 250 | 810 | DoubleType tmp = from * static_cast<DoubleType>(scale_multiplier); | 251 | 810 | if (tmp <= DoubleType(min_result) || tmp >= DoubleType(max_result)) { | 252 | 24 | if (params.is_strict) { | 253 | 12 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, "float/double", to_precision, | 254 | 12 | to_scale); | 255 | 12 | } | 256 | 24 | return false; | 257 | 24 | } | 258 | 786 | to.value = static_cast<typename ToCppT::NativeType>(static_cast<double>( | 259 | 786 | from * static_cast<DoubleType>(scale_multiplier) + ((from >= 0) ? 0.5 : -0.5))); | 260 | 786 | return true; | 261 | 810 | } |
_ZN5doris13CastToDecimal11_from_floatIdNS_7DecimalIlEEQaaaa15IsDecimalNumberIT0_E14IsCppTypeFloatIT_Ent14IsDecimal128V2IS4_EEEbRKS5_RS4_jjRKNS4_10NativeTypeESB_SB_RNS_14CastParametersE Line | Count | Source | 242 | 856 | CastParameters& params) { | 243 | 856 | if (!std::isfinite(from)) { | 244 | 48 | params.status = Status(ErrorCode::ARITHMETIC_OVERFLOW_ERRROR, | 245 | 48 | "Decimal convert overflow. Cannot convert infinity or NaN " | 246 | 48 | "to decimal"); | 247 | 48 | return false; | 248 | 48 | } | 249 | 808 | using DoubleType = std::conditional_t<IsDecimal256<ToCppT>, long double, double>; | 250 | 808 | DoubleType tmp = from * static_cast<DoubleType>(scale_multiplier); | 251 | 808 | if (tmp <= DoubleType(min_result) || tmp >= DoubleType(max_result)) { | 252 | 24 | if (params.is_strict) { | 253 | 12 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, "float/double", to_precision, | 254 | 12 | to_scale); | 255 | 12 | } | 256 | 24 | return false; | 257 | 24 | } | 258 | 784 | to.value = static_cast<typename ToCppT::NativeType>(static_cast<double>( | 259 | 784 | from * static_cast<DoubleType>(scale_multiplier) + ((from >= 0) ? 0.5 : -0.5))); | 260 | 784 | return true; | 261 | 808 | } |
_ZN5doris13CastToDecimal11_from_floatIfNS_7DecimalIlEEQaaaa15IsDecimalNumberIT0_E14IsCppTypeFloatIT_Ent14IsDecimal128V2IS4_EEEbRKS5_RS4_jjRKNS4_10NativeTypeESB_SB_RNS_14CastParametersE Line | Count | Source | 242 | 760 | CastParameters& params) { | 243 | 760 | if (!std::isfinite(from)) { | 244 | 48 | params.status = Status(ErrorCode::ARITHMETIC_OVERFLOW_ERRROR, | 245 | 48 | "Decimal convert overflow. Cannot convert infinity or NaN " | 246 | 48 | "to decimal"); | 247 | 48 | return false; | 248 | 48 | } | 249 | 712 | using DoubleType = std::conditional_t<IsDecimal256<ToCppT>, long double, double>; | 250 | 712 | DoubleType tmp = from * static_cast<DoubleType>(scale_multiplier); | 251 | 712 | if (tmp <= DoubleType(min_result) || tmp >= DoubleType(max_result)) { | 252 | 24 | if (params.is_strict) { | 253 | 12 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, "float/double", to_precision, | 254 | 12 | to_scale); | 255 | 12 | } | 256 | 24 | return false; | 257 | 24 | } | 258 | 688 | to.value = static_cast<typename ToCppT::NativeType>(static_cast<double>( | 259 | 688 | from * static_cast<DoubleType>(scale_multiplier) + ((from >= 0) ? 0.5 : -0.5))); | 260 | 688 | return true; | 261 | 712 | } |
_ZN5doris13CastToDecimal11_from_floatIdNS_12Decimal128V3EQaaaa15IsDecimalNumberIT0_E14IsCppTypeFloatIT_Ent14IsDecimal128V2IS3_EEEbRKS4_RS3_jjRKNS3_10NativeTypeESA_SA_RNS_14CastParametersE Line | Count | Source | 242 | 744 | CastParameters& params) { | 243 | 744 | if (!std::isfinite(from)) { | 244 | 48 | params.status = Status(ErrorCode::ARITHMETIC_OVERFLOW_ERRROR, | 245 | 48 | "Decimal convert overflow. Cannot convert infinity or NaN " | 246 | 48 | "to decimal"); | 247 | 48 | return false; | 248 | 48 | } | 249 | 696 | using DoubleType = std::conditional_t<IsDecimal256<ToCppT>, long double, double>; | 250 | 696 | DoubleType tmp = from * static_cast<DoubleType>(scale_multiplier); | 251 | 696 | if (tmp <= DoubleType(min_result) || tmp >= DoubleType(max_result)) { | 252 | 24 | if (params.is_strict) { | 253 | 12 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, "float/double", to_precision, | 254 | 12 | to_scale); | 255 | 12 | } | 256 | 24 | return false; | 257 | 24 | } | 258 | 672 | to.value = static_cast<typename ToCppT::NativeType>(static_cast<double>( | 259 | 672 | from * static_cast<DoubleType>(scale_multiplier) + ((from >= 0) ? 0.5 : -0.5))); | 260 | 672 | return true; | 261 | 696 | } |
_ZN5doris13CastToDecimal11_from_floatIfNS_12Decimal128V3EQaaaa15IsDecimalNumberIT0_E14IsCppTypeFloatIT_Ent14IsDecimal128V2IS3_EEEbRKS4_RS3_jjRKNS3_10NativeTypeESA_SA_RNS_14CastParametersE Line | Count | Source | 242 | 888 | CastParameters& params) { | 243 | 888 | if (!std::isfinite(from)) { | 244 | 48 | params.status = Status(ErrorCode::ARITHMETIC_OVERFLOW_ERRROR, | 245 | 48 | "Decimal convert overflow. Cannot convert infinity or NaN " | 246 | 48 | "to decimal"); | 247 | 48 | return false; | 248 | 48 | } | 249 | 840 | using DoubleType = std::conditional_t<IsDecimal256<ToCppT>, long double, double>; | 250 | 840 | DoubleType tmp = from * static_cast<DoubleType>(scale_multiplier); | 251 | 840 | if (tmp <= DoubleType(min_result) || tmp >= DoubleType(max_result)) { | 252 | 24 | if (params.is_strict) { | 253 | 12 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, "float/double", to_precision, | 254 | 12 | to_scale); | 255 | 12 | } | 256 | 24 | return false; | 257 | 24 | } | 258 | 816 | to.value = static_cast<typename ToCppT::NativeType>(static_cast<double>( | 259 | 816 | from * static_cast<DoubleType>(scale_multiplier) + ((from >= 0) ? 0.5 : -0.5))); | 260 | 816 | return true; | 261 | 840 | } |
_ZN5doris13CastToDecimal11_from_floatIdNS_7DecimalIN4wide7integerILm256EiEEEEQaaaa15IsDecimalNumberIT0_E14IsCppTypeFloatIT_Ent14IsDecimal128V2IS7_EEEbRKS8_RS7_jjRKNS7_10NativeTypeESE_SE_RNS_14CastParametersE Line | Count | Source | 242 | 872 | CastParameters& params) { | 243 | 872 | if (!std::isfinite(from)) { | 244 | 48 | params.status = Status(ErrorCode::ARITHMETIC_OVERFLOW_ERRROR, | 245 | 48 | "Decimal convert overflow. Cannot convert infinity or NaN " | 246 | 48 | "to decimal"); | 247 | 48 | return false; | 248 | 48 | } | 249 | 824 | using DoubleType = std::conditional_t<IsDecimal256<ToCppT>, long double, double>; | 250 | 824 | DoubleType tmp = from * static_cast<DoubleType>(scale_multiplier); | 251 | 824 | if (tmp <= DoubleType(min_result) || tmp >= DoubleType(max_result)) { | 252 | 24 | if (params.is_strict) { | 253 | 12 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, "float/double", to_precision, | 254 | 12 | to_scale); | 255 | 12 | } | 256 | 24 | return false; | 257 | 24 | } | 258 | 800 | to.value = static_cast<typename ToCppT::NativeType>(static_cast<double>( | 259 | 800 | from * static_cast<DoubleType>(scale_multiplier) + ((from >= 0) ? 0.5 : -0.5))); | 260 | 800 | return true; | 261 | 824 | } |
_ZN5doris13CastToDecimal11_from_floatIfNS_7DecimalIN4wide7integerILm256EiEEEEQaaaa15IsDecimalNumberIT0_E14IsCppTypeFloatIT_Ent14IsDecimal128V2IS7_EEEbRKS8_RS7_jjRKNS7_10NativeTypeESE_SE_RNS_14CastParametersE Line | Count | Source | 242 | 848 | CastParameters& params) { | 243 | 848 | if (!std::isfinite(from)) { | 244 | 56 | params.status = Status(ErrorCode::ARITHMETIC_OVERFLOW_ERRROR, | 245 | 56 | "Decimal convert overflow. Cannot convert infinity or NaN " | 246 | 56 | "to decimal"); | 247 | 56 | return false; | 248 | 56 | } | 249 | 792 | using DoubleType = std::conditional_t<IsDecimal256<ToCppT>, long double, double>; | 250 | 792 | DoubleType tmp = from * static_cast<DoubleType>(scale_multiplier); | 251 | 792 | if (tmp <= DoubleType(min_result) || tmp >= DoubleType(max_result)) { | 252 | 16 | if (params.is_strict) { | 253 | 8 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, "float/double", to_precision, | 254 | 8 | to_scale); | 255 | 8 | } | 256 | 16 | return false; | 257 | 16 | } | 258 | 776 | to.value = static_cast<typename ToCppT::NativeType>(static_cast<double>( | 259 | 776 | from * static_cast<DoubleType>(scale_multiplier) + ((from >= 0) ? 0.5 : -0.5))); | 260 | 776 | return true; | 261 | 792 | } |
|
262 | | |
263 | | template <typename FromCppT, typename ToCppT> |
264 | | requires(IsDecimal128V2<ToCppT> && IsCppTypeFloat<FromCppT>) |
265 | | static inline bool _from_float(const FromCppT& from, ToCppT& to, UInt32 to_precision, |
266 | | UInt32 to_scale, |
267 | | const typename ToCppT::NativeType& scale_multiplier, |
268 | | const typename ToCppT::NativeType& min_result, |
269 | | const typename ToCppT::NativeType& max_result, |
270 | 0 | CastParameters& params) { |
271 | 0 | if (!std::isfinite(from)) { |
272 | 0 | params.status = Status(ErrorCode::ARITHMETIC_OVERFLOW_ERRROR, |
273 | 0 | "Decimal convert overflow. Cannot convert infinity or NaN " |
274 | 0 | "to decimal"); |
275 | 0 | return false; |
276 | 0 | } |
277 | 0 | using DoubleType = std::conditional_t<IsDecimal256<ToCppT>, long double, double>; |
278 | 0 | DoubleType tmp = from * static_cast<DoubleType>(scale_multiplier); |
279 | 0 | if (tmp <= DoubleType(min_result) || tmp >= DoubleType(max_result)) { |
280 | 0 | if (params.is_strict) { |
281 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, "float/double", to_precision, |
282 | 0 | to_scale); |
283 | 0 | } |
284 | 0 | return false; |
285 | 0 | } |
286 | 0 | to = DecimalV2Value(static_cast<typename ToCppT::NativeType>(static_cast<double>( |
287 | 0 | from * static_cast<DoubleType>(scale_multiplier) + ((from >= 0) ? 0.5 : -0.5)))); |
288 | 0 | return true; |
289 | 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 |
290 | | |
291 | | template <typename FromCppT, typename ToCppT, |
292 | | typename MaxFieldType = std::conditional_t< |
293 | | (sizeof(FromCppT) == sizeof(ToCppT)) && |
294 | | (std::is_same_v<ToCppT, Decimal128V3> || |
295 | | std::is_same_v<FromCppT, Decimal128V3>), |
296 | | Decimal128V3, |
297 | | std::conditional_t<(sizeof(FromCppT) > sizeof(ToCppT)), FromCppT, ToCppT>>> |
298 | | requires(IsDecimalNumber<ToCppT> && IsDecimalNumber<FromCppT>) |
299 | | static inline bool from_decimal(const FromCppT& from, const UInt32 from_precision, |
300 | | const UInt32 from_scale, UInt32 from_original_precision, |
301 | | UInt32 from_original_scale, ToCppT& to, UInt32 to_precision, |
302 | | UInt32 to_scale, CastParameters& params) { |
303 | | return _from_decimalv2<FromCppT, ToCppT, MaxFieldType>( |
304 | | from, from_precision, from_scale, from_original_precision, from_original_scale, to, |
305 | | to_precision, to_scale, params); |
306 | | } |
307 | | |
308 | | template <typename FromCppT, typename ToCppT, |
309 | | typename MaxFieldType = std::conditional_t< |
310 | | (sizeof(FromCppT) == sizeof(ToCppT)) && |
311 | | (std::is_same_v<ToCppT, Decimal128V3> || |
312 | | std::is_same_v<FromCppT, Decimal128V3>), |
313 | | Decimal128V3, |
314 | | std::conditional_t<(sizeof(FromCppT) > sizeof(ToCppT)), FromCppT, ToCppT>>> |
315 | | requires(IsDecimalNumber<ToCppT> && IsDecimalNumber<FromCppT>) |
316 | | static inline bool _from_decimalv2(const FromCppT& from, const UInt32 from_precision, |
317 | | const UInt32 from_scale, UInt32 from_original_precision, |
318 | | UInt32 from_original_scale, ToCppT& to, UInt32 to_precision, |
319 | | UInt32 to_scale, CastParameters& params) { |
320 | | using MaxNativeType = typename MaxFieldType::NativeType; |
321 | | |
322 | | auto from_max_int_digit_count = from_original_precision - from_original_scale; |
323 | | auto to_max_int_digit_count = to_precision - to_scale; |
324 | | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count) || |
325 | | (to_max_int_digit_count == from_max_int_digit_count && |
326 | | to_scale < from_original_scale); |
327 | | |
328 | | constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToCppT::NativeType>(); |
329 | | bool multiply_may_overflow = false; |
330 | | if (to_scale > from_scale) { |
331 | | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; |
332 | | } |
333 | | |
334 | | typename ToCppT::NativeType max_result = |
335 | | DataTypeDecimal<ToCppT::PType>::get_max_digits_number(to_precision); |
336 | | typename ToCppT::NativeType min_result = -max_result; |
337 | | |
338 | | return std::visit( |
339 | | [&](auto multiply_may_overflow, auto narrow_integral) { |
340 | | if (from_scale < to_scale) { |
341 | | MaxNativeType multiplier = |
342 | | DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier( |
343 | | to_scale - from_scale); |
344 | | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, |
345 | | narrow_integral>( |
346 | | from, from_precision, from_scale, to, to_precision, to_scale, |
347 | | multiplier, min_result, max_result, params); |
348 | | } else if (from_scale == to_scale) { |
349 | | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, |
350 | | narrow_integral>( |
351 | | from, from_precision, from_scale, to, to_precision, to_scale, |
352 | | min_result, max_result, params); |
353 | | } else { |
354 | | MaxNativeType multiplier = |
355 | | DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier( |
356 | | from_scale - to_scale); |
357 | | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, |
358 | | narrow_integral>( |
359 | | from, from_precision, from_scale, to, to_precision, to_scale, |
360 | | multiplier, min_result, max_result, params); |
361 | | } |
362 | | return true; |
363 | | }, |
364 | | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral)); |
365 | | } |
366 | | |
367 | | template <typename FromCppT, typename ToCppT, bool multiply_may_overflow, bool narrow_integral, |
368 | | typename MaxNativeType = |
369 | | std::conditional_t<(sizeof(FromCppT) > sizeof(typename ToCppT::NativeType)), |
370 | | FromCppT, typename ToCppT::NativeType>> |
371 | | requires(IsDecimalNumber<ToCppT> && !IsDecimal128V2<ToCppT> && |
372 | | (IsCppTypeInt<FromCppT> || std::is_same_v<FromCppT, UInt8>)) |
373 | | static inline bool _from_int(const FromCppT& from, ToCppT& to, UInt32 precision, UInt32 scale, |
374 | | const MaxNativeType& scale_multiplier, |
375 | | const typename ToCppT::NativeType& min_result, |
376 | | const typename ToCppT::NativeType& max_result, |
377 | 6.67k | CastParameters& params) { |
378 | 6.67k | MaxNativeType tmp; |
379 | 6.67k | if constexpr (multiply_may_overflow) { |
380 | 2.11k | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { |
381 | 308 | if (params.is_strict) { |
382 | 152 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, |
383 | 152 | precision, scale); |
384 | 152 | } |
385 | 308 | return false; |
386 | 308 | } |
387 | 1.80k | if constexpr (narrow_integral) { |
388 | 1.80k | if (tmp < min_result || tmp > max_result) { |
389 | 354 | if (params.is_strict) { |
390 | 176 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( |
391 | 176 | from, int_type_name<FromCppT>, precision, scale); |
392 | 176 | } |
393 | 354 | return false; |
394 | 354 | } |
395 | 1.80k | } |
396 | 1.44k | to.value = static_cast<typename ToCppT::NativeType>(tmp); |
397 | 4.56k | } else { |
398 | 4.56k | tmp = scale_multiplier * from; |
399 | 4.56k | if constexpr (narrow_integral) { |
400 | 2.84k | if (tmp < min_result || tmp > max_result) { |
401 | 866 | if (params.is_strict) { |
402 | 432 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( |
403 | 432 | from, int_type_name<FromCppT>, precision, scale); |
404 | 432 | } |
405 | 866 | return false; |
406 | 866 | } |
407 | 2.84k | } |
408 | 1.97k | to.value = static_cast<typename ToCppT::NativeType>(tmp); |
409 | 4.56k | } |
410 | | |
411 | 0 | return true; |
412 | 6.67k | } _ZN5doris13CastToDecimal9_from_intIhNS_7DecimalIiEELb0ELb0EiQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS4_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 377 | 20 | CastParameters& params) { | 378 | 20 | MaxNativeType tmp; | 379 | | if constexpr (multiply_may_overflow) { | 380 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 381 | | if (params.is_strict) { | 382 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 383 | | precision, scale); | 384 | | } | 385 | | return false; | 386 | | } | 387 | | if constexpr (narrow_integral) { | 388 | | if (tmp < min_result || tmp > max_result) { | 389 | | if (params.is_strict) { | 390 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 391 | | from, int_type_name<FromCppT>, precision, scale); | 392 | | } | 393 | | return false; | 394 | | } | 395 | | } | 396 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 397 | 20 | } else { | 398 | 20 | tmp = scale_multiplier * from; | 399 | | if constexpr (narrow_integral) { | 400 | | if (tmp < min_result || tmp > max_result) { | 401 | | if (params.is_strict) { | 402 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 403 | | from, int_type_name<FromCppT>, precision, scale); | 404 | | } | 405 | | return false; | 406 | | } | 407 | | } | 408 | 20 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 409 | 20 | } | 410 | | | 411 | 20 | return true; | 412 | 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 | 377 | 8 | CastParameters& params) { | 378 | 8 | MaxNativeType tmp; | 379 | 8 | if constexpr (multiply_may_overflow) { | 380 | 8 | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 381 | 0 | if (params.is_strict) { | 382 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 383 | 0 | precision, scale); | 384 | 0 | } | 385 | 0 | return false; | 386 | 0 | } | 387 | 8 | if constexpr (narrow_integral) { | 388 | 8 | if (tmp < min_result || tmp > max_result) { | 389 | 4 | if (params.is_strict) { | 390 | 2 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 391 | 2 | from, int_type_name<FromCppT>, precision, scale); | 392 | 2 | } | 393 | 4 | return false; | 394 | 4 | } | 395 | 8 | } | 396 | 4 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 397 | | } else { | 398 | | tmp = scale_multiplier * from; | 399 | | if constexpr (narrow_integral) { | 400 | | if (tmp < min_result || tmp > max_result) { | 401 | | if (params.is_strict) { | 402 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 403 | | from, int_type_name<FromCppT>, precision, scale); | 404 | | } | 405 | | return false; | 406 | | } | 407 | | } | 408 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 409 | | } | 410 | | | 411 | 0 | return true; | 412 | 8 | } |
_ZN5doris13CastToDecimal9_from_intIaNS_7DecimalIiEELb0ELb0EiQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS4_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 377 | 110 | CastParameters& params) { | 378 | 110 | MaxNativeType tmp; | 379 | | if constexpr (multiply_may_overflow) { | 380 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 381 | | if (params.is_strict) { | 382 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 383 | | precision, scale); | 384 | | } | 385 | | return false; | 386 | | } | 387 | | if constexpr (narrow_integral) { | 388 | | if (tmp < min_result || tmp > max_result) { | 389 | | if (params.is_strict) { | 390 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 391 | | from, int_type_name<FromCppT>, precision, scale); | 392 | | } | 393 | | return false; | 394 | | } | 395 | | } | 396 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 397 | 110 | } else { | 398 | 110 | tmp = scale_multiplier * from; | 399 | | if constexpr (narrow_integral) { | 400 | | if (tmp < min_result || tmp > max_result) { | 401 | | if (params.is_strict) { | 402 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 403 | | from, int_type_name<FromCppT>, precision, scale); | 404 | | } | 405 | | return false; | 406 | | } | 407 | | } | 408 | 110 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 409 | 110 | } | 410 | | | 411 | 110 | return true; | 412 | 110 | } |
_ZN5doris13CastToDecimal9_from_intIaNS_7DecimalIiEELb0ELb1EiQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS4_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 377 | 148 | CastParameters& params) { | 378 | 148 | MaxNativeType tmp; | 379 | | if constexpr (multiply_may_overflow) { | 380 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 381 | | if (params.is_strict) { | 382 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 383 | | precision, scale); | 384 | | } | 385 | | return false; | 386 | | } | 387 | | if constexpr (narrow_integral) { | 388 | | if (tmp < min_result || tmp > max_result) { | 389 | | if (params.is_strict) { | 390 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 391 | | from, int_type_name<FromCppT>, precision, scale); | 392 | | } | 393 | | return false; | 394 | | } | 395 | | } | 396 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 397 | 148 | } else { | 398 | 148 | tmp = scale_multiplier * from; | 399 | 148 | if constexpr (narrow_integral) { | 400 | 148 | if (tmp < min_result || tmp > max_result) { | 401 | 48 | if (params.is_strict) { | 402 | 24 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 403 | 24 | from, int_type_name<FromCppT>, precision, scale); | 404 | 24 | } | 405 | 48 | return false; | 406 | 48 | } | 407 | 148 | } | 408 | 100 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 409 | 148 | } | 410 | | | 411 | 0 | return true; | 412 | 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 | 377 | 44 | CastParameters& params) { | 378 | 44 | MaxNativeType tmp; | 379 | 44 | if constexpr (multiply_may_overflow) { | 380 | 44 | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 381 | 8 | if (params.is_strict) { | 382 | 4 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 383 | 4 | precision, scale); | 384 | 4 | } | 385 | 8 | return false; | 386 | 8 | } | 387 | 36 | if constexpr (narrow_integral) { | 388 | 36 | if (tmp < min_result || tmp > max_result) { | 389 | 8 | if (params.is_strict) { | 390 | 4 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 391 | 4 | from, int_type_name<FromCppT>, precision, scale); | 392 | 4 | } | 393 | 8 | return false; | 394 | 8 | } | 395 | 36 | } | 396 | 28 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 397 | | } else { | 398 | | tmp = scale_multiplier * from; | 399 | | if constexpr (narrow_integral) { | 400 | | if (tmp < min_result || tmp > max_result) { | 401 | | if (params.is_strict) { | 402 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 403 | | from, int_type_name<FromCppT>, precision, scale); | 404 | | } | 405 | | return false; | 406 | | } | 407 | | } | 408 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 409 | | } | 410 | | | 411 | 0 | return true; | 412 | 44 | } |
_ZN5doris13CastToDecimal9_from_intIsNS_7DecimalIiEELb0ELb0EiQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS4_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 377 | 72 | CastParameters& params) { | 378 | 72 | MaxNativeType tmp; | 379 | | if constexpr (multiply_may_overflow) { | 380 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 381 | | if (params.is_strict) { | 382 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 383 | | precision, scale); | 384 | | } | 385 | | return false; | 386 | | } | 387 | | if constexpr (narrow_integral) { | 388 | | if (tmp < min_result || tmp > max_result) { | 389 | | if (params.is_strict) { | 390 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 391 | | from, int_type_name<FromCppT>, precision, scale); | 392 | | } | 393 | | return false; | 394 | | } | 395 | | } | 396 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 397 | 72 | } else { | 398 | 72 | tmp = scale_multiplier * from; | 399 | | if constexpr (narrow_integral) { | 400 | | if (tmp < min_result || tmp > max_result) { | 401 | | if (params.is_strict) { | 402 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 403 | | from, int_type_name<FromCppT>, precision, scale); | 404 | | } | 405 | | return false; | 406 | | } | 407 | | } | 408 | 72 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 409 | 72 | } | 410 | | | 411 | 72 | return true; | 412 | 72 | } |
_ZN5doris13CastToDecimal9_from_intIsNS_7DecimalIiEELb0ELb1EiQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS4_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 377 | 218 | CastParameters& params) { | 378 | 218 | MaxNativeType tmp; | 379 | | if constexpr (multiply_may_overflow) { | 380 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 381 | | if (params.is_strict) { | 382 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 383 | | precision, scale); | 384 | | } | 385 | | return false; | 386 | | } | 387 | | if constexpr (narrow_integral) { | 388 | | if (tmp < min_result || tmp > max_result) { | 389 | | if (params.is_strict) { | 390 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 391 | | from, int_type_name<FromCppT>, precision, scale); | 392 | | } | 393 | | return false; | 394 | | } | 395 | | } | 396 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 397 | 218 | } else { | 398 | 218 | tmp = scale_multiplier * from; | 399 | 218 | if constexpr (narrow_integral) { | 400 | 218 | if (tmp < min_result || tmp > max_result) { | 401 | 66 | if (params.is_strict) { | 402 | 32 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 403 | 32 | from, int_type_name<FromCppT>, precision, scale); | 404 | 32 | } | 405 | 66 | return false; | 406 | 66 | } | 407 | 218 | } | 408 | 152 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 409 | 218 | } | 410 | | | 411 | 0 | return true; | 412 | 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 | 377 | 44 | CastParameters& params) { | 378 | 44 | MaxNativeType tmp; | 379 | 44 | if constexpr (multiply_may_overflow) { | 380 | 44 | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 381 | 8 | if (params.is_strict) { | 382 | 4 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 383 | 4 | precision, scale); | 384 | 4 | } | 385 | 8 | return false; | 386 | 8 | } | 387 | 36 | if constexpr (narrow_integral) { | 388 | 36 | if (tmp < min_result || tmp > max_result) { | 389 | 8 | if (params.is_strict) { | 390 | 4 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 391 | 4 | from, int_type_name<FromCppT>, precision, scale); | 392 | 4 | } | 393 | 8 | return false; | 394 | 8 | } | 395 | 36 | } | 396 | 28 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 397 | | } else { | 398 | | tmp = scale_multiplier * from; | 399 | | if constexpr (narrow_integral) { | 400 | | if (tmp < min_result || tmp > max_result) { | 401 | | if (params.is_strict) { | 402 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 403 | | from, int_type_name<FromCppT>, precision, scale); | 404 | | } | 405 | | return false; | 406 | | } | 407 | | } | 408 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 409 | | } | 410 | | | 411 | 0 | return true; | 412 | 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 | 377 | 180 | CastParameters& params) { | 378 | 180 | MaxNativeType tmp; | 379 | | if constexpr (multiply_may_overflow) { | 380 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 381 | | if (params.is_strict) { | 382 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 383 | | precision, scale); | 384 | | } | 385 | | return false; | 386 | | } | 387 | | if constexpr (narrow_integral) { | 388 | | if (tmp < min_result || tmp > max_result) { | 389 | | if (params.is_strict) { | 390 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 391 | | from, int_type_name<FromCppT>, precision, scale); | 392 | | } | 393 | | return false; | 394 | | } | 395 | | } | 396 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 397 | 180 | } else { | 398 | 180 | tmp = scale_multiplier * from; | 399 | 180 | if constexpr (narrow_integral) { | 400 | 180 | if (tmp < min_result || tmp > max_result) { | 401 | 48 | if (params.is_strict) { | 402 | 24 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 403 | 24 | from, int_type_name<FromCppT>, precision, scale); | 404 | 24 | } | 405 | 48 | return false; | 406 | 48 | } | 407 | 180 | } | 408 | 132 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 409 | 180 | } | 410 | | | 411 | 0 | return true; | 412 | 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 | 377 | 218 | CastParameters& params) { | 378 | 218 | MaxNativeType tmp; | 379 | 218 | if constexpr (multiply_may_overflow) { | 380 | 218 | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 381 | 34 | if (params.is_strict) { | 382 | 16 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 383 | 16 | precision, scale); | 384 | 16 | } | 385 | 34 | return false; | 386 | 34 | } | 387 | 184 | if constexpr (narrow_integral) { | 388 | 184 | if (tmp < min_result || tmp > max_result) { | 389 | 32 | if (params.is_strict) { | 390 | 16 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 391 | 16 | from, int_type_name<FromCppT>, precision, scale); | 392 | 16 | } | 393 | 32 | return false; | 394 | 32 | } | 395 | 184 | } | 396 | 152 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 397 | | } else { | 398 | | tmp = scale_multiplier * from; | 399 | | if constexpr (narrow_integral) { | 400 | | if (tmp < min_result || tmp > max_result) { | 401 | | if (params.is_strict) { | 402 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 403 | | from, int_type_name<FromCppT>, precision, scale); | 404 | | } | 405 | | return false; | 406 | | } | 407 | | } | 408 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 409 | | } | 410 | | | 411 | 0 | return true; | 412 | 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 | 377 | 180 | CastParameters& params) { | 378 | 180 | MaxNativeType tmp; | 379 | | if constexpr (multiply_may_overflow) { | 380 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 381 | | if (params.is_strict) { | 382 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 383 | | precision, scale); | 384 | | } | 385 | | return false; | 386 | | } | 387 | | if constexpr (narrow_integral) { | 388 | | if (tmp < min_result || tmp > max_result) { | 389 | | if (params.is_strict) { | 390 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 391 | | from, int_type_name<FromCppT>, precision, scale); | 392 | | } | 393 | | return false; | 394 | | } | 395 | | } | 396 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 397 | 180 | } else { | 398 | 180 | tmp = scale_multiplier * from; | 399 | 180 | if constexpr (narrow_integral) { | 400 | 180 | if (tmp < min_result || tmp > max_result) { | 401 | 48 | if (params.is_strict) { | 402 | 24 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 403 | 24 | from, int_type_name<FromCppT>, precision, scale); | 404 | 24 | } | 405 | 48 | return false; | 406 | 48 | } | 407 | 180 | } | 408 | 132 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 409 | 180 | } | 410 | | | 411 | 0 | return true; | 412 | 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 | 377 | 218 | CastParameters& params) { | 378 | 218 | MaxNativeType tmp; | 379 | 218 | if constexpr (multiply_may_overflow) { | 380 | 218 | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 381 | 34 | if (params.is_strict) { | 382 | 16 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 383 | 16 | precision, scale); | 384 | 16 | } | 385 | 34 | return false; | 386 | 34 | } | 387 | 184 | if constexpr (narrow_integral) { | 388 | 184 | if (tmp < min_result || tmp > max_result) { | 389 | 32 | if (params.is_strict) { | 390 | 16 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 391 | 16 | from, int_type_name<FromCppT>, precision, scale); | 392 | 16 | } | 393 | 32 | return false; | 394 | 32 | } | 395 | 184 | } | 396 | 152 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 397 | | } else { | 398 | | tmp = scale_multiplier * from; | 399 | | if constexpr (narrow_integral) { | 400 | | if (tmp < min_result || tmp > max_result) { | 401 | | if (params.is_strict) { | 402 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 403 | | from, int_type_name<FromCppT>, precision, scale); | 404 | | } | 405 | | return false; | 406 | | } | 407 | | } | 408 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 409 | | } | 410 | | | 411 | 0 | return true; | 412 | 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 | 377 | 180 | CastParameters& params) { | 378 | 180 | MaxNativeType tmp; | 379 | | if constexpr (multiply_may_overflow) { | 380 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 381 | | if (params.is_strict) { | 382 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 383 | | precision, scale); | 384 | | } | 385 | | return false; | 386 | | } | 387 | | if constexpr (narrow_integral) { | 388 | | if (tmp < min_result || tmp > max_result) { | 389 | | if (params.is_strict) { | 390 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 391 | | from, int_type_name<FromCppT>, precision, scale); | 392 | | } | 393 | | return false; | 394 | | } | 395 | | } | 396 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 397 | 180 | } else { | 398 | 180 | tmp = scale_multiplier * from; | 399 | 180 | if constexpr (narrow_integral) { | 400 | 180 | if (tmp < min_result || tmp > max_result) { | 401 | 48 | if (params.is_strict) { | 402 | 24 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 403 | 24 | from, int_type_name<FromCppT>, precision, scale); | 404 | 24 | } | 405 | 48 | return false; | 406 | 48 | } | 407 | 180 | } | 408 | 132 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 409 | 180 | } | 410 | | | 411 | 0 | return true; | 412 | 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 | 377 | 218 | CastParameters& params) { | 378 | 218 | MaxNativeType tmp; | 379 | 218 | if constexpr (multiply_may_overflow) { | 380 | 218 | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 381 | 32 | if (params.is_strict) { | 382 | 16 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 383 | 16 | precision, scale); | 384 | 16 | } | 385 | 32 | return false; | 386 | 32 | } | 387 | 186 | if constexpr (narrow_integral) { | 388 | 186 | if (tmp < min_result || tmp > max_result) { | 389 | 34 | if (params.is_strict) { | 390 | 16 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 391 | 16 | from, int_type_name<FromCppT>, precision, scale); | 392 | 16 | } | 393 | 34 | return false; | 394 | 34 | } | 395 | 186 | } | 396 | 152 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 397 | | } else { | 398 | | tmp = scale_multiplier * from; | 399 | | if constexpr (narrow_integral) { | 400 | | if (tmp < min_result || tmp > max_result) { | 401 | | if (params.is_strict) { | 402 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 403 | | from, int_type_name<FromCppT>, precision, scale); | 404 | | } | 405 | | return false; | 406 | | } | 407 | | } | 408 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 409 | | } | 410 | | | 411 | 0 | return true; | 412 | 218 | } |
_ZN5doris13CastToDecimal9_from_intIhNS_7DecimalIlEELb0ELb0ElQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS4_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 377 | 16 | CastParameters& params) { | 378 | 16 | MaxNativeType tmp; | 379 | | if constexpr (multiply_may_overflow) { | 380 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 381 | | if (params.is_strict) { | 382 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 383 | | precision, scale); | 384 | | } | 385 | | return false; | 386 | | } | 387 | | if constexpr (narrow_integral) { | 388 | | if (tmp < min_result || tmp > max_result) { | 389 | | if (params.is_strict) { | 390 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 391 | | from, int_type_name<FromCppT>, precision, scale); | 392 | | } | 393 | | return false; | 394 | | } | 395 | | } | 396 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 397 | 16 | } else { | 398 | 16 | tmp = scale_multiplier * from; | 399 | | if constexpr (narrow_integral) { | 400 | | if (tmp < min_result || tmp > max_result) { | 401 | | if (params.is_strict) { | 402 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 403 | | from, int_type_name<FromCppT>, precision, scale); | 404 | | } | 405 | | return false; | 406 | | } | 407 | | } | 408 | 16 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 409 | 16 | } | 410 | | | 411 | 16 | return true; | 412 | 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 | 377 | 8 | CastParameters& params) { | 378 | 8 | MaxNativeType tmp; | 379 | 8 | if constexpr (multiply_may_overflow) { | 380 | 8 | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 381 | 0 | if (params.is_strict) { | 382 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 383 | 0 | precision, scale); | 384 | 0 | } | 385 | 0 | return false; | 386 | 0 | } | 387 | 8 | if constexpr (narrow_integral) { | 388 | 8 | if (tmp < min_result || tmp > max_result) { | 389 | 4 | if (params.is_strict) { | 390 | 2 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 391 | 2 | from, int_type_name<FromCppT>, precision, scale); | 392 | 2 | } | 393 | 4 | return false; | 394 | 4 | } | 395 | 8 | } | 396 | 4 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 397 | | } else { | 398 | | tmp = scale_multiplier * from; | 399 | | if constexpr (narrow_integral) { | 400 | | if (tmp < min_result || tmp > max_result) { | 401 | | if (params.is_strict) { | 402 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 403 | | from, int_type_name<FromCppT>, precision, scale); | 404 | | } | 405 | | return false; | 406 | | } | 407 | | } | 408 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 409 | | } | 410 | | | 411 | 0 | return true; | 412 | 8 | } |
_ZN5doris13CastToDecimal9_from_intIaNS_7DecimalIlEELb0ELb0ElQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS4_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 377 | 144 | CastParameters& params) { | 378 | 144 | MaxNativeType tmp; | 379 | | if constexpr (multiply_may_overflow) { | 380 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 381 | | if (params.is_strict) { | 382 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 383 | | precision, scale); | 384 | | } | 385 | | return false; | 386 | | } | 387 | | if constexpr (narrow_integral) { | 388 | | if (tmp < min_result || tmp > max_result) { | 389 | | if (params.is_strict) { | 390 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 391 | | from, int_type_name<FromCppT>, precision, scale); | 392 | | } | 393 | | return false; | 394 | | } | 395 | | } | 396 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 397 | 144 | } else { | 398 | 144 | tmp = scale_multiplier * from; | 399 | | if constexpr (narrow_integral) { | 400 | | if (tmp < min_result || tmp > max_result) { | 401 | | if (params.is_strict) { | 402 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 403 | | from, int_type_name<FromCppT>, precision, scale); | 404 | | } | 405 | | return false; | 406 | | } | 407 | | } | 408 | 144 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 409 | 144 | } | 410 | | | 411 | 144 | return true; | 412 | 144 | } |
_ZN5doris13CastToDecimal9_from_intIaNS_7DecimalIlEELb0ELb1ElQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS4_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 377 | 88 | CastParameters& params) { | 378 | 88 | MaxNativeType tmp; | 379 | | if constexpr (multiply_may_overflow) { | 380 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 381 | | if (params.is_strict) { | 382 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 383 | | precision, scale); | 384 | | } | 385 | | return false; | 386 | | } | 387 | | if constexpr (narrow_integral) { | 388 | | if (tmp < min_result || tmp > max_result) { | 389 | | if (params.is_strict) { | 390 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 391 | | from, int_type_name<FromCppT>, precision, scale); | 392 | | } | 393 | | return false; | 394 | | } | 395 | | } | 396 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 397 | 88 | } else { | 398 | 88 | tmp = scale_multiplier * from; | 399 | 88 | if constexpr (narrow_integral) { | 400 | 88 | if (tmp < min_result || tmp > max_result) { | 401 | 32 | if (params.is_strict) { | 402 | 16 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 403 | 16 | from, int_type_name<FromCppT>, precision, scale); | 404 | 16 | } | 405 | 32 | return false; | 406 | 32 | } | 407 | 88 | } | 408 | 56 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 409 | 88 | } | 410 | | | 411 | 0 | return true; | 412 | 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 | 377 | 44 | CastParameters& params) { | 378 | 44 | MaxNativeType tmp; | 379 | 44 | if constexpr (multiply_may_overflow) { | 380 | 44 | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 381 | 8 | if (params.is_strict) { | 382 | 4 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 383 | 4 | precision, scale); | 384 | 4 | } | 385 | 8 | return false; | 386 | 8 | } | 387 | 36 | if constexpr (narrow_integral) { | 388 | 36 | if (tmp < min_result || tmp > max_result) { | 389 | 8 | if (params.is_strict) { | 390 | 4 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 391 | 4 | from, int_type_name<FromCppT>, precision, scale); | 392 | 4 | } | 393 | 8 | return false; | 394 | 8 | } | 395 | 36 | } | 396 | 28 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 397 | | } else { | 398 | | tmp = scale_multiplier * from; | 399 | | if constexpr (narrow_integral) { | 400 | | if (tmp < min_result || tmp > max_result) { | 401 | | if (params.is_strict) { | 402 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 403 | | from, int_type_name<FromCppT>, precision, scale); | 404 | | } | 405 | | return false; | 406 | | } | 407 | | } | 408 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 409 | | } | 410 | | | 411 | 0 | return true; | 412 | 44 | } |
_ZN5doris13CastToDecimal9_from_intIsNS_7DecimalIlEELb0ELb0ElQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS4_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 377 | 144 | CastParameters& params) { | 378 | 144 | MaxNativeType tmp; | 379 | | if constexpr (multiply_may_overflow) { | 380 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 381 | | if (params.is_strict) { | 382 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 383 | | precision, scale); | 384 | | } | 385 | | return false; | 386 | | } | 387 | | if constexpr (narrow_integral) { | 388 | | if (tmp < min_result || tmp > max_result) { | 389 | | if (params.is_strict) { | 390 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 391 | | from, int_type_name<FromCppT>, precision, scale); | 392 | | } | 393 | | return false; | 394 | | } | 395 | | } | 396 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 397 | 144 | } else { | 398 | 144 | tmp = scale_multiplier * from; | 399 | | if constexpr (narrow_integral) { | 400 | | if (tmp < min_result || tmp > max_result) { | 401 | | if (params.is_strict) { | 402 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 403 | | from, int_type_name<FromCppT>, precision, scale); | 404 | | } | 405 | | return false; | 406 | | } | 407 | | } | 408 | 144 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 409 | 144 | } | 410 | | | 411 | 144 | return true; | 412 | 144 | } |
_ZN5doris13CastToDecimal9_from_intIsNS_7DecimalIlEELb0ELb1ElQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS4_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 377 | 88 | CastParameters& params) { | 378 | 88 | MaxNativeType tmp; | 379 | | if constexpr (multiply_may_overflow) { | 380 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 381 | | if (params.is_strict) { | 382 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 383 | | precision, scale); | 384 | | } | 385 | | return false; | 386 | | } | 387 | | if constexpr (narrow_integral) { | 388 | | if (tmp < min_result || tmp > max_result) { | 389 | | if (params.is_strict) { | 390 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 391 | | from, int_type_name<FromCppT>, precision, scale); | 392 | | } | 393 | | return false; | 394 | | } | 395 | | } | 396 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 397 | 88 | } else { | 398 | 88 | tmp = scale_multiplier * from; | 399 | 88 | if constexpr (narrow_integral) { | 400 | 88 | if (tmp < min_result || tmp > max_result) { | 401 | 32 | if (params.is_strict) { | 402 | 16 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 403 | 16 | from, int_type_name<FromCppT>, precision, scale); | 404 | 16 | } | 405 | 32 | return false; | 406 | 32 | } | 407 | 88 | } | 408 | 56 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 409 | 88 | } | 410 | | | 411 | 0 | return true; | 412 | 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 | 377 | 44 | CastParameters& params) { | 378 | 44 | MaxNativeType tmp; | 379 | 44 | if constexpr (multiply_may_overflow) { | 380 | 44 | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 381 | 8 | if (params.is_strict) { | 382 | 4 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 383 | 4 | precision, scale); | 384 | 4 | } | 385 | 8 | return false; | 386 | 8 | } | 387 | 36 | if constexpr (narrow_integral) { | 388 | 36 | if (tmp < min_result || tmp > max_result) { | 389 | 8 | if (params.is_strict) { | 390 | 4 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 391 | 4 | from, int_type_name<FromCppT>, precision, scale); | 392 | 4 | } | 393 | 8 | return false; | 394 | 8 | } | 395 | 36 | } | 396 | 28 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 397 | | } else { | 398 | | tmp = scale_multiplier * from; | 399 | | if constexpr (narrow_integral) { | 400 | | if (tmp < min_result || tmp > max_result) { | 401 | | if (params.is_strict) { | 402 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 403 | | from, int_type_name<FromCppT>, precision, scale); | 404 | | } | 405 | | return false; | 406 | | } | 407 | | } | 408 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 409 | | } | 410 | | | 411 | 0 | return true; | 412 | 44 | } |
_ZN5doris13CastToDecimal9_from_intIiNS_7DecimalIlEELb0ELb0ElQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS4_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 377 | 36 | CastParameters& params) { | 378 | 36 | MaxNativeType tmp; | 379 | | if constexpr (multiply_may_overflow) { | 380 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 381 | | if (params.is_strict) { | 382 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 383 | | precision, scale); | 384 | | } | 385 | | return false; | 386 | | } | 387 | | if constexpr (narrow_integral) { | 388 | | if (tmp < min_result || tmp > max_result) { | 389 | | if (params.is_strict) { | 390 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 391 | | from, int_type_name<FromCppT>, precision, scale); | 392 | | } | 393 | | return false; | 394 | | } | 395 | | } | 396 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 397 | 36 | } else { | 398 | 36 | tmp = scale_multiplier * from; | 399 | | if constexpr (narrow_integral) { | 400 | | if (tmp < min_result || tmp > max_result) { | 401 | | if (params.is_strict) { | 402 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 403 | | from, int_type_name<FromCppT>, precision, scale); | 404 | | } | 405 | | return false; | 406 | | } | 407 | | } | 408 | 36 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 409 | 36 | } | 410 | | | 411 | 36 | return true; | 412 | 36 | } |
_ZN5doris13CastToDecimal9_from_intIiNS_7DecimalIlEELb0ELb1ElQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS4_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 377 | 224 | CastParameters& params) { | 378 | 224 | MaxNativeType tmp; | 379 | | if constexpr (multiply_may_overflow) { | 380 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 381 | | if (params.is_strict) { | 382 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 383 | | precision, scale); | 384 | | } | 385 | | return false; | 386 | | } | 387 | | if constexpr (narrow_integral) { | 388 | | if (tmp < min_result || tmp > max_result) { | 389 | | if (params.is_strict) { | 390 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 391 | | from, int_type_name<FromCppT>, precision, scale); | 392 | | } | 393 | | return false; | 394 | | } | 395 | | } | 396 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 397 | 224 | } else { | 398 | 224 | tmp = scale_multiplier * from; | 399 | 224 | if constexpr (narrow_integral) { | 400 | 224 | if (tmp < min_result || tmp > max_result) { | 401 | 64 | if (params.is_strict) { | 402 | 32 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 403 | 32 | from, int_type_name<FromCppT>, precision, scale); | 404 | 32 | } | 405 | 64 | return false; | 406 | 64 | } | 407 | 224 | } | 408 | 160 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 409 | 224 | } | 410 | | | 411 | 0 | return true; | 412 | 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 | 377 | 112 | CastParameters& params) { | 378 | 112 | MaxNativeType tmp; | 379 | 112 | if constexpr (multiply_may_overflow) { | 380 | 112 | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 381 | 8 | if (params.is_strict) { | 382 | 4 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 383 | 4 | precision, scale); | 384 | 4 | } | 385 | 8 | return false; | 386 | 8 | } | 387 | 104 | if constexpr (narrow_integral) { | 388 | 104 | if (tmp < min_result || tmp > max_result) { | 389 | 24 | if (params.is_strict) { | 390 | 12 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 391 | 12 | from, int_type_name<FromCppT>, precision, scale); | 392 | 12 | } | 393 | 24 | return false; | 394 | 24 | } | 395 | 104 | } | 396 | 80 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 397 | | } else { | 398 | | tmp = scale_multiplier * from; | 399 | | if constexpr (narrow_integral) { | 400 | | if (tmp < min_result || tmp > max_result) { | 401 | | if (params.is_strict) { | 402 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 403 | | from, int_type_name<FromCppT>, precision, scale); | 404 | | } | 405 | | return false; | 406 | | } | 407 | | } | 408 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 409 | | } | 410 | | | 411 | 0 | return true; | 412 | 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 | 377 | 180 | CastParameters& params) { | 378 | 180 | MaxNativeType tmp; | 379 | | if constexpr (multiply_may_overflow) { | 380 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 381 | | if (params.is_strict) { | 382 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 383 | | precision, scale); | 384 | | } | 385 | | return false; | 386 | | } | 387 | | if constexpr (narrow_integral) { | 388 | | if (tmp < min_result || tmp > max_result) { | 389 | | if (params.is_strict) { | 390 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 391 | | from, int_type_name<FromCppT>, precision, scale); | 392 | | } | 393 | | return false; | 394 | | } | 395 | | } | 396 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 397 | 180 | } else { | 398 | 180 | tmp = scale_multiplier * from; | 399 | 180 | if constexpr (narrow_integral) { | 400 | 180 | if (tmp < min_result || tmp > max_result) { | 401 | 48 | if (params.is_strict) { | 402 | 24 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 403 | 24 | from, int_type_name<FromCppT>, precision, scale); | 404 | 24 | } | 405 | 48 | return false; | 406 | 48 | } | 407 | 180 | } | 408 | 132 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 409 | 180 | } | 410 | | | 411 | 0 | return true; | 412 | 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 | 377 | 224 | CastParameters& params) { | 378 | 224 | MaxNativeType tmp; | 379 | 224 | if constexpr (multiply_may_overflow) { | 380 | 224 | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 381 | 32 | if (params.is_strict) { | 382 | 16 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 383 | 16 | precision, scale); | 384 | 16 | } | 385 | 32 | return false; | 386 | 32 | } | 387 | 192 | if constexpr (narrow_integral) { | 388 | 192 | if (tmp < min_result || tmp > max_result) { | 389 | 32 | if (params.is_strict) { | 390 | 16 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 391 | 16 | from, int_type_name<FromCppT>, precision, scale); | 392 | 16 | } | 393 | 32 | return false; | 394 | 32 | } | 395 | 192 | } | 396 | 160 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 397 | | } else { | 398 | | tmp = scale_multiplier * from; | 399 | | if constexpr (narrow_integral) { | 400 | | if (tmp < min_result || tmp > max_result) { | 401 | | if (params.is_strict) { | 402 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 403 | | from, int_type_name<FromCppT>, precision, scale); | 404 | | } | 405 | | return false; | 406 | | } | 407 | | } | 408 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 409 | | } | 410 | | | 411 | 0 | return true; | 412 | 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 | 377 | 180 | CastParameters& params) { | 378 | 180 | MaxNativeType tmp; | 379 | | if constexpr (multiply_may_overflow) { | 380 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 381 | | if (params.is_strict) { | 382 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 383 | | precision, scale); | 384 | | } | 385 | | return false; | 386 | | } | 387 | | if constexpr (narrow_integral) { | 388 | | if (tmp < min_result || tmp > max_result) { | 389 | | if (params.is_strict) { | 390 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 391 | | from, int_type_name<FromCppT>, precision, scale); | 392 | | } | 393 | | return false; | 394 | | } | 395 | | } | 396 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 397 | 180 | } else { | 398 | 180 | tmp = scale_multiplier * from; | 399 | 180 | if constexpr (narrow_integral) { | 400 | 180 | if (tmp < min_result || tmp > max_result) { | 401 | 48 | if (params.is_strict) { | 402 | 24 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 403 | 24 | from, int_type_name<FromCppT>, precision, scale); | 404 | 24 | } | 405 | 48 | return false; | 406 | 48 | } | 407 | 180 | } | 408 | 132 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 409 | 180 | } | 410 | | | 411 | 0 | return true; | 412 | 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 | 377 | 224 | CastParameters& params) { | 378 | 224 | MaxNativeType tmp; | 379 | 224 | if constexpr (multiply_may_overflow) { | 380 | 224 | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 381 | 32 | if (params.is_strict) { | 382 | 16 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 383 | 16 | precision, scale); | 384 | 16 | } | 385 | 32 | return false; | 386 | 32 | } | 387 | 192 | if constexpr (narrow_integral) { | 388 | 192 | if (tmp < min_result || tmp > max_result) { | 389 | 32 | if (params.is_strict) { | 390 | 16 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 391 | 16 | from, int_type_name<FromCppT>, precision, scale); | 392 | 16 | } | 393 | 32 | return false; | 394 | 32 | } | 395 | 192 | } | 396 | 160 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 397 | | } else { | 398 | | tmp = scale_multiplier * from; | 399 | | if constexpr (narrow_integral) { | 400 | | if (tmp < min_result || tmp > max_result) { | 401 | | if (params.is_strict) { | 402 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 403 | | from, int_type_name<FromCppT>, precision, scale); | 404 | | } | 405 | | return false; | 406 | | } | 407 | | } | 408 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 409 | | } | 410 | | | 411 | 0 | return true; | 412 | 224 | } |
_ZN5doris13CastToDecimal9_from_intIhNS_12Decimal128V3ELb0ELb0EnQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS3_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRKT3_RKNS3_10NativeTypeESD_RNS_14CastParametersE Line | Count | Source | 377 | 16 | CastParameters& params) { | 378 | 16 | MaxNativeType tmp; | 379 | | if constexpr (multiply_may_overflow) { | 380 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 381 | | if (params.is_strict) { | 382 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 383 | | precision, scale); | 384 | | } | 385 | | return false; | 386 | | } | 387 | | if constexpr (narrow_integral) { | 388 | | if (tmp < min_result || tmp > max_result) { | 389 | | if (params.is_strict) { | 390 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 391 | | from, int_type_name<FromCppT>, precision, scale); | 392 | | } | 393 | | return false; | 394 | | } | 395 | | } | 396 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 397 | 16 | } else { | 398 | 16 | tmp = scale_multiplier * from; | 399 | | if constexpr (narrow_integral) { | 400 | | if (tmp < min_result || tmp > max_result) { | 401 | | if (params.is_strict) { | 402 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 403 | | from, int_type_name<FromCppT>, precision, scale); | 404 | | } | 405 | | return false; | 406 | | } | 407 | | } | 408 | 16 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 409 | 16 | } | 410 | | | 411 | 16 | return true; | 412 | 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 | 377 | 8 | CastParameters& params) { | 378 | 8 | MaxNativeType tmp; | 379 | 8 | if constexpr (multiply_may_overflow) { | 380 | 8 | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 381 | 0 | if (params.is_strict) { | 382 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 383 | 0 | precision, scale); | 384 | 0 | } | 385 | 0 | return false; | 386 | 0 | } | 387 | 8 | if constexpr (narrow_integral) { | 388 | 8 | if (tmp < min_result || tmp > max_result) { | 389 | 4 | if (params.is_strict) { | 390 | 2 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 391 | 2 | from, int_type_name<FromCppT>, precision, scale); | 392 | 2 | } | 393 | 4 | return false; | 394 | 4 | } | 395 | 8 | } | 396 | 4 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 397 | | } else { | 398 | | tmp = scale_multiplier * from; | 399 | | if constexpr (narrow_integral) { | 400 | | if (tmp < min_result || tmp > max_result) { | 401 | | if (params.is_strict) { | 402 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 403 | | from, int_type_name<FromCppT>, precision, scale); | 404 | | } | 405 | | return false; | 406 | | } | 407 | | } | 408 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 409 | | } | 410 | | | 411 | 0 | return true; | 412 | 8 | } |
_ZN5doris13CastToDecimal9_from_intIaNS_12Decimal128V3ELb0ELb0EnQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS3_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRKT3_RKNS3_10NativeTypeESD_RNS_14CastParametersE Line | Count | Source | 377 | 144 | CastParameters& params) { | 378 | 144 | MaxNativeType tmp; | 379 | | if constexpr (multiply_may_overflow) { | 380 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 381 | | if (params.is_strict) { | 382 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 383 | | precision, scale); | 384 | | } | 385 | | return false; | 386 | | } | 387 | | if constexpr (narrow_integral) { | 388 | | if (tmp < min_result || tmp > max_result) { | 389 | | if (params.is_strict) { | 390 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 391 | | from, int_type_name<FromCppT>, precision, scale); | 392 | | } | 393 | | return false; | 394 | | } | 395 | | } | 396 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 397 | 144 | } else { | 398 | 144 | tmp = scale_multiplier * from; | 399 | | if constexpr (narrow_integral) { | 400 | | if (tmp < min_result || tmp > max_result) { | 401 | | if (params.is_strict) { | 402 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 403 | | from, int_type_name<FromCppT>, precision, scale); | 404 | | } | 405 | | return false; | 406 | | } | 407 | | } | 408 | 144 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 409 | 144 | } | 410 | | | 411 | 144 | return true; | 412 | 144 | } |
_ZN5doris13CastToDecimal9_from_intIaNS_12Decimal128V3ELb0ELb1EnQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS3_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRKT3_RKNS3_10NativeTypeESD_RNS_14CastParametersE Line | Count | Source | 377 | 88 | CastParameters& params) { | 378 | 88 | MaxNativeType tmp; | 379 | | if constexpr (multiply_may_overflow) { | 380 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 381 | | if (params.is_strict) { | 382 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 383 | | precision, scale); | 384 | | } | 385 | | return false; | 386 | | } | 387 | | if constexpr (narrow_integral) { | 388 | | if (tmp < min_result || tmp > max_result) { | 389 | | if (params.is_strict) { | 390 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 391 | | from, int_type_name<FromCppT>, precision, scale); | 392 | | } | 393 | | return false; | 394 | | } | 395 | | } | 396 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 397 | 88 | } else { | 398 | 88 | tmp = scale_multiplier * from; | 399 | 88 | if constexpr (narrow_integral) { | 400 | 88 | if (tmp < min_result || tmp > max_result) { | 401 | 32 | if (params.is_strict) { | 402 | 16 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 403 | 16 | from, int_type_name<FromCppT>, precision, scale); | 404 | 16 | } | 405 | 32 | return false; | 406 | 32 | } | 407 | 88 | } | 408 | 56 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 409 | 88 | } | 410 | | | 411 | 0 | return true; | 412 | 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 | 377 | 44 | CastParameters& params) { | 378 | 44 | MaxNativeType tmp; | 379 | 44 | if constexpr (multiply_may_overflow) { | 380 | 44 | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 381 | 8 | if (params.is_strict) { | 382 | 4 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 383 | 4 | precision, scale); | 384 | 4 | } | 385 | 8 | return false; | 386 | 8 | } | 387 | 36 | if constexpr (narrow_integral) { | 388 | 36 | if (tmp < min_result || tmp > max_result) { | 389 | 8 | if (params.is_strict) { | 390 | 4 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 391 | 4 | from, int_type_name<FromCppT>, precision, scale); | 392 | 4 | } | 393 | 8 | return false; | 394 | 8 | } | 395 | 36 | } | 396 | 28 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 397 | | } else { | 398 | | tmp = scale_multiplier * from; | 399 | | if constexpr (narrow_integral) { | 400 | | if (tmp < min_result || tmp > max_result) { | 401 | | if (params.is_strict) { | 402 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 403 | | from, int_type_name<FromCppT>, precision, scale); | 404 | | } | 405 | | return false; | 406 | | } | 407 | | } | 408 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 409 | | } | 410 | | | 411 | 0 | return true; | 412 | 44 | } |
_ZN5doris13CastToDecimal9_from_intIsNS_12Decimal128V3ELb0ELb0EnQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS3_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRKT3_RKNS3_10NativeTypeESD_RNS_14CastParametersE Line | Count | Source | 377 | 144 | CastParameters& params) { | 378 | 144 | MaxNativeType tmp; | 379 | | if constexpr (multiply_may_overflow) { | 380 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 381 | | if (params.is_strict) { | 382 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 383 | | precision, scale); | 384 | | } | 385 | | return false; | 386 | | } | 387 | | if constexpr (narrow_integral) { | 388 | | if (tmp < min_result || tmp > max_result) { | 389 | | if (params.is_strict) { | 390 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 391 | | from, int_type_name<FromCppT>, precision, scale); | 392 | | } | 393 | | return false; | 394 | | } | 395 | | } | 396 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 397 | 144 | } else { | 398 | 144 | tmp = scale_multiplier * from; | 399 | | if constexpr (narrow_integral) { | 400 | | if (tmp < min_result || tmp > max_result) { | 401 | | if (params.is_strict) { | 402 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 403 | | from, int_type_name<FromCppT>, precision, scale); | 404 | | } | 405 | | return false; | 406 | | } | 407 | | } | 408 | 144 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 409 | 144 | } | 410 | | | 411 | 144 | return true; | 412 | 144 | } |
_ZN5doris13CastToDecimal9_from_intIsNS_12Decimal128V3ELb0ELb1EnQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS3_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRKT3_RKNS3_10NativeTypeESD_RNS_14CastParametersE Line | Count | Source | 377 | 88 | CastParameters& params) { | 378 | 88 | MaxNativeType tmp; | 379 | | if constexpr (multiply_may_overflow) { | 380 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 381 | | if (params.is_strict) { | 382 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 383 | | precision, scale); | 384 | | } | 385 | | return false; | 386 | | } | 387 | | if constexpr (narrow_integral) { | 388 | | if (tmp < min_result || tmp > max_result) { | 389 | | if (params.is_strict) { | 390 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 391 | | from, int_type_name<FromCppT>, precision, scale); | 392 | | } | 393 | | return false; | 394 | | } | 395 | | } | 396 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 397 | 88 | } else { | 398 | 88 | tmp = scale_multiplier * from; | 399 | 88 | if constexpr (narrow_integral) { | 400 | 88 | if (tmp < min_result || tmp > max_result) { | 401 | 32 | if (params.is_strict) { | 402 | 16 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 403 | 16 | from, int_type_name<FromCppT>, precision, scale); | 404 | 16 | } | 405 | 32 | return false; | 406 | 32 | } | 407 | 88 | } | 408 | 56 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 409 | 88 | } | 410 | | | 411 | 0 | return true; | 412 | 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 | 377 | 44 | CastParameters& params) { | 378 | 44 | MaxNativeType tmp; | 379 | 44 | if constexpr (multiply_may_overflow) { | 380 | 44 | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 381 | 8 | if (params.is_strict) { | 382 | 4 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 383 | 4 | precision, scale); | 384 | 4 | } | 385 | 8 | return false; | 386 | 8 | } | 387 | 36 | if constexpr (narrow_integral) { | 388 | 36 | if (tmp < min_result || tmp > max_result) { | 389 | 8 | if (params.is_strict) { | 390 | 4 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 391 | 4 | from, int_type_name<FromCppT>, precision, scale); | 392 | 4 | } | 393 | 8 | return false; | 394 | 8 | } | 395 | 36 | } | 396 | 28 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 397 | | } else { | 398 | | tmp = scale_multiplier * from; | 399 | | if constexpr (narrow_integral) { | 400 | | if (tmp < min_result || tmp > max_result) { | 401 | | if (params.is_strict) { | 402 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 403 | | from, int_type_name<FromCppT>, precision, scale); | 404 | | } | 405 | | return false; | 406 | | } | 407 | | } | 408 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 409 | | } | 410 | | | 411 | 0 | return true; | 412 | 44 | } |
_ZN5doris13CastToDecimal9_from_intIiNS_12Decimal128V3ELb0ELb0EnQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS3_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRKT3_RKNS3_10NativeTypeESD_RNS_14CastParametersE Line | Count | Source | 377 | 144 | CastParameters& params) { | 378 | 144 | MaxNativeType tmp; | 379 | | if constexpr (multiply_may_overflow) { | 380 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 381 | | if (params.is_strict) { | 382 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 383 | | precision, scale); | 384 | | } | 385 | | return false; | 386 | | } | 387 | | if constexpr (narrow_integral) { | 388 | | if (tmp < min_result || tmp > max_result) { | 389 | | if (params.is_strict) { | 390 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 391 | | from, int_type_name<FromCppT>, precision, scale); | 392 | | } | 393 | | return false; | 394 | | } | 395 | | } | 396 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 397 | 144 | } else { | 398 | 144 | tmp = scale_multiplier * from; | 399 | | if constexpr (narrow_integral) { | 400 | | if (tmp < min_result || tmp > max_result) { | 401 | | if (params.is_strict) { | 402 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 403 | | from, int_type_name<FromCppT>, precision, scale); | 404 | | } | 405 | | return false; | 406 | | } | 407 | | } | 408 | 144 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 409 | 144 | } | 410 | | | 411 | 144 | return true; | 412 | 144 | } |
_ZN5doris13CastToDecimal9_from_intIiNS_12Decimal128V3ELb0ELb1EnQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS3_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRKT3_RKNS3_10NativeTypeESD_RNS_14CastParametersE Line | Count | Source | 377 | 88 | CastParameters& params) { | 378 | 88 | MaxNativeType tmp; | 379 | | if constexpr (multiply_may_overflow) { | 380 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 381 | | if (params.is_strict) { | 382 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 383 | | precision, scale); | 384 | | } | 385 | | return false; | 386 | | } | 387 | | if constexpr (narrow_integral) { | 388 | | if (tmp < min_result || tmp > max_result) { | 389 | | if (params.is_strict) { | 390 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 391 | | from, int_type_name<FromCppT>, precision, scale); | 392 | | } | 393 | | return false; | 394 | | } | 395 | | } | 396 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 397 | 88 | } else { | 398 | 88 | tmp = scale_multiplier * from; | 399 | 88 | if constexpr (narrow_integral) { | 400 | 88 | if (tmp < min_result || tmp > max_result) { | 401 | 32 | if (params.is_strict) { | 402 | 16 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 403 | 16 | from, int_type_name<FromCppT>, precision, scale); | 404 | 16 | } | 405 | 32 | return false; | 406 | 32 | } | 407 | 88 | } | 408 | 56 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 409 | 88 | } | 410 | | | 411 | 0 | return true; | 412 | 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 | 377 | 44 | CastParameters& params) { | 378 | 44 | MaxNativeType tmp; | 379 | 44 | if constexpr (multiply_may_overflow) { | 380 | 44 | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 381 | 8 | if (params.is_strict) { | 382 | 4 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 383 | 4 | precision, scale); | 384 | 4 | } | 385 | 8 | return false; | 386 | 8 | } | 387 | 36 | if constexpr (narrow_integral) { | 388 | 36 | if (tmp < min_result || tmp > max_result) { | 389 | 8 | if (params.is_strict) { | 390 | 4 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 391 | 4 | from, int_type_name<FromCppT>, precision, scale); | 392 | 4 | } | 393 | 8 | return false; | 394 | 8 | } | 395 | 36 | } | 396 | 28 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 397 | | } else { | 398 | | tmp = scale_multiplier * from; | 399 | | if constexpr (narrow_integral) { | 400 | | if (tmp < min_result || tmp > max_result) { | 401 | | if (params.is_strict) { | 402 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 403 | | from, int_type_name<FromCppT>, precision, scale); | 404 | | } | 405 | | return false; | 406 | | } | 407 | | } | 408 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 409 | | } | 410 | | | 411 | 0 | return true; | 412 | 44 | } |
_ZN5doris13CastToDecimal9_from_intIlNS_12Decimal128V3ELb0ELb0EnQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS3_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRKT3_RKNS3_10NativeTypeESD_RNS_14CastParametersE Line | Count | Source | 377 | 108 | CastParameters& params) { | 378 | 108 | MaxNativeType tmp; | 379 | | if constexpr (multiply_may_overflow) { | 380 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 381 | | if (params.is_strict) { | 382 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 383 | | precision, scale); | 384 | | } | 385 | | return false; | 386 | | } | 387 | | if constexpr (narrow_integral) { | 388 | | if (tmp < min_result || tmp > max_result) { | 389 | | if (params.is_strict) { | 390 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 391 | | from, int_type_name<FromCppT>, precision, scale); | 392 | | } | 393 | | return false; | 394 | | } | 395 | | } | 396 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 397 | 108 | } else { | 398 | 108 | tmp = scale_multiplier * from; | 399 | | if constexpr (narrow_integral) { | 400 | | if (tmp < min_result || tmp > max_result) { | 401 | | if (params.is_strict) { | 402 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 403 | | from, int_type_name<FromCppT>, precision, scale); | 404 | | } | 405 | | return false; | 406 | | } | 407 | | } | 408 | 108 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 409 | 108 | } | 410 | | | 411 | 108 | return true; | 412 | 108 | } |
_ZN5doris13CastToDecimal9_from_intIlNS_12Decimal128V3ELb0ELb1EnQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS3_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRKT3_RKNS3_10NativeTypeESD_RNS_14CastParametersE Line | Count | Source | 377 | 156 | CastParameters& params) { | 378 | 156 | MaxNativeType tmp; | 379 | | if constexpr (multiply_may_overflow) { | 380 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 381 | | if (params.is_strict) { | 382 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 383 | | precision, scale); | 384 | | } | 385 | | return false; | 386 | | } | 387 | | if constexpr (narrow_integral) { | 388 | | if (tmp < min_result || tmp > max_result) { | 389 | | if (params.is_strict) { | 390 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 391 | | from, int_type_name<FromCppT>, precision, scale); | 392 | | } | 393 | | return false; | 394 | | } | 395 | | } | 396 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 397 | 156 | } else { | 398 | 156 | tmp = scale_multiplier * from; | 399 | 156 | if constexpr (narrow_integral) { | 400 | 156 | if (tmp < min_result || tmp > max_result) { | 401 | 48 | if (params.is_strict) { | 402 | 24 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 403 | 24 | from, int_type_name<FromCppT>, precision, scale); | 404 | 24 | } | 405 | 48 | return false; | 406 | 48 | } | 407 | 156 | } | 408 | 108 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 409 | 156 | } | 410 | | | 411 | 0 | return true; | 412 | 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 | 377 | 44 | CastParameters& params) { | 378 | 44 | MaxNativeType tmp; | 379 | 44 | if constexpr (multiply_may_overflow) { | 380 | 44 | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 381 | 8 | if (params.is_strict) { | 382 | 4 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 383 | 4 | precision, scale); | 384 | 4 | } | 385 | 8 | return false; | 386 | 8 | } | 387 | 36 | if constexpr (narrow_integral) { | 388 | 36 | if (tmp < min_result || tmp > max_result) { | 389 | 8 | if (params.is_strict) { | 390 | 4 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 391 | 4 | from, int_type_name<FromCppT>, precision, scale); | 392 | 4 | } | 393 | 8 | return false; | 394 | 8 | } | 395 | 36 | } | 396 | 28 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 397 | | } else { | 398 | | tmp = scale_multiplier * from; | 399 | | if constexpr (narrow_integral) { | 400 | | if (tmp < min_result || tmp > max_result) { | 401 | | if (params.is_strict) { | 402 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 403 | | from, int_type_name<FromCppT>, precision, scale); | 404 | | } | 405 | | return false; | 406 | | } | 407 | | } | 408 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 409 | | } | 410 | | | 411 | 0 | return true; | 412 | 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 | 377 | 180 | CastParameters& params) { | 378 | 180 | MaxNativeType tmp; | 379 | | if constexpr (multiply_may_overflow) { | 380 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 381 | | if (params.is_strict) { | 382 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 383 | | precision, scale); | 384 | | } | 385 | | return false; | 386 | | } | 387 | | if constexpr (narrow_integral) { | 388 | | if (tmp < min_result || tmp > max_result) { | 389 | | if (params.is_strict) { | 390 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 391 | | from, int_type_name<FromCppT>, precision, scale); | 392 | | } | 393 | | return false; | 394 | | } | 395 | | } | 396 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 397 | 180 | } else { | 398 | 180 | tmp = scale_multiplier * from; | 399 | 180 | if constexpr (narrow_integral) { | 400 | 180 | if (tmp < min_result || tmp > max_result) { | 401 | 48 | if (params.is_strict) { | 402 | 24 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 403 | 24 | from, int_type_name<FromCppT>, precision, scale); | 404 | 24 | } | 405 | 48 | return false; | 406 | 48 | } | 407 | 180 | } | 408 | 132 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 409 | 180 | } | 410 | | | 411 | 0 | return true; | 412 | 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 | 377 | 224 | CastParameters& params) { | 378 | 224 | MaxNativeType tmp; | 379 | 224 | if constexpr (multiply_may_overflow) { | 380 | 224 | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 381 | 32 | if (params.is_strict) { | 382 | 16 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 383 | 16 | precision, scale); | 384 | 16 | } | 385 | 32 | return false; | 386 | 32 | } | 387 | 192 | if constexpr (narrow_integral) { | 388 | 192 | if (tmp < min_result || tmp > max_result) { | 389 | 32 | if (params.is_strict) { | 390 | 16 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 391 | 16 | from, int_type_name<FromCppT>, precision, scale); | 392 | 16 | } | 393 | 32 | return false; | 394 | 32 | } | 395 | 192 | } | 396 | 160 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 397 | | } else { | 398 | | tmp = scale_multiplier * from; | 399 | | if constexpr (narrow_integral) { | 400 | | if (tmp < min_result || tmp > max_result) { | 401 | | if (params.is_strict) { | 402 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 403 | | from, int_type_name<FromCppT>, precision, scale); | 404 | | } | 405 | | return false; | 406 | | } | 407 | | } | 408 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 409 | | } | 410 | | | 411 | 0 | return true; | 412 | 224 | } |
_ZN5doris13CastToDecimal9_from_intIhNS_7DecimalIN4wide7integerILm256EiEEEELb0ELb0ES5_Qaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS7_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS8_hEEEbRKS8_RS7_jjRKT3_RKNS7_10NativeTypeESH_RNS_14CastParametersE Line | Count | Source | 377 | 16 | CastParameters& params) { | 378 | 16 | MaxNativeType tmp; | 379 | | if constexpr (multiply_may_overflow) { | 380 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 381 | | if (params.is_strict) { | 382 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 383 | | precision, scale); | 384 | | } | 385 | | return false; | 386 | | } | 387 | | if constexpr (narrow_integral) { | 388 | | if (tmp < min_result || tmp > max_result) { | 389 | | if (params.is_strict) { | 390 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 391 | | from, int_type_name<FromCppT>, precision, scale); | 392 | | } | 393 | | return false; | 394 | | } | 395 | | } | 396 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 397 | 16 | } else { | 398 | 16 | tmp = scale_multiplier * from; | 399 | | if constexpr (narrow_integral) { | 400 | | if (tmp < min_result || tmp > max_result) { | 401 | | if (params.is_strict) { | 402 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 403 | | from, int_type_name<FromCppT>, precision, scale); | 404 | | } | 405 | | return false; | 406 | | } | 407 | | } | 408 | 16 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 409 | 16 | } | 410 | | | 411 | 16 | return true; | 412 | 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 | 377 | 8 | CastParameters& params) { | 378 | 8 | MaxNativeType tmp; | 379 | 8 | if constexpr (multiply_may_overflow) { | 380 | 8 | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 381 | 0 | if (params.is_strict) { | 382 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 383 | 0 | precision, scale); | 384 | 0 | } | 385 | 0 | return false; | 386 | 0 | } | 387 | 8 | if constexpr (narrow_integral) { | 388 | 8 | if (tmp < min_result || tmp > max_result) { | 389 | 4 | if (params.is_strict) { | 390 | 2 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 391 | 2 | from, int_type_name<FromCppT>, precision, scale); | 392 | 2 | } | 393 | 4 | return false; | 394 | 4 | } | 395 | 8 | } | 396 | 4 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 397 | | } else { | 398 | | tmp = scale_multiplier * from; | 399 | | if constexpr (narrow_integral) { | 400 | | if (tmp < min_result || tmp > max_result) { | 401 | | if (params.is_strict) { | 402 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 403 | | from, int_type_name<FromCppT>, precision, scale); | 404 | | } | 405 | | return false; | 406 | | } | 407 | | } | 408 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 409 | | } | 410 | | | 411 | 0 | return true; | 412 | 8 | } |
_ZN5doris13CastToDecimal9_from_intIaNS_7DecimalIN4wide7integerILm256EiEEEELb0ELb0ES5_Qaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS7_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS8_hEEEbRKS8_RS7_jjRKT3_RKNS7_10NativeTypeESH_RNS_14CastParametersE Line | Count | Source | 377 | 144 | CastParameters& params) { | 378 | 144 | MaxNativeType tmp; | 379 | | if constexpr (multiply_may_overflow) { | 380 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 381 | | if (params.is_strict) { | 382 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 383 | | precision, scale); | 384 | | } | 385 | | return false; | 386 | | } | 387 | | if constexpr (narrow_integral) { | 388 | | if (tmp < min_result || tmp > max_result) { | 389 | | if (params.is_strict) { | 390 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 391 | | from, int_type_name<FromCppT>, precision, scale); | 392 | | } | 393 | | return false; | 394 | | } | 395 | | } | 396 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 397 | 144 | } else { | 398 | 144 | tmp = scale_multiplier * from; | 399 | | if constexpr (narrow_integral) { | 400 | | if (tmp < min_result || tmp > max_result) { | 401 | | if (params.is_strict) { | 402 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 403 | | from, int_type_name<FromCppT>, precision, scale); | 404 | | } | 405 | | return false; | 406 | | } | 407 | | } | 408 | 144 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 409 | 144 | } | 410 | | | 411 | 144 | return true; | 412 | 144 | } |
_ZN5doris13CastToDecimal9_from_intIaNS_7DecimalIN4wide7integerILm256EiEEEELb0ELb1ES5_Qaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS7_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS8_hEEEbRKS8_RS7_jjRKT3_RKNS7_10NativeTypeESH_RNS_14CastParametersE Line | Count | Source | 377 | 88 | CastParameters& params) { | 378 | 88 | MaxNativeType tmp; | 379 | | if constexpr (multiply_may_overflow) { | 380 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 381 | | if (params.is_strict) { | 382 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 383 | | precision, scale); | 384 | | } | 385 | | return false; | 386 | | } | 387 | | if constexpr (narrow_integral) { | 388 | | if (tmp < min_result || tmp > max_result) { | 389 | | if (params.is_strict) { | 390 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 391 | | from, int_type_name<FromCppT>, precision, scale); | 392 | | } | 393 | | return false; | 394 | | } | 395 | | } | 396 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 397 | 88 | } else { | 398 | 88 | tmp = scale_multiplier * from; | 399 | 88 | if constexpr (narrow_integral) { | 400 | 88 | if (tmp < min_result || tmp > max_result) { | 401 | 32 | if (params.is_strict) { | 402 | 16 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 403 | 16 | from, int_type_name<FromCppT>, precision, scale); | 404 | 16 | } | 405 | 32 | return false; | 406 | 32 | } | 407 | 88 | } | 408 | 56 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 409 | 88 | } | 410 | | | 411 | 0 | return true; | 412 | 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 | 377 | 44 | CastParameters& params) { | 378 | 44 | MaxNativeType tmp; | 379 | 44 | if constexpr (multiply_may_overflow) { | 380 | 44 | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 381 | 8 | if (params.is_strict) { | 382 | 4 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 383 | 4 | precision, scale); | 384 | 4 | } | 385 | 8 | return false; | 386 | 8 | } | 387 | 36 | if constexpr (narrow_integral) { | 388 | 36 | if (tmp < min_result || tmp > max_result) { | 389 | 8 | if (params.is_strict) { | 390 | 4 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 391 | 4 | from, int_type_name<FromCppT>, precision, scale); | 392 | 4 | } | 393 | 8 | return false; | 394 | 8 | } | 395 | 36 | } | 396 | 28 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 397 | | } else { | 398 | | tmp = scale_multiplier * from; | 399 | | if constexpr (narrow_integral) { | 400 | | if (tmp < min_result || tmp > max_result) { | 401 | | if (params.is_strict) { | 402 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 403 | | from, int_type_name<FromCppT>, precision, scale); | 404 | | } | 405 | | return false; | 406 | | } | 407 | | } | 408 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 409 | | } | 410 | | | 411 | 0 | return true; | 412 | 44 | } |
_ZN5doris13CastToDecimal9_from_intIsNS_7DecimalIN4wide7integerILm256EiEEEELb0ELb0ES5_Qaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS7_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS8_hEEEbRKS8_RS7_jjRKT3_RKNS7_10NativeTypeESH_RNS_14CastParametersE Line | Count | Source | 377 | 144 | CastParameters& params) { | 378 | 144 | MaxNativeType tmp; | 379 | | if constexpr (multiply_may_overflow) { | 380 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 381 | | if (params.is_strict) { | 382 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 383 | | precision, scale); | 384 | | } | 385 | | return false; | 386 | | } | 387 | | if constexpr (narrow_integral) { | 388 | | if (tmp < min_result || tmp > max_result) { | 389 | | if (params.is_strict) { | 390 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 391 | | from, int_type_name<FromCppT>, precision, scale); | 392 | | } | 393 | | return false; | 394 | | } | 395 | | } | 396 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 397 | 144 | } else { | 398 | 144 | tmp = scale_multiplier * from; | 399 | | if constexpr (narrow_integral) { | 400 | | if (tmp < min_result || tmp > max_result) { | 401 | | if (params.is_strict) { | 402 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 403 | | from, int_type_name<FromCppT>, precision, scale); | 404 | | } | 405 | | return false; | 406 | | } | 407 | | } | 408 | 144 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 409 | 144 | } | 410 | | | 411 | 144 | return true; | 412 | 144 | } |
_ZN5doris13CastToDecimal9_from_intIsNS_7DecimalIN4wide7integerILm256EiEEEELb0ELb1ES5_Qaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS7_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS8_hEEEbRKS8_RS7_jjRKT3_RKNS7_10NativeTypeESH_RNS_14CastParametersE Line | Count | Source | 377 | 88 | CastParameters& params) { | 378 | 88 | MaxNativeType tmp; | 379 | | if constexpr (multiply_may_overflow) { | 380 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 381 | | if (params.is_strict) { | 382 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 383 | | precision, scale); | 384 | | } | 385 | | return false; | 386 | | } | 387 | | if constexpr (narrow_integral) { | 388 | | if (tmp < min_result || tmp > max_result) { | 389 | | if (params.is_strict) { | 390 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 391 | | from, int_type_name<FromCppT>, precision, scale); | 392 | | } | 393 | | return false; | 394 | | } | 395 | | } | 396 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 397 | 88 | } else { | 398 | 88 | tmp = scale_multiplier * from; | 399 | 88 | if constexpr (narrow_integral) { | 400 | 88 | if (tmp < min_result || tmp > max_result) { | 401 | 32 | if (params.is_strict) { | 402 | 16 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 403 | 16 | from, int_type_name<FromCppT>, precision, scale); | 404 | 16 | } | 405 | 32 | return false; | 406 | 32 | } | 407 | 88 | } | 408 | 56 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 409 | 88 | } | 410 | | | 411 | 0 | return true; | 412 | 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 | 377 | 44 | CastParameters& params) { | 378 | 44 | MaxNativeType tmp; | 379 | 44 | if constexpr (multiply_may_overflow) { | 380 | 44 | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 381 | 8 | if (params.is_strict) { | 382 | 4 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 383 | 4 | precision, scale); | 384 | 4 | } | 385 | 8 | return false; | 386 | 8 | } | 387 | 36 | if constexpr (narrow_integral) { | 388 | 36 | if (tmp < min_result || tmp > max_result) { | 389 | 8 | if (params.is_strict) { | 390 | 4 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 391 | 4 | from, int_type_name<FromCppT>, precision, scale); | 392 | 4 | } | 393 | 8 | return false; | 394 | 8 | } | 395 | 36 | } | 396 | 28 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 397 | | } else { | 398 | | tmp = scale_multiplier * from; | 399 | | if constexpr (narrow_integral) { | 400 | | if (tmp < min_result || tmp > max_result) { | 401 | | if (params.is_strict) { | 402 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 403 | | from, int_type_name<FromCppT>, precision, scale); | 404 | | } | 405 | | return false; | 406 | | } | 407 | | } | 408 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 409 | | } | 410 | | | 411 | 0 | return true; | 412 | 44 | } |
_ZN5doris13CastToDecimal9_from_intIiNS_7DecimalIN4wide7integerILm256EiEEEELb0ELb0ES5_Qaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS7_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS8_hEEEbRKS8_RS7_jjRKT3_RKNS7_10NativeTypeESH_RNS_14CastParametersE Line | Count | Source | 377 | 144 | CastParameters& params) { | 378 | 144 | MaxNativeType tmp; | 379 | | if constexpr (multiply_may_overflow) { | 380 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 381 | | if (params.is_strict) { | 382 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 383 | | precision, scale); | 384 | | } | 385 | | return false; | 386 | | } | 387 | | if constexpr (narrow_integral) { | 388 | | if (tmp < min_result || tmp > max_result) { | 389 | | if (params.is_strict) { | 390 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 391 | | from, int_type_name<FromCppT>, precision, scale); | 392 | | } | 393 | | return false; | 394 | | } | 395 | | } | 396 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 397 | 144 | } else { | 398 | 144 | tmp = scale_multiplier * from; | 399 | | if constexpr (narrow_integral) { | 400 | | if (tmp < min_result || tmp > max_result) { | 401 | | if (params.is_strict) { | 402 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 403 | | from, int_type_name<FromCppT>, precision, scale); | 404 | | } | 405 | | return false; | 406 | | } | 407 | | } | 408 | 144 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 409 | 144 | } | 410 | | | 411 | 144 | return true; | 412 | 144 | } |
_ZN5doris13CastToDecimal9_from_intIiNS_7DecimalIN4wide7integerILm256EiEEEELb0ELb1ES5_Qaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS7_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS8_hEEEbRKS8_RS7_jjRKT3_RKNS7_10NativeTypeESH_RNS_14CastParametersE Line | Count | Source | 377 | 88 | CastParameters& params) { | 378 | 88 | MaxNativeType tmp; | 379 | | if constexpr (multiply_may_overflow) { | 380 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 381 | | if (params.is_strict) { | 382 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 383 | | precision, scale); | 384 | | } | 385 | | return false; | 386 | | } | 387 | | if constexpr (narrow_integral) { | 388 | | if (tmp < min_result || tmp > max_result) { | 389 | | if (params.is_strict) { | 390 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 391 | | from, int_type_name<FromCppT>, precision, scale); | 392 | | } | 393 | | return false; | 394 | | } | 395 | | } | 396 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 397 | 88 | } else { | 398 | 88 | tmp = scale_multiplier * from; | 399 | 88 | if constexpr (narrow_integral) { | 400 | 88 | if (tmp < min_result || tmp > max_result) { | 401 | 32 | if (params.is_strict) { | 402 | 16 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 403 | 16 | from, int_type_name<FromCppT>, precision, scale); | 404 | 16 | } | 405 | 32 | return false; | 406 | 32 | } | 407 | 88 | } | 408 | 56 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 409 | 88 | } | 410 | | | 411 | 0 | return true; | 412 | 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 | 377 | 44 | CastParameters& params) { | 378 | 44 | MaxNativeType tmp; | 379 | 44 | if constexpr (multiply_may_overflow) { | 380 | 44 | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 381 | 8 | if (params.is_strict) { | 382 | 4 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 383 | 4 | precision, scale); | 384 | 4 | } | 385 | 8 | return false; | 386 | 8 | } | 387 | 36 | if constexpr (narrow_integral) { | 388 | 36 | if (tmp < min_result || tmp > max_result) { | 389 | 8 | if (params.is_strict) { | 390 | 4 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 391 | 4 | from, int_type_name<FromCppT>, precision, scale); | 392 | 4 | } | 393 | 8 | return false; | 394 | 8 | } | 395 | 36 | } | 396 | 28 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 397 | | } else { | 398 | | tmp = scale_multiplier * from; | 399 | | if constexpr (narrow_integral) { | 400 | | if (tmp < min_result || tmp > max_result) { | 401 | | if (params.is_strict) { | 402 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 403 | | from, int_type_name<FromCppT>, precision, scale); | 404 | | } | 405 | | return false; | 406 | | } | 407 | | } | 408 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 409 | | } | 410 | | | 411 | 0 | return true; | 412 | 44 | } |
_ZN5doris13CastToDecimal9_from_intIlNS_7DecimalIN4wide7integerILm256EiEEEELb0ELb0ES5_Qaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS7_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS8_hEEEbRKS8_RS7_jjRKT3_RKNS7_10NativeTypeESH_RNS_14CastParametersE Line | Count | Source | 377 | 144 | CastParameters& params) { | 378 | 144 | MaxNativeType tmp; | 379 | | if constexpr (multiply_may_overflow) { | 380 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 381 | | if (params.is_strict) { | 382 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 383 | | precision, scale); | 384 | | } | 385 | | return false; | 386 | | } | 387 | | if constexpr (narrow_integral) { | 388 | | if (tmp < min_result || tmp > max_result) { | 389 | | if (params.is_strict) { | 390 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 391 | | from, int_type_name<FromCppT>, precision, scale); | 392 | | } | 393 | | return false; | 394 | | } | 395 | | } | 396 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 397 | 144 | } else { | 398 | 144 | tmp = scale_multiplier * from; | 399 | | if constexpr (narrow_integral) { | 400 | | if (tmp < min_result || tmp > max_result) { | 401 | | if (params.is_strict) { | 402 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 403 | | from, int_type_name<FromCppT>, precision, scale); | 404 | | } | 405 | | return false; | 406 | | } | 407 | | } | 408 | 144 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 409 | 144 | } | 410 | | | 411 | 144 | return true; | 412 | 144 | } |
_ZN5doris13CastToDecimal9_from_intIlNS_7DecimalIN4wide7integerILm256EiEEEELb0ELb1ES5_Qaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS7_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS8_hEEEbRKS8_RS7_jjRKT3_RKNS7_10NativeTypeESH_RNS_14CastParametersE Line | Count | Source | 377 | 88 | CastParameters& params) { | 378 | 88 | MaxNativeType tmp; | 379 | | if constexpr (multiply_may_overflow) { | 380 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 381 | | if (params.is_strict) { | 382 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 383 | | precision, scale); | 384 | | } | 385 | | return false; | 386 | | } | 387 | | if constexpr (narrow_integral) { | 388 | | if (tmp < min_result || tmp > max_result) { | 389 | | if (params.is_strict) { | 390 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 391 | | from, int_type_name<FromCppT>, precision, scale); | 392 | | } | 393 | | return false; | 394 | | } | 395 | | } | 396 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 397 | 88 | } else { | 398 | 88 | tmp = scale_multiplier * from; | 399 | 88 | if constexpr (narrow_integral) { | 400 | 88 | if (tmp < min_result || tmp > max_result) { | 401 | 32 | if (params.is_strict) { | 402 | 16 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 403 | 16 | from, int_type_name<FromCppT>, precision, scale); | 404 | 16 | } | 405 | 32 | return false; | 406 | 32 | } | 407 | 88 | } | 408 | 56 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 409 | 88 | } | 410 | | | 411 | 0 | return true; | 412 | 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 | 377 | 44 | CastParameters& params) { | 378 | 44 | MaxNativeType tmp; | 379 | 44 | if constexpr (multiply_may_overflow) { | 380 | 44 | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 381 | 8 | if (params.is_strict) { | 382 | 4 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 383 | 4 | precision, scale); | 384 | 4 | } | 385 | 8 | return false; | 386 | 8 | } | 387 | 36 | if constexpr (narrow_integral) { | 388 | 36 | if (tmp < min_result || tmp > max_result) { | 389 | 8 | if (params.is_strict) { | 390 | 4 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 391 | 4 | from, int_type_name<FromCppT>, precision, scale); | 392 | 4 | } | 393 | 8 | return false; | 394 | 8 | } | 395 | 36 | } | 396 | 28 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 397 | | } else { | 398 | | tmp = scale_multiplier * from; | 399 | | if constexpr (narrow_integral) { | 400 | | if (tmp < min_result || tmp > max_result) { | 401 | | if (params.is_strict) { | 402 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 403 | | from, int_type_name<FromCppT>, precision, scale); | 404 | | } | 405 | | return false; | 406 | | } | 407 | | } | 408 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 409 | | } | 410 | | | 411 | 0 | return true; | 412 | 44 | } |
_ZN5doris13CastToDecimal9_from_intInNS_7DecimalIN4wide7integerILm256EiEEEELb0ELb0ES5_Qaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS7_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS8_hEEEbRKS8_RS7_jjRKT3_RKNS7_10NativeTypeESH_RNS_14CastParametersE Line | Count | Source | 377 | 36 | CastParameters& params) { | 378 | 36 | MaxNativeType tmp; | 379 | | if constexpr (multiply_may_overflow) { | 380 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 381 | | if (params.is_strict) { | 382 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 383 | | precision, scale); | 384 | | } | 385 | | return false; | 386 | | } | 387 | | if constexpr (narrow_integral) { | 388 | | if (tmp < min_result || tmp > max_result) { | 389 | | if (params.is_strict) { | 390 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 391 | | from, int_type_name<FromCppT>, precision, scale); | 392 | | } | 393 | | return false; | 394 | | } | 395 | | } | 396 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 397 | 36 | } else { | 398 | 36 | tmp = scale_multiplier * from; | 399 | | if constexpr (narrow_integral) { | 400 | | if (tmp < min_result || tmp > max_result) { | 401 | | if (params.is_strict) { | 402 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 403 | | from, int_type_name<FromCppT>, precision, scale); | 404 | | } | 405 | | return false; | 406 | | } | 407 | | } | 408 | 36 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 409 | 36 | } | 410 | | | 411 | 36 | return true; | 412 | 36 | } |
_ZN5doris13CastToDecimal9_from_intInNS_7DecimalIN4wide7integerILm256EiEEEELb0ELb1ES5_Qaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS7_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS8_hEEEbRKS8_RS7_jjRKT3_RKNS7_10NativeTypeESH_RNS_14CastParametersE Line | Count | Source | 377 | 224 | CastParameters& params) { | 378 | 224 | MaxNativeType tmp; | 379 | | if constexpr (multiply_may_overflow) { | 380 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 381 | | if (params.is_strict) { | 382 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 383 | | precision, scale); | 384 | | } | 385 | | return false; | 386 | | } | 387 | | if constexpr (narrow_integral) { | 388 | | if (tmp < min_result || tmp > max_result) { | 389 | | if (params.is_strict) { | 390 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 391 | | from, int_type_name<FromCppT>, precision, scale); | 392 | | } | 393 | | return false; | 394 | | } | 395 | | } | 396 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 397 | 224 | } else { | 398 | 224 | tmp = scale_multiplier * from; | 399 | 224 | if constexpr (narrow_integral) { | 400 | 224 | if (tmp < min_result || tmp > max_result) { | 401 | 64 | if (params.is_strict) { | 402 | 32 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 403 | 32 | from, int_type_name<FromCppT>, precision, scale); | 404 | 32 | } | 405 | 64 | return false; | 406 | 64 | } | 407 | 224 | } | 408 | 160 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 409 | 224 | } | 410 | | | 411 | 0 | return true; | 412 | 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 | 377 | 112 | CastParameters& params) { | 378 | 112 | MaxNativeType tmp; | 379 | 112 | if constexpr (multiply_may_overflow) { | 380 | 112 | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 381 | 8 | if (params.is_strict) { | 382 | 4 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 383 | 4 | precision, scale); | 384 | 4 | } | 385 | 8 | return false; | 386 | 8 | } | 387 | 104 | if constexpr (narrow_integral) { | 388 | 104 | if (tmp < min_result || tmp > max_result) { | 389 | 24 | if (params.is_strict) { | 390 | 12 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 391 | 12 | from, int_type_name<FromCppT>, precision, scale); | 392 | 12 | } | 393 | 24 | return false; | 394 | 24 | } | 395 | 104 | } | 396 | 80 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 397 | | } else { | 398 | | tmp = scale_multiplier * from; | 399 | | if constexpr (narrow_integral) { | 400 | | if (tmp < min_result || tmp > max_result) { | 401 | | if (params.is_strict) { | 402 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 403 | | from, int_type_name<FromCppT>, precision, scale); | 404 | | } | 405 | | return false; | 406 | | } | 407 | | } | 408 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 409 | | } | 410 | | | 411 | 0 | return true; | 412 | 112 | } |
|
413 | | |
414 | | template <typename FromCppT, typename ToCppT, bool multiply_may_overflow, bool narrow_integral, |
415 | | typename MaxNativeType = |
416 | | std::conditional_t<(sizeof(FromCppT) > sizeof(typename ToCppT::NativeType)), |
417 | | FromCppT, typename ToCppT::NativeType>> |
418 | | requires(IsDecimalV2<ToCppT> && (IsCppTypeInt<FromCppT> || std::is_same_v<FromCppT, UInt8>)) |
419 | | static inline bool _from_int(const FromCppT& from, ToCppT& to, UInt32 precision, UInt32 scale, |
420 | | const MaxNativeType& scale_multiplier, |
421 | | const typename ToCppT::NativeType& min_result, |
422 | | const typename ToCppT::NativeType& max_result, |
423 | 12 | CastParameters& params) { |
424 | 12 | MaxNativeType tmp; |
425 | 12 | if constexpr (multiply_may_overflow) { |
426 | 0 | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { |
427 | 0 | if (params.is_strict) { |
428 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, |
429 | 0 | precision, scale); |
430 | 0 | } |
431 | 0 | return false; |
432 | 0 | } |
433 | 0 | if constexpr (narrow_integral) { |
434 | 0 | if (tmp < min_result || tmp > max_result) { |
435 | 0 | if (params.is_strict) { |
436 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( |
437 | 0 | from, int_type_name<FromCppT>, precision, scale); |
438 | 0 | } |
439 | 0 | return false; |
440 | 0 | } |
441 | 0 | } |
442 | 0 | to = DecimalV2Value(static_cast<typename ToCppT::NativeType>(tmp)); |
443 | 12 | } else { |
444 | 12 | tmp = scale_multiplier * from; |
445 | 12 | if constexpr (narrow_integral) { |
446 | 8 | if (tmp < min_result || tmp > max_result) { |
447 | 4 | if (params.is_strict) { |
448 | 2 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( |
449 | 2 | from, int_type_name<FromCppT>, precision, scale); |
450 | 2 | } |
451 | 4 | return false; |
452 | 4 | } |
453 | 8 | } |
454 | 4 | to = DecimalV2Value(static_cast<typename ToCppT::NativeType>(tmp)); |
455 | 12 | } |
456 | | |
457 | 0 | return true; |
458 | 12 | } _ZN5doris13CastToDecimal9_from_intIhNS_14DecimalV2ValueELb0ELb0EnQaa11IsDecimalV2IT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRKT3_RKNS3_10NativeTypeESD_RNS_14CastParametersE Line | Count | Source | 423 | 4 | CastParameters& params) { | 424 | 4 | MaxNativeType tmp; | 425 | | if constexpr (multiply_may_overflow) { | 426 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 427 | | if (params.is_strict) { | 428 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 429 | | precision, scale); | 430 | | } | 431 | | return false; | 432 | | } | 433 | | if constexpr (narrow_integral) { | 434 | | if (tmp < min_result || tmp > max_result) { | 435 | | if (params.is_strict) { | 436 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 437 | | from, int_type_name<FromCppT>, precision, scale); | 438 | | } | 439 | | return false; | 440 | | } | 441 | | } | 442 | | to = DecimalV2Value(static_cast<typename ToCppT::NativeType>(tmp)); | 443 | 4 | } else { | 444 | 4 | tmp = scale_multiplier * from; | 445 | | if constexpr (narrow_integral) { | 446 | | if (tmp < min_result || tmp > max_result) { | 447 | | if (params.is_strict) { | 448 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 449 | | from, int_type_name<FromCppT>, precision, scale); | 450 | | } | 451 | | return false; | 452 | | } | 453 | | } | 454 | 4 | to = DecimalV2Value(static_cast<typename ToCppT::NativeType>(tmp)); | 455 | 4 | } | 456 | | | 457 | 4 | return true; | 458 | 4 | } |
_ZN5doris13CastToDecimal9_from_intIhNS_14DecimalV2ValueELb0ELb1EnQaa11IsDecimalV2IT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRKT3_RKNS3_10NativeTypeESD_RNS_14CastParametersE Line | Count | Source | 423 | 8 | CastParameters& params) { | 424 | 8 | MaxNativeType tmp; | 425 | | if constexpr (multiply_may_overflow) { | 426 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 427 | | if (params.is_strict) { | 428 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 429 | | precision, scale); | 430 | | } | 431 | | return false; | 432 | | } | 433 | | if constexpr (narrow_integral) { | 434 | | if (tmp < min_result || tmp > max_result) { | 435 | | if (params.is_strict) { | 436 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 437 | | from, int_type_name<FromCppT>, precision, scale); | 438 | | } | 439 | | return false; | 440 | | } | 441 | | } | 442 | | to = DecimalV2Value(static_cast<typename ToCppT::NativeType>(tmp)); | 443 | 8 | } else { | 444 | 8 | tmp = scale_multiplier * from; | 445 | 8 | if constexpr (narrow_integral) { | 446 | 8 | if (tmp < min_result || tmp > max_result) { | 447 | 4 | if (params.is_strict) { | 448 | 2 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 449 | 2 | from, int_type_name<FromCppT>, precision, scale); | 450 | 2 | } | 451 | 4 | return false; | 452 | 4 | } | 453 | 8 | } | 454 | 4 | to = DecimalV2Value(static_cast<typename ToCppT::NativeType>(tmp)); | 455 | 8 | } | 456 | | | 457 | 0 | return true; | 458 | 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 |
459 | | |
460 | | template < |
461 | | typename FromCppT, typename ToCppT, bool multiply_may_overflow, bool narrow_integral, |
462 | | typename MaxNativeType = std::conditional_t< |
463 | | (sizeof(FromCppT) == sizeof(ToCppT)) && |
464 | | (std::is_same_v<ToCppT, Decimal128V3> || |
465 | | std::is_same_v<FromCppT, Decimal128V3>), |
466 | | Decimal128V3::NativeType, |
467 | | std::conditional_t<(sizeof(FromCppT) > sizeof(ToCppT)), |
468 | | typename FromCppT::NativeType, typename ToCppT::NativeType>>> |
469 | | requires(IsDecimalNumber<ToCppT> && IsDecimalNumber<FromCppT>) |
470 | | static inline bool _from_decimal_smaller_scale( |
471 | | const FromCppT& from, const UInt32 precision_from, const UInt32 scale_from, ToCppT& to, |
472 | | UInt32 precision_to, UInt32 scale_to, const MaxNativeType& scale_multiplier, |
473 | | const typename ToCppT::NativeType& min_result, |
474 | 9.19k | const typename ToCppT::NativeType& max_result, CastParameters& params) { |
475 | 9.19k | MaxNativeType res; |
476 | 9.19k | if constexpr (multiply_may_overflow) { |
477 | 5.30k | if constexpr (IsDecimal128V2<FromCppT>) { |
478 | 714 | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, |
479 | 714 | res)) { |
480 | 56 | if (params.is_strict) { |
481 | 12 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( |
482 | 12 | decimal_to_string(from.value(), scale_from), |
483 | 12 | fmt::format("decimal({}, {})", precision_from, scale_from), |
484 | 12 | precision_to, scale_to); |
485 | 12 | } |
486 | 56 | return false; |
487 | 658 | } else { |
488 | 658 | if (UNLIKELY(res > max_result || res < -max_result)) { |
489 | 160 | if (params.is_strict) { |
490 | 96 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( |
491 | 96 | decimal_to_string(from.value(), scale_from), |
492 | 96 | fmt::format("decimal({}, {})", precision_from, scale_from), |
493 | 96 | precision_to, scale_to); |
494 | 96 | } |
495 | 160 | return false; |
496 | 498 | } else { |
497 | 498 | to = ToCppT(res); |
498 | 498 | } |
499 | 658 | } |
500 | 4.59k | } else { |
501 | 4.59k | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, |
502 | 4.59k | res)) { |
503 | 718 | if (params.is_strict) { |
504 | 60 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( |
505 | 60 | decimal_to_string(from.value, scale_from), |
506 | 60 | fmt::format("decimal({}, {})", precision_from, scale_from), |
507 | 60 | precision_to, scale_to); |
508 | 60 | } |
509 | 718 | return false; |
510 | 3.87k | } else { |
511 | 3.87k | if (UNLIKELY(res > max_result || res < -max_result)) { |
512 | 1.77k | if (params.is_strict) { |
513 | 1.18k | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( |
514 | 1.18k | decimal_to_string(from.value, scale_from), |
515 | 1.18k | fmt::format("decimal({}, {})", precision_from, scale_from), |
516 | 1.18k | precision_to, scale_to); |
517 | 1.18k | } |
518 | 1.77k | return false; |
519 | 2.09k | } else { |
520 | 2.09k | to = ToCppT(res); |
521 | 2.09k | } |
522 | 3.87k | } |
523 | 4.59k | } |
524 | 5.30k | } else { |
525 | 3.89k | if constexpr (IsDecimal128V2<FromCppT>) { |
526 | 424 | res = from.value() * scale_multiplier; |
527 | 3.46k | } else { |
528 | 3.46k | res = from.value * scale_multiplier; |
529 | 3.46k | } |
530 | 3.89k | if constexpr (narrow_integral) { |
531 | 1.76k | if (UNLIKELY(res > max_result || res < -max_result)) { |
532 | 828 | if constexpr (IsDecimal128V2<FromCppT>) { |
533 | 120 | if (params.is_strict) { |
534 | 60 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( |
535 | 60 | decimal_to_string(from.value(), scale_from), |
536 | 60 | fmt::format("decimal({}, {})", precision_from, scale_from), |
537 | 60 | precision_to, scale_to); |
538 | 60 | } |
539 | 708 | } else { |
540 | 708 | if (params.is_strict) { |
541 | 354 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( |
542 | 354 | decimal_to_string(from.value, scale_from), |
543 | 354 | fmt::format("decimal({}, {})", precision_from, scale_from), |
544 | 354 | precision_to, scale_to); |
545 | 354 | } |
546 | 708 | } |
547 | 828 | return false; |
548 | 828 | } |
549 | 1.76k | } |
550 | 940 | to = ToCppT(res); |
551 | 3.89k | } |
552 | 2.59k | return true; |
553 | 9.19k | } _ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_7DecimalIiEES3_Lb0ELb0EiQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 474 | 28 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 475 | 28 | MaxNativeType res; | 476 | | if constexpr (multiply_may_overflow) { | 477 | | if constexpr (IsDecimal128V2<FromCppT>) { | 478 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 479 | | res)) { | 480 | | if (params.is_strict) { | 481 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 482 | | decimal_to_string(from.value(), scale_from), | 483 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 484 | | precision_to, scale_to); | 485 | | } | 486 | | return false; | 487 | | } else { | 488 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 489 | | if (params.is_strict) { | 490 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 491 | | decimal_to_string(from.value(), scale_from), | 492 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 493 | | precision_to, scale_to); | 494 | | } | 495 | | return false; | 496 | | } else { | 497 | | to = ToCppT(res); | 498 | | } | 499 | | } | 500 | | } else { | 501 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 502 | | res)) { | 503 | | if (params.is_strict) { | 504 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 505 | | decimal_to_string(from.value, scale_from), | 506 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 507 | | precision_to, scale_to); | 508 | | } | 509 | | return false; | 510 | | } else { | 511 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 512 | | if (params.is_strict) { | 513 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 514 | | decimal_to_string(from.value, scale_from), | 515 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 516 | | precision_to, scale_to); | 517 | | } | 518 | | return false; | 519 | | } else { | 520 | | to = ToCppT(res); | 521 | | } | 522 | | } | 523 | | } | 524 | 28 | } else { | 525 | | if constexpr (IsDecimal128V2<FromCppT>) { | 526 | | res = from.value() * scale_multiplier; | 527 | 28 | } else { | 528 | 28 | res = from.value * scale_multiplier; | 529 | 28 | } | 530 | | if constexpr (narrow_integral) { | 531 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 532 | | if constexpr (IsDecimal128V2<FromCppT>) { | 533 | | if (params.is_strict) { | 534 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 535 | | decimal_to_string(from.value(), scale_from), | 536 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 537 | | precision_to, scale_to); | 538 | | } | 539 | | } else { | 540 | | if (params.is_strict) { | 541 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 542 | | decimal_to_string(from.value, scale_from), | 543 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 544 | | precision_to, scale_to); | 545 | | } | 546 | | } | 547 | | return false; | 548 | | } | 549 | | } | 550 | 28 | to = ToCppT(res); | 551 | 28 | } | 552 | 28 | return true; | 553 | 28 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_7DecimalIiEES3_Lb0ELb1EiQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 474 | 14 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 475 | 14 | MaxNativeType res; | 476 | | if constexpr (multiply_may_overflow) { | 477 | | if constexpr (IsDecimal128V2<FromCppT>) { | 478 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 479 | | res)) { | 480 | | if (params.is_strict) { | 481 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 482 | | decimal_to_string(from.value(), scale_from), | 483 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 484 | | precision_to, scale_to); | 485 | | } | 486 | | return false; | 487 | | } else { | 488 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 489 | | if (params.is_strict) { | 490 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 491 | | decimal_to_string(from.value(), scale_from), | 492 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 493 | | precision_to, scale_to); | 494 | | } | 495 | | return false; | 496 | | } else { | 497 | | to = ToCppT(res); | 498 | | } | 499 | | } | 500 | | } else { | 501 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 502 | | res)) { | 503 | | if (params.is_strict) { | 504 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 505 | | decimal_to_string(from.value, scale_from), | 506 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 507 | | precision_to, scale_to); | 508 | | } | 509 | | return false; | 510 | | } else { | 511 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 512 | | if (params.is_strict) { | 513 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 514 | | decimal_to_string(from.value, scale_from), | 515 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 516 | | precision_to, scale_to); | 517 | | } | 518 | | return false; | 519 | | } else { | 520 | | to = ToCppT(res); | 521 | | } | 522 | | } | 523 | | } | 524 | 14 | } else { | 525 | | if constexpr (IsDecimal128V2<FromCppT>) { | 526 | | res = from.value() * scale_multiplier; | 527 | 14 | } else { | 528 | 14 | res = from.value * scale_multiplier; | 529 | 14 | } | 530 | 14 | if constexpr (narrow_integral) { | 531 | 14 | if (UNLIKELY(res > max_result || res < -max_result)) { | 532 | | if constexpr (IsDecimal128V2<FromCppT>) { | 533 | | if (params.is_strict) { | 534 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 535 | | decimal_to_string(from.value(), scale_from), | 536 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 537 | | precision_to, scale_to); | 538 | | } | 539 | 12 | } else { | 540 | 12 | if (params.is_strict) { | 541 | 6 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 542 | 6 | decimal_to_string(from.value, scale_from), | 543 | 6 | fmt::format("decimal({}, {})", precision_from, scale_from), | 544 | 6 | precision_to, scale_to); | 545 | 6 | } | 546 | 12 | } | 547 | 12 | return false; | 548 | 12 | } | 549 | 14 | } | 550 | 2 | to = ToCppT(res); | 551 | 14 | } | 552 | 0 | return true; | 553 | 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 | 474 | 168 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 475 | 168 | MaxNativeType res; | 476 | 168 | if constexpr (multiply_may_overflow) { | 477 | | if constexpr (IsDecimal128V2<FromCppT>) { | 478 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 479 | | res)) { | 480 | | if (params.is_strict) { | 481 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 482 | | decimal_to_string(from.value(), scale_from), | 483 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 484 | | precision_to, scale_to); | 485 | | } | 486 | | return false; | 487 | | } else { | 488 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 489 | | if (params.is_strict) { | 490 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 491 | | decimal_to_string(from.value(), scale_from), | 492 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 493 | | precision_to, scale_to); | 494 | | } | 495 | | return false; | 496 | | } else { | 497 | | to = ToCppT(res); | 498 | | } | 499 | | } | 500 | 168 | } else { | 501 | 168 | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 502 | 168 | res)) { | 503 | 32 | if (params.is_strict) { | 504 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 505 | 0 | decimal_to_string(from.value, scale_from), | 506 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 507 | 0 | precision_to, scale_to); | 508 | 0 | } | 509 | 32 | return false; | 510 | 136 | } else { | 511 | 136 | if (UNLIKELY(res > max_result || res < -max_result)) { | 512 | 64 | if (params.is_strict) { | 513 | 48 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 514 | 48 | decimal_to_string(from.value, scale_from), | 515 | 48 | fmt::format("decimal({}, {})", precision_from, scale_from), | 516 | 48 | precision_to, scale_to); | 517 | 48 | } | 518 | 64 | return false; | 519 | 72 | } else { | 520 | 72 | to = ToCppT(res); | 521 | 72 | } | 522 | 136 | } | 523 | 168 | } | 524 | | } else { | 525 | | if constexpr (IsDecimal128V2<FromCppT>) { | 526 | | res = from.value() * scale_multiplier; | 527 | | } else { | 528 | | res = from.value * scale_multiplier; | 529 | | } | 530 | | if constexpr (narrow_integral) { | 531 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 532 | | if constexpr (IsDecimal128V2<FromCppT>) { | 533 | | if (params.is_strict) { | 534 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 535 | | decimal_to_string(from.value(), scale_from), | 536 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 537 | | precision_to, scale_to); | 538 | | } | 539 | | } else { | 540 | | if (params.is_strict) { | 541 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 542 | | decimal_to_string(from.value, scale_from), | 543 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 544 | | precision_to, scale_to); | 545 | | } | 546 | | } | 547 | | return false; | 548 | | } | 549 | | } | 550 | | to = ToCppT(res); | 551 | | } | 552 | 72 | return true; | 553 | 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 | 474 | 252 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 475 | 252 | MaxNativeType res; | 476 | 252 | if constexpr (multiply_may_overflow) { | 477 | | if constexpr (IsDecimal128V2<FromCppT>) { | 478 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 479 | | res)) { | 480 | | if (params.is_strict) { | 481 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 482 | | decimal_to_string(from.value(), scale_from), | 483 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 484 | | precision_to, scale_to); | 485 | | } | 486 | | return false; | 487 | | } else { | 488 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 489 | | if (params.is_strict) { | 490 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 491 | | decimal_to_string(from.value(), scale_from), | 492 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 493 | | precision_to, scale_to); | 494 | | } | 495 | | return false; | 496 | | } else { | 497 | | to = ToCppT(res); | 498 | | } | 499 | | } | 500 | 252 | } else { | 501 | 252 | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 502 | 252 | res)) { | 503 | 28 | if (params.is_strict) { | 504 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 505 | 0 | decimal_to_string(from.value, scale_from), | 506 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 507 | 0 | precision_to, scale_to); | 508 | 0 | } | 509 | 28 | return false; | 510 | 224 | } else { | 511 | 224 | if (UNLIKELY(res > max_result || res < -max_result)) { | 512 | 116 | if (params.is_strict) { | 513 | 72 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 514 | 72 | decimal_to_string(from.value, scale_from), | 515 | 72 | fmt::format("decimal({}, {})", precision_from, scale_from), | 516 | 72 | precision_to, scale_to); | 517 | 72 | } | 518 | 116 | return false; | 519 | 116 | } else { | 520 | 108 | to = ToCppT(res); | 521 | 108 | } | 522 | 224 | } | 523 | 252 | } | 524 | | } else { | 525 | | if constexpr (IsDecimal128V2<FromCppT>) { | 526 | | res = from.value() * scale_multiplier; | 527 | | } else { | 528 | | res = from.value * scale_multiplier; | 529 | | } | 530 | | if constexpr (narrow_integral) { | 531 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 532 | | if constexpr (IsDecimal128V2<FromCppT>) { | 533 | | if (params.is_strict) { | 534 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 535 | | decimal_to_string(from.value(), scale_from), | 536 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 537 | | precision_to, scale_to); | 538 | | } | 539 | | } else { | 540 | | if (params.is_strict) { | 541 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 542 | | decimal_to_string(from.value, scale_from), | 543 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 544 | | precision_to, scale_to); | 545 | | } | 546 | | } | 547 | | return false; | 548 | | } | 549 | | } | 550 | | to = ToCppT(res); | 551 | | } | 552 | 108 | return true; | 553 | 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 | 474 | 252 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 475 | 252 | MaxNativeType res; | 476 | 252 | if constexpr (multiply_may_overflow) { | 477 | | if constexpr (IsDecimal128V2<FromCppT>) { | 478 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 479 | | res)) { | 480 | | if (params.is_strict) { | 481 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 482 | | decimal_to_string(from.value(), scale_from), | 483 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 484 | | precision_to, scale_to); | 485 | | } | 486 | | return false; | 487 | | } else { | 488 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 489 | | if (params.is_strict) { | 490 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 491 | | decimal_to_string(from.value(), scale_from), | 492 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 493 | | precision_to, scale_to); | 494 | | } | 495 | | return false; | 496 | | } else { | 497 | | to = ToCppT(res); | 498 | | } | 499 | | } | 500 | 252 | } else { | 501 | 252 | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 502 | 252 | res)) { | 503 | 24 | if (params.is_strict) { | 504 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 505 | 0 | decimal_to_string(from.value, scale_from), | 506 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 507 | 0 | precision_to, scale_to); | 508 | 0 | } | 509 | 24 | return false; | 510 | 228 | } else { | 511 | 228 | if (UNLIKELY(res > max_result || res < -max_result)) { | 512 | 120 | if (params.is_strict) { | 513 | 72 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 514 | 72 | decimal_to_string(from.value, scale_from), | 515 | 72 | fmt::format("decimal({}, {})", precision_from, scale_from), | 516 | 72 | precision_to, scale_to); | 517 | 72 | } | 518 | 120 | return false; | 519 | 120 | } else { | 520 | 108 | to = ToCppT(res); | 521 | 108 | } | 522 | 228 | } | 523 | 252 | } | 524 | | } else { | 525 | | if constexpr (IsDecimal128V2<FromCppT>) { | 526 | | res = from.value() * scale_multiplier; | 527 | | } else { | 528 | | res = from.value * scale_multiplier; | 529 | | } | 530 | | if constexpr (narrow_integral) { | 531 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 532 | | if constexpr (IsDecimal128V2<FromCppT>) { | 533 | | if (params.is_strict) { | 534 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 535 | | decimal_to_string(from.value(), scale_from), | 536 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 537 | | precision_to, scale_to); | 538 | | } | 539 | | } else { | 540 | | if (params.is_strict) { | 541 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 542 | | decimal_to_string(from.value, scale_from), | 543 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 544 | | precision_to, scale_to); | 545 | | } | 546 | | } | 547 | | return false; | 548 | | } | 549 | | } | 550 | | to = ToCppT(res); | 551 | | } | 552 | 108 | return true; | 553 | 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 | 474 | 252 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 475 | 252 | MaxNativeType res; | 476 | 252 | if constexpr (multiply_may_overflow) { | 477 | | if constexpr (IsDecimal128V2<FromCppT>) { | 478 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 479 | | res)) { | 480 | | if (params.is_strict) { | 481 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 482 | | decimal_to_string(from.value(), scale_from), | 483 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 484 | | precision_to, scale_to); | 485 | | } | 486 | | return false; | 487 | | } else { | 488 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 489 | | if (params.is_strict) { | 490 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 491 | | decimal_to_string(from.value(), scale_from), | 492 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 493 | | precision_to, scale_to); | 494 | | } | 495 | | return false; | 496 | | } else { | 497 | | to = ToCppT(res); | 498 | | } | 499 | | } | 500 | 252 | } else { | 501 | 252 | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 502 | 252 | res)) { | 503 | 24 | if (params.is_strict) { | 504 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 505 | 0 | decimal_to_string(from.value, scale_from), | 506 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 507 | 0 | precision_to, scale_to); | 508 | 0 | } | 509 | 24 | return false; | 510 | 228 | } else { | 511 | 228 | if (UNLIKELY(res > max_result || res < -max_result)) { | 512 | 120 | if (params.is_strict) { | 513 | 72 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 514 | 72 | decimal_to_string(from.value, scale_from), | 515 | 72 | fmt::format("decimal({}, {})", precision_from, scale_from), | 516 | 72 | precision_to, scale_to); | 517 | 72 | } | 518 | 120 | return false; | 519 | 120 | } else { | 520 | 108 | to = ToCppT(res); | 521 | 108 | } | 522 | 228 | } | 523 | 252 | } | 524 | | } else { | 525 | | if constexpr (IsDecimal128V2<FromCppT>) { | 526 | | res = from.value() * scale_multiplier; | 527 | | } else { | 528 | | res = from.value * scale_multiplier; | 529 | | } | 530 | | if constexpr (narrow_integral) { | 531 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 532 | | if constexpr (IsDecimal128V2<FromCppT>) { | 533 | | if (params.is_strict) { | 534 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 535 | | decimal_to_string(from.value(), scale_from), | 536 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 537 | | precision_to, scale_to); | 538 | | } | 539 | | } else { | 540 | | if (params.is_strict) { | 541 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 542 | | decimal_to_string(from.value, scale_from), | 543 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 544 | | precision_to, scale_to); | 545 | | } | 546 | | } | 547 | | return false; | 548 | | } | 549 | | } | 550 | | to = ToCppT(res); | 551 | | } | 552 | 108 | return true; | 553 | 252 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_7DecimalIiEENS2_IlEELb0ELb0ElQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKT3_RKNS5_10NativeTypeESF_RNS_14CastParametersE Line | Count | Source | 474 | 224 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 475 | 224 | MaxNativeType res; | 476 | | if constexpr (multiply_may_overflow) { | 477 | | if constexpr (IsDecimal128V2<FromCppT>) { | 478 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 479 | | res)) { | 480 | | if (params.is_strict) { | 481 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 482 | | decimal_to_string(from.value(), scale_from), | 483 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 484 | | precision_to, scale_to); | 485 | | } | 486 | | return false; | 487 | | } else { | 488 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 489 | | if (params.is_strict) { | 490 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 491 | | decimal_to_string(from.value(), scale_from), | 492 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 493 | | precision_to, scale_to); | 494 | | } | 495 | | return false; | 496 | | } else { | 497 | | to = ToCppT(res); | 498 | | } | 499 | | } | 500 | | } else { | 501 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 502 | | res)) { | 503 | | if (params.is_strict) { | 504 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 505 | | decimal_to_string(from.value, scale_from), | 506 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 507 | | precision_to, scale_to); | 508 | | } | 509 | | return false; | 510 | | } else { | 511 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 512 | | if (params.is_strict) { | 513 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 514 | | decimal_to_string(from.value, scale_from), | 515 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 516 | | precision_to, scale_to); | 517 | | } | 518 | | return false; | 519 | | } else { | 520 | | to = ToCppT(res); | 521 | | } | 522 | | } | 523 | | } | 524 | 224 | } else { | 525 | | if constexpr (IsDecimal128V2<FromCppT>) { | 526 | | res = from.value() * scale_multiplier; | 527 | 224 | } else { | 528 | 224 | res = from.value * scale_multiplier; | 529 | 224 | } | 530 | | if constexpr (narrow_integral) { | 531 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 532 | | if constexpr (IsDecimal128V2<FromCppT>) { | 533 | | if (params.is_strict) { | 534 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 535 | | decimal_to_string(from.value(), scale_from), | 536 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 537 | | precision_to, scale_to); | 538 | | } | 539 | | } else { | 540 | | if (params.is_strict) { | 541 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 542 | | decimal_to_string(from.value, scale_from), | 543 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 544 | | precision_to, scale_to); | 545 | | } | 546 | | } | 547 | | return false; | 548 | | } | 549 | | } | 550 | 224 | to = ToCppT(res); | 551 | 224 | } | 552 | 224 | return true; | 553 | 224 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_7DecimalIiEENS2_IlEELb0ELb1ElQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKT3_RKNS5_10NativeTypeESF_RNS_14CastParametersE Line | Count | Source | 474 | 116 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 475 | 116 | MaxNativeType res; | 476 | | if constexpr (multiply_may_overflow) { | 477 | | if constexpr (IsDecimal128V2<FromCppT>) { | 478 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 479 | | res)) { | 480 | | if (params.is_strict) { | 481 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 482 | | decimal_to_string(from.value(), scale_from), | 483 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 484 | | precision_to, scale_to); | 485 | | } | 486 | | return false; | 487 | | } else { | 488 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 489 | | if (params.is_strict) { | 490 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 491 | | decimal_to_string(from.value(), scale_from), | 492 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 493 | | precision_to, scale_to); | 494 | | } | 495 | | return false; | 496 | | } else { | 497 | | to = ToCppT(res); | 498 | | } | 499 | | } | 500 | | } else { | 501 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 502 | | res)) { | 503 | | if (params.is_strict) { | 504 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 505 | | decimal_to_string(from.value, scale_from), | 506 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 507 | | precision_to, scale_to); | 508 | | } | 509 | | return false; | 510 | | } else { | 511 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 512 | | if (params.is_strict) { | 513 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 514 | | decimal_to_string(from.value, scale_from), | 515 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 516 | | precision_to, scale_to); | 517 | | } | 518 | | return false; | 519 | | } else { | 520 | | to = ToCppT(res); | 521 | | } | 522 | | } | 523 | | } | 524 | 116 | } else { | 525 | | if constexpr (IsDecimal128V2<FromCppT>) { | 526 | | res = from.value() * scale_multiplier; | 527 | 116 | } else { | 528 | 116 | res = from.value * scale_multiplier; | 529 | 116 | } | 530 | 116 | if constexpr (narrow_integral) { | 531 | 116 | if (UNLIKELY(res > max_result || res < -max_result)) { | 532 | | if constexpr (IsDecimal128V2<FromCppT>) { | 533 | | if (params.is_strict) { | 534 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 535 | | decimal_to_string(from.value(), scale_from), | 536 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 537 | | precision_to, scale_to); | 538 | | } | 539 | 60 | } else { | 540 | 60 | if (params.is_strict) { | 541 | 30 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 542 | 30 | decimal_to_string(from.value, scale_from), | 543 | 30 | fmt::format("decimal({}, {})", precision_from, scale_from), | 544 | 30 | precision_to, scale_to); | 545 | 30 | } | 546 | 60 | } | 547 | 60 | return false; | 548 | 60 | } | 549 | 116 | } | 550 | 56 | to = ToCppT(res); | 551 | 116 | } | 552 | 0 | return true; | 553 | 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 | 474 | 144 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 475 | 144 | MaxNativeType res; | 476 | 144 | if constexpr (multiply_may_overflow) { | 477 | | if constexpr (IsDecimal128V2<FromCppT>) { | 478 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 479 | | res)) { | 480 | | if (params.is_strict) { | 481 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 482 | | decimal_to_string(from.value(), scale_from), | 483 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 484 | | precision_to, scale_to); | 485 | | } | 486 | | return false; | 487 | | } else { | 488 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 489 | | if (params.is_strict) { | 490 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 491 | | decimal_to_string(from.value(), scale_from), | 492 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 493 | | precision_to, scale_to); | 494 | | } | 495 | | return false; | 496 | | } else { | 497 | | to = ToCppT(res); | 498 | | } | 499 | | } | 500 | 144 | } else { | 501 | 144 | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 502 | 144 | res)) { | 503 | 22 | if (params.is_strict) { | 504 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 505 | 0 | decimal_to_string(from.value, scale_from), | 506 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 507 | 0 | precision_to, scale_to); | 508 | 0 | } | 509 | 22 | return false; | 510 | 122 | } else { | 511 | 122 | if (UNLIKELY(res > max_result || res < -max_result)) { | 512 | 62 | if (params.is_strict) { | 513 | 42 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 514 | 42 | decimal_to_string(from.value, scale_from), | 515 | 42 | fmt::format("decimal({}, {})", precision_from, scale_from), | 516 | 42 | precision_to, scale_to); | 517 | 42 | } | 518 | 62 | return false; | 519 | 62 | } else { | 520 | 60 | to = ToCppT(res); | 521 | 60 | } | 522 | 122 | } | 523 | 144 | } | 524 | | } else { | 525 | | if constexpr (IsDecimal128V2<FromCppT>) { | 526 | | res = from.value() * scale_multiplier; | 527 | | } else { | 528 | | res = from.value * scale_multiplier; | 529 | | } | 530 | | if constexpr (narrow_integral) { | 531 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 532 | | if constexpr (IsDecimal128V2<FromCppT>) { | 533 | | if (params.is_strict) { | 534 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 535 | | decimal_to_string(from.value(), scale_from), | 536 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 537 | | precision_to, scale_to); | 538 | | } | 539 | | } else { | 540 | | if (params.is_strict) { | 541 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 542 | | decimal_to_string(from.value, scale_from), | 543 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 544 | | precision_to, scale_to); | 545 | | } | 546 | | } | 547 | | return false; | 548 | | } | 549 | | } | 550 | | to = ToCppT(res); | 551 | | } | 552 | 60 | return true; | 553 | 144 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_7DecimalIlEES3_Lb0ELb0ElQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 474 | 92 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 475 | 92 | MaxNativeType res; | 476 | | if constexpr (multiply_may_overflow) { | 477 | | if constexpr (IsDecimal128V2<FromCppT>) { | 478 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 479 | | res)) { | 480 | | if (params.is_strict) { | 481 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 482 | | decimal_to_string(from.value(), scale_from), | 483 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 484 | | precision_to, scale_to); | 485 | | } | 486 | | return false; | 487 | | } else { | 488 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 489 | | if (params.is_strict) { | 490 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 491 | | decimal_to_string(from.value(), scale_from), | 492 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 493 | | precision_to, scale_to); | 494 | | } | 495 | | return false; | 496 | | } else { | 497 | | to = ToCppT(res); | 498 | | } | 499 | | } | 500 | | } else { | 501 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 502 | | res)) { | 503 | | if (params.is_strict) { | 504 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 505 | | decimal_to_string(from.value, scale_from), | 506 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 507 | | precision_to, scale_to); | 508 | | } | 509 | | return false; | 510 | | } else { | 511 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 512 | | if (params.is_strict) { | 513 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 514 | | decimal_to_string(from.value, scale_from), | 515 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 516 | | precision_to, scale_to); | 517 | | } | 518 | | return false; | 519 | | } else { | 520 | | to = ToCppT(res); | 521 | | } | 522 | | } | 523 | | } | 524 | 92 | } else { | 525 | | if constexpr (IsDecimal128V2<FromCppT>) { | 526 | | res = from.value() * scale_multiplier; | 527 | 92 | } else { | 528 | 92 | res = from.value * scale_multiplier; | 529 | 92 | } | 530 | | if constexpr (narrow_integral) { | 531 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 532 | | if constexpr (IsDecimal128V2<FromCppT>) { | 533 | | if (params.is_strict) { | 534 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 535 | | decimal_to_string(from.value(), scale_from), | 536 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 537 | | precision_to, scale_to); | 538 | | } | 539 | | } else { | 540 | | if (params.is_strict) { | 541 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 542 | | decimal_to_string(from.value, scale_from), | 543 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 544 | | precision_to, scale_to); | 545 | | } | 546 | | } | 547 | | return false; | 548 | | } | 549 | | } | 550 | 92 | to = ToCppT(res); | 551 | 92 | } | 552 | 92 | return true; | 553 | 92 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_7DecimalIlEES3_Lb0ELb1ElQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 474 | 88 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 475 | 88 | MaxNativeType res; | 476 | | if constexpr (multiply_may_overflow) { | 477 | | if constexpr (IsDecimal128V2<FromCppT>) { | 478 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 479 | | res)) { | 480 | | if (params.is_strict) { | 481 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 482 | | decimal_to_string(from.value(), scale_from), | 483 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 484 | | precision_to, scale_to); | 485 | | } | 486 | | return false; | 487 | | } else { | 488 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 489 | | if (params.is_strict) { | 490 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 491 | | decimal_to_string(from.value(), scale_from), | 492 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 493 | | precision_to, scale_to); | 494 | | } | 495 | | return false; | 496 | | } else { | 497 | | to = ToCppT(res); | 498 | | } | 499 | | } | 500 | | } else { | 501 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 502 | | res)) { | 503 | | if (params.is_strict) { | 504 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 505 | | decimal_to_string(from.value, scale_from), | 506 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 507 | | precision_to, scale_to); | 508 | | } | 509 | | return false; | 510 | | } else { | 511 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 512 | | if (params.is_strict) { | 513 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 514 | | decimal_to_string(from.value, scale_from), | 515 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 516 | | precision_to, scale_to); | 517 | | } | 518 | | return false; | 519 | | } else { | 520 | | to = ToCppT(res); | 521 | | } | 522 | | } | 523 | | } | 524 | 88 | } else { | 525 | | if constexpr (IsDecimal128V2<FromCppT>) { | 526 | | res = from.value() * scale_multiplier; | 527 | 88 | } else { | 528 | 88 | res = from.value * scale_multiplier; | 529 | 88 | } | 530 | 88 | if constexpr (narrow_integral) { | 531 | 88 | if (UNLIKELY(res > max_result || res < -max_result)) { | 532 | | if constexpr (IsDecimal128V2<FromCppT>) { | 533 | | if (params.is_strict) { | 534 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 535 | | decimal_to_string(from.value(), scale_from), | 536 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 537 | | precision_to, scale_to); | 538 | | } | 539 | 36 | } else { | 540 | 36 | if (params.is_strict) { | 541 | 18 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 542 | 18 | decimal_to_string(from.value, scale_from), | 543 | 18 | fmt::format("decimal({}, {})", precision_from, scale_from), | 544 | 18 | precision_to, scale_to); | 545 | 18 | } | 546 | 36 | } | 547 | 36 | return false; | 548 | 36 | } | 549 | 88 | } | 550 | 52 | to = ToCppT(res); | 551 | 88 | } | 552 | 0 | return true; | 553 | 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 | 474 | 420 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 475 | 420 | MaxNativeType res; | 476 | 420 | if constexpr (multiply_may_overflow) { | 477 | | if constexpr (IsDecimal128V2<FromCppT>) { | 478 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 479 | | res)) { | 480 | | if (params.is_strict) { | 481 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 482 | | decimal_to_string(from.value(), scale_from), | 483 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 484 | | precision_to, scale_to); | 485 | | } | 486 | | return false; | 487 | | } else { | 488 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 489 | | if (params.is_strict) { | 490 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 491 | | decimal_to_string(from.value(), scale_from), | 492 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 493 | | precision_to, scale_to); | 494 | | } | 495 | | return false; | 496 | | } else { | 497 | | to = ToCppT(res); | 498 | | } | 499 | | } | 500 | 420 | } else { | 501 | 420 | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 502 | 420 | res)) { | 503 | 72 | if (params.is_strict) { | 504 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 505 | 0 | decimal_to_string(from.value, scale_from), | 506 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 507 | 0 | precision_to, scale_to); | 508 | 0 | } | 509 | 72 | return false; | 510 | 348 | } else { | 511 | 348 | if (UNLIKELY(res > max_result || res < -max_result)) { | 512 | 156 | if (params.is_strict) { | 513 | 114 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 514 | 114 | decimal_to_string(from.value, scale_from), | 515 | 114 | fmt::format("decimal({}, {})", precision_from, scale_from), | 516 | 114 | precision_to, scale_to); | 517 | 114 | } | 518 | 156 | return false; | 519 | 192 | } else { | 520 | 192 | to = ToCppT(res); | 521 | 192 | } | 522 | 348 | } | 523 | 420 | } | 524 | | } else { | 525 | | if constexpr (IsDecimal128V2<FromCppT>) { | 526 | | res = from.value() * scale_multiplier; | 527 | | } else { | 528 | | res = from.value * scale_multiplier; | 529 | | } | 530 | | if constexpr (narrow_integral) { | 531 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 532 | | if constexpr (IsDecimal128V2<FromCppT>) { | 533 | | if (params.is_strict) { | 534 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 535 | | decimal_to_string(from.value(), scale_from), | 536 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 537 | | precision_to, scale_to); | 538 | | } | 539 | | } else { | 540 | | if (params.is_strict) { | 541 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 542 | | decimal_to_string(from.value, scale_from), | 543 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 544 | | precision_to, scale_to); | 545 | | } | 546 | | } | 547 | | return false; | 548 | | } | 549 | | } | 550 | | to = ToCppT(res); | 551 | | } | 552 | 192 | return true; | 553 | 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 | 474 | 448 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 475 | 448 | MaxNativeType res; | 476 | 448 | if constexpr (multiply_may_overflow) { | 477 | | if constexpr (IsDecimal128V2<FromCppT>) { | 478 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 479 | | res)) { | 480 | | if (params.is_strict) { | 481 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 482 | | decimal_to_string(from.value(), scale_from), | 483 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 484 | | precision_to, scale_to); | 485 | | } | 486 | | return false; | 487 | | } else { | 488 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 489 | | if (params.is_strict) { | 490 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 491 | | decimal_to_string(from.value(), scale_from), | 492 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 493 | | precision_to, scale_to); | 494 | | } | 495 | | return false; | 496 | | } else { | 497 | | to = ToCppT(res); | 498 | | } | 499 | | } | 500 | 448 | } else { | 501 | 448 | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 502 | 448 | res)) { | 503 | 40 | if (params.is_strict) { | 504 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 505 | 0 | decimal_to_string(from.value, scale_from), | 506 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 507 | 0 | precision_to, scale_to); | 508 | 0 | } | 509 | 40 | return false; | 510 | 408 | } else { | 511 | 408 | if (UNLIKELY(res > max_result || res < -max_result)) { | 512 | 200 | if (params.is_strict) { | 513 | 120 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 514 | 120 | decimal_to_string(from.value, scale_from), | 515 | 120 | fmt::format("decimal({}, {})", precision_from, scale_from), | 516 | 120 | precision_to, scale_to); | 517 | 120 | } | 518 | 200 | return false; | 519 | 208 | } else { | 520 | 208 | to = ToCppT(res); | 521 | 208 | } | 522 | 408 | } | 523 | 448 | } | 524 | | } else { | 525 | | if constexpr (IsDecimal128V2<FromCppT>) { | 526 | | res = from.value() * scale_multiplier; | 527 | | } else { | 528 | | res = from.value * scale_multiplier; | 529 | | } | 530 | | if constexpr (narrow_integral) { | 531 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 532 | | if constexpr (IsDecimal128V2<FromCppT>) { | 533 | | if (params.is_strict) { | 534 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 535 | | decimal_to_string(from.value(), scale_from), | 536 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 537 | | precision_to, scale_to); | 538 | | } | 539 | | } else { | 540 | | if (params.is_strict) { | 541 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 542 | | decimal_to_string(from.value, scale_from), | 543 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 544 | | precision_to, scale_to); | 545 | | } | 546 | | } | 547 | | return false; | 548 | | } | 549 | | } | 550 | | to = ToCppT(res); | 551 | | } | 552 | 208 | return true; | 553 | 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 | 474 | 448 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 475 | 448 | MaxNativeType res; | 476 | 448 | if constexpr (multiply_may_overflow) { | 477 | | if constexpr (IsDecimal128V2<FromCppT>) { | 478 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 479 | | res)) { | 480 | | if (params.is_strict) { | 481 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 482 | | decimal_to_string(from.value(), scale_from), | 483 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 484 | | precision_to, scale_to); | 485 | | } | 486 | | return false; | 487 | | } else { | 488 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 489 | | if (params.is_strict) { | 490 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 491 | | decimal_to_string(from.value(), scale_from), | 492 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 493 | | precision_to, scale_to); | 494 | | } | 495 | | return false; | 496 | | } else { | 497 | | to = ToCppT(res); | 498 | | } | 499 | | } | 500 | 448 | } else { | 501 | 448 | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 502 | 448 | res)) { | 503 | 40 | if (params.is_strict) { | 504 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 505 | 0 | decimal_to_string(from.value, scale_from), | 506 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 507 | 0 | precision_to, scale_to); | 508 | 0 | } | 509 | 40 | return false; | 510 | 408 | } else { | 511 | 408 | if (UNLIKELY(res > max_result || res < -max_result)) { | 512 | 200 | if (params.is_strict) { | 513 | 120 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 514 | 120 | decimal_to_string(from.value, scale_from), | 515 | 120 | fmt::format("decimal({}, {})", precision_from, scale_from), | 516 | 120 | precision_to, scale_to); | 517 | 120 | } | 518 | 200 | return false; | 519 | 208 | } else { | 520 | 208 | to = ToCppT(res); | 521 | 208 | } | 522 | 408 | } | 523 | 448 | } | 524 | | } else { | 525 | | if constexpr (IsDecimal128V2<FromCppT>) { | 526 | | res = from.value() * scale_multiplier; | 527 | | } else { | 528 | | res = from.value * scale_multiplier; | 529 | | } | 530 | | if constexpr (narrow_integral) { | 531 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 532 | | if constexpr (IsDecimal128V2<FromCppT>) { | 533 | | if (params.is_strict) { | 534 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 535 | | decimal_to_string(from.value(), scale_from), | 536 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 537 | | precision_to, scale_to); | 538 | | } | 539 | | } else { | 540 | | if (params.is_strict) { | 541 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 542 | | decimal_to_string(from.value, scale_from), | 543 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 544 | | precision_to, scale_to); | 545 | | } | 546 | | } | 547 | | return false; | 548 | | } | 549 | | } | 550 | | to = ToCppT(res); | 551 | | } | 552 | 208 | return true; | 553 | 448 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_7DecimalIiEENS_12Decimal128V3ELb0ELb0EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKT3_RKNS5_10NativeTypeESF_RNS_14CastParametersE Line | Count | Source | 474 | 240 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 475 | 240 | MaxNativeType res; | 476 | | if constexpr (multiply_may_overflow) { | 477 | | if constexpr (IsDecimal128V2<FromCppT>) { | 478 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 479 | | res)) { | 480 | | if (params.is_strict) { | 481 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 482 | | decimal_to_string(from.value(), scale_from), | 483 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 484 | | precision_to, scale_to); | 485 | | } | 486 | | return false; | 487 | | } else { | 488 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 489 | | if (params.is_strict) { | 490 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 491 | | decimal_to_string(from.value(), scale_from), | 492 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 493 | | precision_to, scale_to); | 494 | | } | 495 | | return false; | 496 | | } else { | 497 | | to = ToCppT(res); | 498 | | } | 499 | | } | 500 | | } else { | 501 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 502 | | res)) { | 503 | | if (params.is_strict) { | 504 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 505 | | decimal_to_string(from.value, scale_from), | 506 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 507 | | precision_to, scale_to); | 508 | | } | 509 | | return false; | 510 | | } else { | 511 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 512 | | if (params.is_strict) { | 513 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 514 | | decimal_to_string(from.value, scale_from), | 515 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 516 | | precision_to, scale_to); | 517 | | } | 518 | | return false; | 519 | | } else { | 520 | | to = ToCppT(res); | 521 | | } | 522 | | } | 523 | | } | 524 | 240 | } else { | 525 | | if constexpr (IsDecimal128V2<FromCppT>) { | 526 | | res = from.value() * scale_multiplier; | 527 | 240 | } else { | 528 | 240 | res = from.value * scale_multiplier; | 529 | 240 | } | 530 | | if constexpr (narrow_integral) { | 531 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 532 | | if constexpr (IsDecimal128V2<FromCppT>) { | 533 | | if (params.is_strict) { | 534 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 535 | | decimal_to_string(from.value(), scale_from), | 536 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 537 | | precision_to, scale_to); | 538 | | } | 539 | | } else { | 540 | | if (params.is_strict) { | 541 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 542 | | decimal_to_string(from.value, scale_from), | 543 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 544 | | precision_to, scale_to); | 545 | | } | 546 | | } | 547 | | return false; | 548 | | } | 549 | | } | 550 | 240 | to = ToCppT(res); | 551 | 240 | } | 552 | 240 | return true; | 553 | 240 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_7DecimalIiEENS_12Decimal128V3ELb0ELb1EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKT3_RKNS5_10NativeTypeESF_RNS_14CastParametersE Line | Count | Source | 474 | 130 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 475 | 130 | MaxNativeType res; | 476 | | if constexpr (multiply_may_overflow) { | 477 | | if constexpr (IsDecimal128V2<FromCppT>) { | 478 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 479 | | res)) { | 480 | | if (params.is_strict) { | 481 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 482 | | decimal_to_string(from.value(), scale_from), | 483 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 484 | | precision_to, scale_to); | 485 | | } | 486 | | return false; | 487 | | } else { | 488 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 489 | | if (params.is_strict) { | 490 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 491 | | decimal_to_string(from.value(), scale_from), | 492 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 493 | | precision_to, scale_to); | 494 | | } | 495 | | return false; | 496 | | } else { | 497 | | to = ToCppT(res); | 498 | | } | 499 | | } | 500 | | } else { | 501 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 502 | | res)) { | 503 | | if (params.is_strict) { | 504 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 505 | | decimal_to_string(from.value, scale_from), | 506 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 507 | | precision_to, scale_to); | 508 | | } | 509 | | return false; | 510 | | } else { | 511 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 512 | | if (params.is_strict) { | 513 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 514 | | decimal_to_string(from.value, scale_from), | 515 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 516 | | precision_to, scale_to); | 517 | | } | 518 | | return false; | 519 | | } else { | 520 | | to = ToCppT(res); | 521 | | } | 522 | | } | 523 | | } | 524 | 130 | } else { | 525 | | if constexpr (IsDecimal128V2<FromCppT>) { | 526 | | res = from.value() * scale_multiplier; | 527 | 130 | } else { | 528 | 130 | res = from.value * scale_multiplier; | 529 | 130 | } | 530 | 130 | if constexpr (narrow_integral) { | 531 | 130 | if (UNLIKELY(res > max_result || res < -max_result)) { | 532 | | if constexpr (IsDecimal128V2<FromCppT>) { | 533 | | if (params.is_strict) { | 534 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 535 | | decimal_to_string(from.value(), scale_from), | 536 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 537 | | precision_to, scale_to); | 538 | | } | 539 | 72 | } else { | 540 | 72 | if (params.is_strict) { | 541 | 36 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 542 | 36 | decimal_to_string(from.value, scale_from), | 543 | 36 | fmt::format("decimal({}, {})", precision_from, scale_from), | 544 | 36 | precision_to, scale_to); | 545 | 36 | } | 546 | 72 | } | 547 | 72 | return false; | 548 | 72 | } | 549 | 130 | } | 550 | 58 | to = ToCppT(res); | 551 | 130 | } | 552 | 0 | return true; | 553 | 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 | 474 | 130 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 475 | 130 | MaxNativeType res; | 476 | 130 | if constexpr (multiply_may_overflow) { | 477 | | if constexpr (IsDecimal128V2<FromCppT>) { | 478 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 479 | | res)) { | 480 | | if (params.is_strict) { | 481 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 482 | | decimal_to_string(from.value(), scale_from), | 483 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 484 | | precision_to, scale_to); | 485 | | } | 486 | | return false; | 487 | | } else { | 488 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 489 | | if (params.is_strict) { | 490 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 491 | | decimal_to_string(from.value(), scale_from), | 492 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 493 | | precision_to, scale_to); | 494 | | } | 495 | | return false; | 496 | | } else { | 497 | | to = ToCppT(res); | 498 | | } | 499 | | } | 500 | 130 | } else { | 501 | 130 | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 502 | 130 | res)) { | 503 | 40 | if (params.is_strict) { | 504 | 12 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 505 | 12 | decimal_to_string(from.value, scale_from), | 506 | 12 | fmt::format("decimal({}, {})", precision_from, scale_from), | 507 | 12 | precision_to, scale_to); | 508 | 12 | } | 509 | 40 | return false; | 510 | 90 | } else { | 511 | 90 | if (UNLIKELY(res > max_result || res < -max_result)) { | 512 | 32 | if (params.is_strict) { | 513 | 24 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 514 | 24 | decimal_to_string(from.value, scale_from), | 515 | 24 | fmt::format("decimal({}, {})", precision_from, scale_from), | 516 | 24 | precision_to, scale_to); | 517 | 24 | } | 518 | 32 | return false; | 519 | 58 | } else { | 520 | 58 | to = ToCppT(res); | 521 | 58 | } | 522 | 90 | } | 523 | 130 | } | 524 | | } else { | 525 | | if constexpr (IsDecimal128V2<FromCppT>) { | 526 | | res = from.value() * scale_multiplier; | 527 | | } else { | 528 | | res = from.value * scale_multiplier; | 529 | | } | 530 | | if constexpr (narrow_integral) { | 531 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 532 | | if constexpr (IsDecimal128V2<FromCppT>) { | 533 | | if (params.is_strict) { | 534 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 535 | | decimal_to_string(from.value(), scale_from), | 536 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 537 | | precision_to, scale_to); | 538 | | } | 539 | | } else { | 540 | | if (params.is_strict) { | 541 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 542 | | decimal_to_string(from.value, scale_from), | 543 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 544 | | precision_to, scale_to); | 545 | | } | 546 | | } | 547 | | return false; | 548 | | } | 549 | | } | 550 | | to = ToCppT(res); | 551 | | } | 552 | 58 | return true; | 553 | 130 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_7DecimalIlEENS_12Decimal128V3ELb0ELb0EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKT3_RKNS5_10NativeTypeESF_RNS_14CastParametersE Line | Count | Source | 474 | 352 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 475 | 352 | MaxNativeType res; | 476 | | if constexpr (multiply_may_overflow) { | 477 | | if constexpr (IsDecimal128V2<FromCppT>) { | 478 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 479 | | res)) { | 480 | | if (params.is_strict) { | 481 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 482 | | decimal_to_string(from.value(), scale_from), | 483 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 484 | | precision_to, scale_to); | 485 | | } | 486 | | return false; | 487 | | } else { | 488 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 489 | | if (params.is_strict) { | 490 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 491 | | decimal_to_string(from.value(), scale_from), | 492 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 493 | | precision_to, scale_to); | 494 | | } | 495 | | return false; | 496 | | } else { | 497 | | to = ToCppT(res); | 498 | | } | 499 | | } | 500 | | } else { | 501 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 502 | | res)) { | 503 | | if (params.is_strict) { | 504 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 505 | | decimal_to_string(from.value, scale_from), | 506 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 507 | | precision_to, scale_to); | 508 | | } | 509 | | return false; | 510 | | } else { | 511 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 512 | | if (params.is_strict) { | 513 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 514 | | decimal_to_string(from.value, scale_from), | 515 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 516 | | precision_to, scale_to); | 517 | | } | 518 | | return false; | 519 | | } else { | 520 | | to = ToCppT(res); | 521 | | } | 522 | | } | 523 | | } | 524 | 352 | } else { | 525 | | if constexpr (IsDecimal128V2<FromCppT>) { | 526 | | res = from.value() * scale_multiplier; | 527 | 352 | } else { | 528 | 352 | res = from.value * scale_multiplier; | 529 | 352 | } | 530 | | if constexpr (narrow_integral) { | 531 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 532 | | if constexpr (IsDecimal128V2<FromCppT>) { | 533 | | if (params.is_strict) { | 534 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 535 | | decimal_to_string(from.value(), scale_from), | 536 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 537 | | precision_to, scale_to); | 538 | | } | 539 | | } else { | 540 | | if (params.is_strict) { | 541 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 542 | | decimal_to_string(from.value, scale_from), | 543 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 544 | | precision_to, scale_to); | 545 | | } | 546 | | } | 547 | | return false; | 548 | | } | 549 | | } | 550 | 352 | to = ToCppT(res); | 551 | 352 | } | 552 | 352 | return true; | 553 | 352 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_7DecimalIlEENS_12Decimal128V3ELb0ELb1EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKT3_RKNS5_10NativeTypeESF_RNS_14CastParametersE Line | Count | Source | 474 | 232 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 475 | 232 | MaxNativeType res; | 476 | | if constexpr (multiply_may_overflow) { | 477 | | if constexpr (IsDecimal128V2<FromCppT>) { | 478 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 479 | | res)) { | 480 | | if (params.is_strict) { | 481 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 482 | | decimal_to_string(from.value(), scale_from), | 483 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 484 | | precision_to, scale_to); | 485 | | } | 486 | | return false; | 487 | | } else { | 488 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 489 | | if (params.is_strict) { | 490 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 491 | | decimal_to_string(from.value(), scale_from), | 492 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 493 | | precision_to, scale_to); | 494 | | } | 495 | | return false; | 496 | | } else { | 497 | | to = ToCppT(res); | 498 | | } | 499 | | } | 500 | | } else { | 501 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 502 | | res)) { | 503 | | if (params.is_strict) { | 504 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 505 | | decimal_to_string(from.value, scale_from), | 506 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 507 | | precision_to, scale_to); | 508 | | } | 509 | | return false; | 510 | | } else { | 511 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 512 | | if (params.is_strict) { | 513 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 514 | | decimal_to_string(from.value, scale_from), | 515 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 516 | | precision_to, scale_to); | 517 | | } | 518 | | return false; | 519 | | } else { | 520 | | to = ToCppT(res); | 521 | | } | 522 | | } | 523 | | } | 524 | 232 | } else { | 525 | | if constexpr (IsDecimal128V2<FromCppT>) { | 526 | | res = from.value() * scale_multiplier; | 527 | 232 | } else { | 528 | 232 | res = from.value * scale_multiplier; | 529 | 232 | } | 530 | 232 | if constexpr (narrow_integral) { | 531 | 232 | if (UNLIKELY(res > max_result || res < -max_result)) { | 532 | | if constexpr (IsDecimal128V2<FromCppT>) { | 533 | | if (params.is_strict) { | 534 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 535 | | decimal_to_string(from.value(), scale_from), | 536 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 537 | | precision_to, scale_to); | 538 | | } | 539 | 120 | } else { | 540 | 120 | if (params.is_strict) { | 541 | 60 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 542 | 60 | decimal_to_string(from.value, scale_from), | 543 | 60 | fmt::format("decimal({}, {})", precision_from, scale_from), | 544 | 60 | precision_to, scale_to); | 545 | 60 | } | 546 | 120 | } | 547 | 120 | return false; | 548 | 120 | } | 549 | 232 | } | 550 | 112 | to = ToCppT(res); | 551 | 232 | } | 552 | 0 | return true; | 553 | 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 | 474 | 232 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 475 | 232 | MaxNativeType res; | 476 | 232 | if constexpr (multiply_may_overflow) { | 477 | | if constexpr (IsDecimal128V2<FromCppT>) { | 478 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 479 | | res)) { | 480 | | if (params.is_strict) { | 481 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 482 | | decimal_to_string(from.value(), scale_from), | 483 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 484 | | precision_to, scale_to); | 485 | | } | 486 | | return false; | 487 | | } else { | 488 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 489 | | if (params.is_strict) { | 490 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 491 | | decimal_to_string(from.value(), scale_from), | 492 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 493 | | precision_to, scale_to); | 494 | | } | 495 | | return false; | 496 | | } else { | 497 | | to = ToCppT(res); | 498 | | } | 499 | | } | 500 | 232 | } else { | 501 | 232 | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 502 | 232 | res)) { | 503 | 72 | if (params.is_strict) { | 504 | 24 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 505 | 24 | decimal_to_string(from.value, scale_from), | 506 | 24 | fmt::format("decimal({}, {})", precision_from, scale_from), | 507 | 24 | precision_to, scale_to); | 508 | 24 | } | 509 | 72 | return false; | 510 | 160 | } else { | 511 | 160 | if (UNLIKELY(res > max_result || res < -max_result)) { | 512 | 48 | if (params.is_strict) { | 513 | 36 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 514 | 36 | decimal_to_string(from.value, scale_from), | 515 | 36 | fmt::format("decimal({}, {})", precision_from, scale_from), | 516 | 36 | precision_to, scale_to); | 517 | 36 | } | 518 | 48 | return false; | 519 | 112 | } else { | 520 | 112 | to = ToCppT(res); | 521 | 112 | } | 522 | 160 | } | 523 | 232 | } | 524 | | } else { | 525 | | if constexpr (IsDecimal128V2<FromCppT>) { | 526 | | res = from.value() * scale_multiplier; | 527 | | } else { | 528 | | res = from.value * scale_multiplier; | 529 | | } | 530 | | if constexpr (narrow_integral) { | 531 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 532 | | if constexpr (IsDecimal128V2<FromCppT>) { | 533 | | if (params.is_strict) { | 534 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 535 | | decimal_to_string(from.value(), scale_from), | 536 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 537 | | precision_to, scale_to); | 538 | | } | 539 | | } else { | 540 | | if (params.is_strict) { | 541 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 542 | | decimal_to_string(from.value, scale_from), | 543 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 544 | | precision_to, scale_to); | 545 | | } | 546 | | } | 547 | | return false; | 548 | | } | 549 | | } | 550 | | to = ToCppT(res); | 551 | | } | 552 | 112 | return true; | 553 | 232 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_12Decimal128V3ES2_Lb0ELb0EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS4_jjRS3_jjRKT3_RKNS3_10NativeTypeESD_RNS_14CastParametersE Line | Count | Source | 474 | 92 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 475 | 92 | MaxNativeType res; | 476 | | if constexpr (multiply_may_overflow) { | 477 | | if constexpr (IsDecimal128V2<FromCppT>) { | 478 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 479 | | res)) { | 480 | | if (params.is_strict) { | 481 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 482 | | decimal_to_string(from.value(), scale_from), | 483 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 484 | | precision_to, scale_to); | 485 | | } | 486 | | return false; | 487 | | } else { | 488 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 489 | | if (params.is_strict) { | 490 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 491 | | decimal_to_string(from.value(), scale_from), | 492 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 493 | | precision_to, scale_to); | 494 | | } | 495 | | return false; | 496 | | } else { | 497 | | to = ToCppT(res); | 498 | | } | 499 | | } | 500 | | } else { | 501 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 502 | | res)) { | 503 | | if (params.is_strict) { | 504 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 505 | | decimal_to_string(from.value, scale_from), | 506 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 507 | | precision_to, scale_to); | 508 | | } | 509 | | return false; | 510 | | } else { | 511 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 512 | | if (params.is_strict) { | 513 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 514 | | decimal_to_string(from.value, scale_from), | 515 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 516 | | precision_to, scale_to); | 517 | | } | 518 | | return false; | 519 | | } else { | 520 | | to = ToCppT(res); | 521 | | } | 522 | | } | 523 | | } | 524 | 92 | } else { | 525 | | if constexpr (IsDecimal128V2<FromCppT>) { | 526 | | res = from.value() * scale_multiplier; | 527 | 92 | } else { | 528 | 92 | res = from.value * scale_multiplier; | 529 | 92 | } | 530 | | if constexpr (narrow_integral) { | 531 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 532 | | if constexpr (IsDecimal128V2<FromCppT>) { | 533 | | if (params.is_strict) { | 534 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 535 | | decimal_to_string(from.value(), scale_from), | 536 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 537 | | precision_to, scale_to); | 538 | | } | 539 | | } else { | 540 | | if (params.is_strict) { | 541 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 542 | | decimal_to_string(from.value, scale_from), | 543 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 544 | | precision_to, scale_to); | 545 | | } | 546 | | } | 547 | | return false; | 548 | | } | 549 | | } | 550 | 92 | to = ToCppT(res); | 551 | 92 | } | 552 | 92 | return true; | 553 | 92 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_12Decimal128V3ES2_Lb0ELb1EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS4_jjRS3_jjRKT3_RKNS3_10NativeTypeESD_RNS_14CastParametersE Line | Count | Source | 474 | 140 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 475 | 140 | MaxNativeType res; | 476 | | if constexpr (multiply_may_overflow) { | 477 | | if constexpr (IsDecimal128V2<FromCppT>) { | 478 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 479 | | res)) { | 480 | | if (params.is_strict) { | 481 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 482 | | decimal_to_string(from.value(), scale_from), | 483 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 484 | | precision_to, scale_to); | 485 | | } | 486 | | return false; | 487 | | } else { | 488 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 489 | | if (params.is_strict) { | 490 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 491 | | decimal_to_string(from.value(), scale_from), | 492 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 493 | | precision_to, scale_to); | 494 | | } | 495 | | return false; | 496 | | } else { | 497 | | to = ToCppT(res); | 498 | | } | 499 | | } | 500 | | } else { | 501 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 502 | | res)) { | 503 | | if (params.is_strict) { | 504 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 505 | | decimal_to_string(from.value, scale_from), | 506 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 507 | | precision_to, scale_to); | 508 | | } | 509 | | return false; | 510 | | } else { | 511 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 512 | | if (params.is_strict) { | 513 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 514 | | decimal_to_string(from.value, scale_from), | 515 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 516 | | precision_to, scale_to); | 517 | | } | 518 | | return false; | 519 | | } else { | 520 | | to = ToCppT(res); | 521 | | } | 522 | | } | 523 | | } | 524 | 140 | } else { | 525 | | if constexpr (IsDecimal128V2<FromCppT>) { | 526 | | res = from.value() * scale_multiplier; | 527 | 140 | } else { | 528 | 140 | res = from.value * scale_multiplier; | 529 | 140 | } | 530 | 140 | if constexpr (narrow_integral) { | 531 | 140 | if (UNLIKELY(res > max_result || res < -max_result)) { | 532 | | if constexpr (IsDecimal128V2<FromCppT>) { | 533 | | if (params.is_strict) { | 534 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 535 | | decimal_to_string(from.value(), scale_from), | 536 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 537 | | precision_to, scale_to); | 538 | | } | 539 | 72 | } else { | 540 | 72 | if (params.is_strict) { | 541 | 36 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 542 | 36 | decimal_to_string(from.value, scale_from), | 543 | 36 | fmt::format("decimal({}, {})", precision_from, scale_from), | 544 | 36 | precision_to, scale_to); | 545 | 36 | } | 546 | 72 | } | 547 | 72 | return false; | 548 | 72 | } | 549 | 140 | } | 550 | 68 | to = ToCppT(res); | 551 | 140 | } | 552 | 0 | return true; | 553 | 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 | 474 | 368 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 475 | 368 | MaxNativeType res; | 476 | 368 | if constexpr (multiply_may_overflow) { | 477 | | if constexpr (IsDecimal128V2<FromCppT>) { | 478 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 479 | | res)) { | 480 | | if (params.is_strict) { | 481 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 482 | | decimal_to_string(from.value(), scale_from), | 483 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 484 | | precision_to, scale_to); | 485 | | } | 486 | | return false; | 487 | | } else { | 488 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 489 | | if (params.is_strict) { | 490 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 491 | | decimal_to_string(from.value(), scale_from), | 492 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 493 | | precision_to, scale_to); | 494 | | } | 495 | | return false; | 496 | | } else { | 497 | | to = ToCppT(res); | 498 | | } | 499 | | } | 500 | 368 | } else { | 501 | 368 | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 502 | 368 | res)) { | 503 | 96 | if (params.is_strict) { | 504 | 24 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 505 | 24 | decimal_to_string(from.value, scale_from), | 506 | 24 | fmt::format("decimal({}, {})", precision_from, scale_from), | 507 | 24 | precision_to, scale_to); | 508 | 24 | } | 509 | 96 | return false; | 510 | 272 | } else { | 511 | 272 | if (UNLIKELY(res > max_result || res < -max_result)) { | 512 | 96 | if (params.is_strict) { | 513 | 72 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 514 | 72 | decimal_to_string(from.value, scale_from), | 515 | 72 | fmt::format("decimal({}, {})", precision_from, scale_from), | 516 | 72 | precision_to, scale_to); | 517 | 72 | } | 518 | 96 | return false; | 519 | 176 | } else { | 520 | 176 | to = ToCppT(res); | 521 | 176 | } | 522 | 272 | } | 523 | 368 | } | 524 | | } else { | 525 | | if constexpr (IsDecimal128V2<FromCppT>) { | 526 | | res = from.value() * scale_multiplier; | 527 | | } else { | 528 | | res = from.value * scale_multiplier; | 529 | | } | 530 | | if constexpr (narrow_integral) { | 531 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 532 | | if constexpr (IsDecimal128V2<FromCppT>) { | 533 | | if (params.is_strict) { | 534 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 535 | | decimal_to_string(from.value(), scale_from), | 536 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 537 | | precision_to, scale_to); | 538 | | } | 539 | | } else { | 540 | | if (params.is_strict) { | 541 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 542 | | decimal_to_string(from.value, scale_from), | 543 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 544 | | precision_to, scale_to); | 545 | | } | 546 | | } | 547 | | return false; | 548 | | } | 549 | | } | 550 | | to = ToCppT(res); | 551 | | } | 552 | 176 | return true; | 553 | 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 | 474 | 448 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 475 | 448 | MaxNativeType res; | 476 | 448 | if constexpr (multiply_may_overflow) { | 477 | | if constexpr (IsDecimal128V2<FromCppT>) { | 478 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 479 | | res)) { | 480 | | if (params.is_strict) { | 481 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 482 | | decimal_to_string(from.value(), scale_from), | 483 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 484 | | precision_to, scale_to); | 485 | | } | 486 | | return false; | 487 | | } else { | 488 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 489 | | if (params.is_strict) { | 490 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 491 | | decimal_to_string(from.value(), scale_from), | 492 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 493 | | precision_to, scale_to); | 494 | | } | 495 | | return false; | 496 | | } else { | 497 | | to = ToCppT(res); | 498 | | } | 499 | | } | 500 | 448 | } else { | 501 | 448 | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 502 | 448 | res)) { | 503 | 44 | if (params.is_strict) { | 504 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 505 | 0 | decimal_to_string(from.value, scale_from), | 506 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 507 | 0 | precision_to, scale_to); | 508 | 0 | } | 509 | 44 | return false; | 510 | 404 | } else { | 511 | 404 | if (UNLIKELY(res > max_result || res < -max_result)) { | 512 | 196 | if (params.is_strict) { | 513 | 120 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 514 | 120 | decimal_to_string(from.value, scale_from), | 515 | 120 | fmt::format("decimal({}, {})", precision_from, scale_from), | 516 | 120 | precision_to, scale_to); | 517 | 120 | } | 518 | 196 | return false; | 519 | 208 | } else { | 520 | 208 | to = ToCppT(res); | 521 | 208 | } | 522 | 404 | } | 523 | 448 | } | 524 | | } else { | 525 | | if constexpr (IsDecimal128V2<FromCppT>) { | 526 | | res = from.value() * scale_multiplier; | 527 | | } else { | 528 | | res = from.value * scale_multiplier; | 529 | | } | 530 | | if constexpr (narrow_integral) { | 531 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 532 | | if constexpr (IsDecimal128V2<FromCppT>) { | 533 | | if (params.is_strict) { | 534 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 535 | | decimal_to_string(from.value(), scale_from), | 536 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 537 | | precision_to, scale_to); | 538 | | } | 539 | | } else { | 540 | | if (params.is_strict) { | 541 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 542 | | decimal_to_string(from.value, scale_from), | 543 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 544 | | precision_to, scale_to); | 545 | | } | 546 | | } | 547 | | return false; | 548 | | } | 549 | | } | 550 | | to = ToCppT(res); | 551 | | } | 552 | 208 | return true; | 553 | 448 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_7DecimalIiEENS2_IN4wide7integerILm256EiEEEELb0ELb0ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKT3_RKNS8_10NativeTypeESI_RNS_14CastParametersE Line | Count | Source | 474 | 240 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 475 | 240 | MaxNativeType res; | 476 | | if constexpr (multiply_may_overflow) { | 477 | | if constexpr (IsDecimal128V2<FromCppT>) { | 478 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 479 | | res)) { | 480 | | if (params.is_strict) { | 481 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 482 | | decimal_to_string(from.value(), scale_from), | 483 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 484 | | precision_to, scale_to); | 485 | | } | 486 | | return false; | 487 | | } else { | 488 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 489 | | if (params.is_strict) { | 490 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 491 | | decimal_to_string(from.value(), scale_from), | 492 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 493 | | precision_to, scale_to); | 494 | | } | 495 | | return false; | 496 | | } else { | 497 | | to = ToCppT(res); | 498 | | } | 499 | | } | 500 | | } else { | 501 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 502 | | res)) { | 503 | | if (params.is_strict) { | 504 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 505 | | decimal_to_string(from.value, scale_from), | 506 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 507 | | precision_to, scale_to); | 508 | | } | 509 | | return false; | 510 | | } else { | 511 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 512 | | if (params.is_strict) { | 513 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 514 | | decimal_to_string(from.value, scale_from), | 515 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 516 | | precision_to, scale_to); | 517 | | } | 518 | | return false; | 519 | | } else { | 520 | | to = ToCppT(res); | 521 | | } | 522 | | } | 523 | | } | 524 | 240 | } else { | 525 | | if constexpr (IsDecimal128V2<FromCppT>) { | 526 | | res = from.value() * scale_multiplier; | 527 | 240 | } else { | 528 | 240 | res = from.value * scale_multiplier; | 529 | 240 | } | 530 | | if constexpr (narrow_integral) { | 531 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 532 | | if constexpr (IsDecimal128V2<FromCppT>) { | 533 | | if (params.is_strict) { | 534 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 535 | | decimal_to_string(from.value(), scale_from), | 536 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 537 | | precision_to, scale_to); | 538 | | } | 539 | | } else { | 540 | | if (params.is_strict) { | 541 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 542 | | decimal_to_string(from.value, scale_from), | 543 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 544 | | precision_to, scale_to); | 545 | | } | 546 | | } | 547 | | return false; | 548 | | } | 549 | | } | 550 | 240 | to = ToCppT(res); | 551 | 240 | } | 552 | 240 | return true; | 553 | 240 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_7DecimalIiEENS2_IN4wide7integerILm256EiEEEELb0ELb1ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKT3_RKNS8_10NativeTypeESI_RNS_14CastParametersE Line | Count | Source | 474 | 130 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 475 | 130 | MaxNativeType res; | 476 | | if constexpr (multiply_may_overflow) { | 477 | | if constexpr (IsDecimal128V2<FromCppT>) { | 478 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 479 | | res)) { | 480 | | if (params.is_strict) { | 481 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 482 | | decimal_to_string(from.value(), scale_from), | 483 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 484 | | precision_to, scale_to); | 485 | | } | 486 | | return false; | 487 | | } else { | 488 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 489 | | if (params.is_strict) { | 490 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 491 | | decimal_to_string(from.value(), scale_from), | 492 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 493 | | precision_to, scale_to); | 494 | | } | 495 | | return false; | 496 | | } else { | 497 | | to = ToCppT(res); | 498 | | } | 499 | | } | 500 | | } else { | 501 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 502 | | res)) { | 503 | | if (params.is_strict) { | 504 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 505 | | decimal_to_string(from.value, scale_from), | 506 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 507 | | precision_to, scale_to); | 508 | | } | 509 | | return false; | 510 | | } else { | 511 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 512 | | if (params.is_strict) { | 513 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 514 | | decimal_to_string(from.value, scale_from), | 515 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 516 | | precision_to, scale_to); | 517 | | } | 518 | | return false; | 519 | | } else { | 520 | | to = ToCppT(res); | 521 | | } | 522 | | } | 523 | | } | 524 | 130 | } else { | 525 | | if constexpr (IsDecimal128V2<FromCppT>) { | 526 | | res = from.value() * scale_multiplier; | 527 | 130 | } else { | 528 | 130 | res = from.value * scale_multiplier; | 529 | 130 | } | 530 | 130 | if constexpr (narrow_integral) { | 531 | 130 | if (UNLIKELY(res > max_result || res < -max_result)) { | 532 | | if constexpr (IsDecimal128V2<FromCppT>) { | 533 | | if (params.is_strict) { | 534 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 535 | | decimal_to_string(from.value(), scale_from), | 536 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 537 | | precision_to, scale_to); | 538 | | } | 539 | 72 | } else { | 540 | 72 | if (params.is_strict) { | 541 | 36 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 542 | 36 | decimal_to_string(from.value, scale_from), | 543 | 36 | fmt::format("decimal({}, {})", precision_from, scale_from), | 544 | 36 | precision_to, scale_to); | 545 | 36 | } | 546 | 72 | } | 547 | 72 | return false; | 548 | 72 | } | 549 | 130 | } | 550 | 58 | to = ToCppT(res); | 551 | 130 | } | 552 | 0 | return true; | 553 | 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 | 474 | 130 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 475 | 130 | MaxNativeType res; | 476 | 130 | if constexpr (multiply_may_overflow) { | 477 | | if constexpr (IsDecimal128V2<FromCppT>) { | 478 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 479 | | res)) { | 480 | | if (params.is_strict) { | 481 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 482 | | decimal_to_string(from.value(), scale_from), | 483 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 484 | | precision_to, scale_to); | 485 | | } | 486 | | return false; | 487 | | } else { | 488 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 489 | | if (params.is_strict) { | 490 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 491 | | decimal_to_string(from.value(), scale_from), | 492 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 493 | | precision_to, scale_to); | 494 | | } | 495 | | return false; | 496 | | } else { | 497 | | to = ToCppT(res); | 498 | | } | 499 | | } | 500 | 130 | } else { | 501 | 130 | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 502 | 130 | res)) { | 503 | 24 | if (params.is_strict) { | 504 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 505 | 0 | decimal_to_string(from.value, scale_from), | 506 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 507 | 0 | precision_to, scale_to); | 508 | 0 | } | 509 | 24 | return false; | 510 | 106 | } else { | 511 | 106 | if (UNLIKELY(res > max_result || res < -max_result)) { | 512 | 48 | if (params.is_strict) { | 513 | 36 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 514 | 36 | decimal_to_string(from.value, scale_from), | 515 | 36 | fmt::format("decimal({}, {})", precision_from, scale_from), | 516 | 36 | precision_to, scale_to); | 517 | 36 | } | 518 | 48 | return false; | 519 | 58 | } else { | 520 | 58 | to = ToCppT(res); | 521 | 58 | } | 522 | 106 | } | 523 | 130 | } | 524 | | } else { | 525 | | if constexpr (IsDecimal128V2<FromCppT>) { | 526 | | res = from.value() * scale_multiplier; | 527 | | } else { | 528 | | res = from.value * scale_multiplier; | 529 | | } | 530 | | if constexpr (narrow_integral) { | 531 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 532 | | if constexpr (IsDecimal128V2<FromCppT>) { | 533 | | if (params.is_strict) { | 534 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 535 | | decimal_to_string(from.value(), scale_from), | 536 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 537 | | precision_to, scale_to); | 538 | | } | 539 | | } else { | 540 | | if (params.is_strict) { | 541 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 542 | | decimal_to_string(from.value, scale_from), | 543 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 544 | | precision_to, scale_to); | 545 | | } | 546 | | } | 547 | | return false; | 548 | | } | 549 | | } | 550 | | to = ToCppT(res); | 551 | | } | 552 | 58 | return true; | 553 | 130 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_7DecimalIlEENS2_IN4wide7integerILm256EiEEEELb0ELb0ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKT3_RKNS8_10NativeTypeESI_RNS_14CastParametersE Line | Count | Source | 474 | 368 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 475 | 368 | MaxNativeType res; | 476 | | if constexpr (multiply_may_overflow) { | 477 | | if constexpr (IsDecimal128V2<FromCppT>) { | 478 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 479 | | res)) { | 480 | | if (params.is_strict) { | 481 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 482 | | decimal_to_string(from.value(), scale_from), | 483 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 484 | | precision_to, scale_to); | 485 | | } | 486 | | return false; | 487 | | } else { | 488 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 489 | | if (params.is_strict) { | 490 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 491 | | decimal_to_string(from.value(), scale_from), | 492 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 493 | | precision_to, scale_to); | 494 | | } | 495 | | return false; | 496 | | } else { | 497 | | to = ToCppT(res); | 498 | | } | 499 | | } | 500 | | } else { | 501 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 502 | | res)) { | 503 | | if (params.is_strict) { | 504 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 505 | | decimal_to_string(from.value, scale_from), | 506 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 507 | | precision_to, scale_to); | 508 | | } | 509 | | return false; | 510 | | } else { | 511 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 512 | | if (params.is_strict) { | 513 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 514 | | decimal_to_string(from.value, scale_from), | 515 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 516 | | precision_to, scale_to); | 517 | | } | 518 | | return false; | 519 | | } else { | 520 | | to = ToCppT(res); | 521 | | } | 522 | | } | 523 | | } | 524 | 368 | } else { | 525 | | if constexpr (IsDecimal128V2<FromCppT>) { | 526 | | res = from.value() * scale_multiplier; | 527 | 368 | } else { | 528 | 368 | res = from.value * scale_multiplier; | 529 | 368 | } | 530 | | if constexpr (narrow_integral) { | 531 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 532 | | if constexpr (IsDecimal128V2<FromCppT>) { | 533 | | if (params.is_strict) { | 534 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 535 | | decimal_to_string(from.value(), scale_from), | 536 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 537 | | precision_to, scale_to); | 538 | | } | 539 | | } else { | 540 | | if (params.is_strict) { | 541 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 542 | | decimal_to_string(from.value, scale_from), | 543 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 544 | | precision_to, scale_to); | 545 | | } | 546 | | } | 547 | | return false; | 548 | | } | 549 | | } | 550 | 368 | to = ToCppT(res); | 551 | 368 | } | 552 | 368 | return true; | 553 | 368 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_7DecimalIlEENS2_IN4wide7integerILm256EiEEEELb0ELb1ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKT3_RKNS8_10NativeTypeESI_RNS_14CastParametersE Line | Count | Source | 474 | 232 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 475 | 232 | MaxNativeType res; | 476 | | if constexpr (multiply_may_overflow) { | 477 | | if constexpr (IsDecimal128V2<FromCppT>) { | 478 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 479 | | res)) { | 480 | | if (params.is_strict) { | 481 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 482 | | decimal_to_string(from.value(), scale_from), | 483 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 484 | | precision_to, scale_to); | 485 | | } | 486 | | return false; | 487 | | } else { | 488 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 489 | | if (params.is_strict) { | 490 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 491 | | decimal_to_string(from.value(), scale_from), | 492 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 493 | | precision_to, scale_to); | 494 | | } | 495 | | return false; | 496 | | } else { | 497 | | to = ToCppT(res); | 498 | | } | 499 | | } | 500 | | } else { | 501 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 502 | | res)) { | 503 | | if (params.is_strict) { | 504 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 505 | | decimal_to_string(from.value, scale_from), | 506 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 507 | | precision_to, scale_to); | 508 | | } | 509 | | return false; | 510 | | } else { | 511 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 512 | | if (params.is_strict) { | 513 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 514 | | decimal_to_string(from.value, scale_from), | 515 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 516 | | precision_to, scale_to); | 517 | | } | 518 | | return false; | 519 | | } else { | 520 | | to = ToCppT(res); | 521 | | } | 522 | | } | 523 | | } | 524 | 232 | } else { | 525 | | if constexpr (IsDecimal128V2<FromCppT>) { | 526 | | res = from.value() * scale_multiplier; | 527 | 232 | } else { | 528 | 232 | res = from.value * scale_multiplier; | 529 | 232 | } | 530 | 232 | if constexpr (narrow_integral) { | 531 | 232 | if (UNLIKELY(res > max_result || res < -max_result)) { | 532 | | if constexpr (IsDecimal128V2<FromCppT>) { | 533 | | if (params.is_strict) { | 534 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 535 | | decimal_to_string(from.value(), scale_from), | 536 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 537 | | precision_to, scale_to); | 538 | | } | 539 | 120 | } else { | 540 | 120 | if (params.is_strict) { | 541 | 60 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 542 | 60 | decimal_to_string(from.value, scale_from), | 543 | 60 | fmt::format("decimal({}, {})", precision_from, scale_from), | 544 | 60 | precision_to, scale_to); | 545 | 60 | } | 546 | 120 | } | 547 | 120 | return false; | 548 | 120 | } | 549 | 232 | } | 550 | 112 | to = ToCppT(res); | 551 | 232 | } | 552 | 0 | return true; | 553 | 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 | 474 | 232 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 475 | 232 | MaxNativeType res; | 476 | 232 | if constexpr (multiply_may_overflow) { | 477 | | if constexpr (IsDecimal128V2<FromCppT>) { | 478 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 479 | | res)) { | 480 | | if (params.is_strict) { | 481 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 482 | | decimal_to_string(from.value(), scale_from), | 483 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 484 | | precision_to, scale_to); | 485 | | } | 486 | | return false; | 487 | | } else { | 488 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 489 | | if (params.is_strict) { | 490 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 491 | | decimal_to_string(from.value(), scale_from), | 492 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 493 | | precision_to, scale_to); | 494 | | } | 495 | | return false; | 496 | | } else { | 497 | | to = ToCppT(res); | 498 | | } | 499 | | } | 500 | 232 | } else { | 501 | 232 | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 502 | 232 | res)) { | 503 | 40 | if (params.is_strict) { | 504 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 505 | 0 | decimal_to_string(from.value, scale_from), | 506 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 507 | 0 | precision_to, scale_to); | 508 | 0 | } | 509 | 40 | return false; | 510 | 192 | } else { | 511 | 192 | if (UNLIKELY(res > max_result || res < -max_result)) { | 512 | 80 | if (params.is_strict) { | 513 | 60 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 514 | 60 | decimal_to_string(from.value, scale_from), | 515 | 60 | fmt::format("decimal({}, {})", precision_from, scale_from), | 516 | 60 | precision_to, scale_to); | 517 | 60 | } | 518 | 80 | return false; | 519 | 112 | } else { | 520 | 112 | to = ToCppT(res); | 521 | 112 | } | 522 | 192 | } | 523 | 232 | } | 524 | | } else { | 525 | | if constexpr (IsDecimal128V2<FromCppT>) { | 526 | | res = from.value() * scale_multiplier; | 527 | | } else { | 528 | | res = from.value * scale_multiplier; | 529 | | } | 530 | | if constexpr (narrow_integral) { | 531 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 532 | | if constexpr (IsDecimal128V2<FromCppT>) { | 533 | | if (params.is_strict) { | 534 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 535 | | decimal_to_string(from.value(), scale_from), | 536 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 537 | | precision_to, scale_to); | 538 | | } | 539 | | } else { | 540 | | if (params.is_strict) { | 541 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 542 | | decimal_to_string(from.value, scale_from), | 543 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 544 | | precision_to, scale_to); | 545 | | } | 546 | | } | 547 | | return false; | 548 | | } | 549 | | } | 550 | | to = ToCppT(res); | 551 | | } | 552 | 112 | return true; | 553 | 232 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_12Decimal128V3ENS_7DecimalIN4wide7integerILm256EiEEEELb0ELb0ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKT3_RKNS8_10NativeTypeESI_RNS_14CastParametersE Line | Count | Source | 474 | 352 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 475 | 352 | MaxNativeType res; | 476 | | if constexpr (multiply_may_overflow) { | 477 | | if constexpr (IsDecimal128V2<FromCppT>) { | 478 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 479 | | res)) { | 480 | | if (params.is_strict) { | 481 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 482 | | decimal_to_string(from.value(), scale_from), | 483 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 484 | | precision_to, scale_to); | 485 | | } | 486 | | return false; | 487 | | } else { | 488 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 489 | | if (params.is_strict) { | 490 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 491 | | decimal_to_string(from.value(), scale_from), | 492 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 493 | | precision_to, scale_to); | 494 | | } | 495 | | return false; | 496 | | } else { | 497 | | to = ToCppT(res); | 498 | | } | 499 | | } | 500 | | } else { | 501 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 502 | | res)) { | 503 | | if (params.is_strict) { | 504 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 505 | | decimal_to_string(from.value, scale_from), | 506 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 507 | | precision_to, scale_to); | 508 | | } | 509 | | return false; | 510 | | } else { | 511 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 512 | | if (params.is_strict) { | 513 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 514 | | decimal_to_string(from.value, scale_from), | 515 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 516 | | precision_to, scale_to); | 517 | | } | 518 | | return false; | 519 | | } else { | 520 | | to = ToCppT(res); | 521 | | } | 522 | | } | 523 | | } | 524 | 352 | } else { | 525 | | if constexpr (IsDecimal128V2<FromCppT>) { | 526 | | res = from.value() * scale_multiplier; | 527 | 352 | } else { | 528 | 352 | res = from.value * scale_multiplier; | 529 | 352 | } | 530 | | if constexpr (narrow_integral) { | 531 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 532 | | if constexpr (IsDecimal128V2<FromCppT>) { | 533 | | if (params.is_strict) { | 534 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 535 | | decimal_to_string(from.value(), scale_from), | 536 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 537 | | precision_to, scale_to); | 538 | | } | 539 | | } else { | 540 | | if (params.is_strict) { | 541 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 542 | | decimal_to_string(from.value, scale_from), | 543 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 544 | | precision_to, scale_to); | 545 | | } | 546 | | } | 547 | | return false; | 548 | | } | 549 | | } | 550 | 352 | to = ToCppT(res); | 551 | 352 | } | 552 | 352 | return true; | 553 | 352 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_12Decimal128V3ENS_7DecimalIN4wide7integerILm256EiEEEELb0ELb1ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKT3_RKNS8_10NativeTypeESI_RNS_14CastParametersE Line | Count | Source | 474 | 218 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 475 | 218 | MaxNativeType res; | 476 | | if constexpr (multiply_may_overflow) { | 477 | | if constexpr (IsDecimal128V2<FromCppT>) { | 478 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 479 | | res)) { | 480 | | if (params.is_strict) { | 481 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 482 | | decimal_to_string(from.value(), scale_from), | 483 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 484 | | precision_to, scale_to); | 485 | | } | 486 | | return false; | 487 | | } else { | 488 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 489 | | if (params.is_strict) { | 490 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 491 | | decimal_to_string(from.value(), scale_from), | 492 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 493 | | precision_to, scale_to); | 494 | | } | 495 | | return false; | 496 | | } else { | 497 | | to = ToCppT(res); | 498 | | } | 499 | | } | 500 | | } else { | 501 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 502 | | res)) { | 503 | | if (params.is_strict) { | 504 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 505 | | decimal_to_string(from.value, scale_from), | 506 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 507 | | precision_to, scale_to); | 508 | | } | 509 | | return false; | 510 | | } else { | 511 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 512 | | if (params.is_strict) { | 513 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 514 | | decimal_to_string(from.value, scale_from), | 515 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 516 | | precision_to, scale_to); | 517 | | } | 518 | | return false; | 519 | | } else { | 520 | | to = ToCppT(res); | 521 | | } | 522 | | } | 523 | | } | 524 | 218 | } else { | 525 | | if constexpr (IsDecimal128V2<FromCppT>) { | 526 | | res = from.value() * scale_multiplier; | 527 | 218 | } else { | 528 | 218 | res = from.value * scale_multiplier; | 529 | 218 | } | 530 | 218 | if constexpr (narrow_integral) { | 531 | 218 | if (UNLIKELY(res > max_result || res < -max_result)) { | 532 | | if constexpr (IsDecimal128V2<FromCppT>) { | 533 | | if (params.is_strict) { | 534 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 535 | | decimal_to_string(from.value(), scale_from), | 536 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 537 | | precision_to, scale_to); | 538 | | } | 539 | 108 | } else { | 540 | 108 | if (params.is_strict) { | 541 | 54 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 542 | 54 | decimal_to_string(from.value, scale_from), | 543 | 54 | fmt::format("decimal({}, {})", precision_from, scale_from), | 544 | 54 | precision_to, scale_to); | 545 | 54 | } | 546 | 108 | } | 547 | 108 | return false; | 548 | 108 | } | 549 | 218 | } | 550 | 110 | to = ToCppT(res); | 551 | 218 | } | 552 | 0 | return true; | 553 | 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 | 474 | 246 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 475 | 246 | MaxNativeType res; | 476 | 246 | if constexpr (multiply_may_overflow) { | 477 | | if constexpr (IsDecimal128V2<FromCppT>) { | 478 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 479 | | res)) { | 480 | | if (params.is_strict) { | 481 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 482 | | decimal_to_string(from.value(), scale_from), | 483 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 484 | | precision_to, scale_to); | 485 | | } | 486 | | return false; | 487 | | } else { | 488 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 489 | | if (params.is_strict) { | 490 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 491 | | decimal_to_string(from.value(), scale_from), | 492 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 493 | | precision_to, scale_to); | 494 | | } | 495 | | return false; | 496 | | } else { | 497 | | to = ToCppT(res); | 498 | | } | 499 | | } | 500 | 246 | } else { | 501 | 246 | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 502 | 246 | res)) { | 503 | 44 | if (params.is_strict) { | 504 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 505 | 0 | decimal_to_string(from.value, scale_from), | 506 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 507 | 0 | precision_to, scale_to); | 508 | 0 | } | 509 | 44 | return false; | 510 | 202 | } else { | 511 | 202 | if (UNLIKELY(res > max_result || res < -max_result)) { | 512 | 88 | if (params.is_strict) { | 513 | 66 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 514 | 66 | decimal_to_string(from.value, scale_from), | 515 | 66 | fmt::format("decimal({}, {})", precision_from, scale_from), | 516 | 66 | precision_to, scale_to); | 517 | 66 | } | 518 | 88 | return false; | 519 | 114 | } else { | 520 | 114 | to = ToCppT(res); | 521 | 114 | } | 522 | 202 | } | 523 | 246 | } | 524 | | } else { | 525 | | if constexpr (IsDecimal128V2<FromCppT>) { | 526 | | res = from.value() * scale_multiplier; | 527 | | } else { | 528 | | res = from.value * scale_multiplier; | 529 | | } | 530 | | if constexpr (narrow_integral) { | 531 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 532 | | if constexpr (IsDecimal128V2<FromCppT>) { | 533 | | if (params.is_strict) { | 534 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 535 | | decimal_to_string(from.value(), scale_from), | 536 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 537 | | precision_to, scale_to); | 538 | | } | 539 | | } else { | 540 | | if (params.is_strict) { | 541 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 542 | | decimal_to_string(from.value, scale_from), | 543 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 544 | | precision_to, scale_to); | 545 | | } | 546 | | } | 547 | | return false; | 548 | | } | 549 | | } | 550 | | to = ToCppT(res); | 551 | | } | 552 | 114 | return true; | 553 | 246 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_7DecimalIN4wide7integerILm256EiEEEES6_Lb0ELb0ES5_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS8_jjRS7_jjRKT3_RKNS7_10NativeTypeESH_RNS_14CastParametersE Line | Count | Source | 474 | 92 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 475 | 92 | MaxNativeType res; | 476 | | if constexpr (multiply_may_overflow) { | 477 | | if constexpr (IsDecimal128V2<FromCppT>) { | 478 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 479 | | res)) { | 480 | | if (params.is_strict) { | 481 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 482 | | decimal_to_string(from.value(), scale_from), | 483 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 484 | | precision_to, scale_to); | 485 | | } | 486 | | return false; | 487 | | } else { | 488 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 489 | | if (params.is_strict) { | 490 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 491 | | decimal_to_string(from.value(), scale_from), | 492 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 493 | | precision_to, scale_to); | 494 | | } | 495 | | return false; | 496 | | } else { | 497 | | to = ToCppT(res); | 498 | | } | 499 | | } | 500 | | } else { | 501 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 502 | | res)) { | 503 | | if (params.is_strict) { | 504 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 505 | | decimal_to_string(from.value, scale_from), | 506 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 507 | | precision_to, scale_to); | 508 | | } | 509 | | return false; | 510 | | } else { | 511 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 512 | | if (params.is_strict) { | 513 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 514 | | decimal_to_string(from.value, scale_from), | 515 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 516 | | precision_to, scale_to); | 517 | | } | 518 | | return false; | 519 | | } else { | 520 | | to = ToCppT(res); | 521 | | } | 522 | | } | 523 | | } | 524 | 92 | } else { | 525 | | if constexpr (IsDecimal128V2<FromCppT>) { | 526 | | res = from.value() * scale_multiplier; | 527 | 92 | } else { | 528 | 92 | res = from.value * scale_multiplier; | 529 | 92 | } | 530 | | if constexpr (narrow_integral) { | 531 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 532 | | if constexpr (IsDecimal128V2<FromCppT>) { | 533 | | if (params.is_strict) { | 534 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 535 | | decimal_to_string(from.value(), scale_from), | 536 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 537 | | precision_to, scale_to); | 538 | | } | 539 | | } else { | 540 | | if (params.is_strict) { | 541 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 542 | | decimal_to_string(from.value, scale_from), | 543 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 544 | | precision_to, scale_to); | 545 | | } | 546 | | } | 547 | | return false; | 548 | | } | 549 | | } | 550 | 92 | to = ToCppT(res); | 551 | 92 | } | 552 | 92 | return true; | 553 | 92 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_7DecimalIN4wide7integerILm256EiEEEES6_Lb0ELb1ES5_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS8_jjRS7_jjRKT3_RKNS7_10NativeTypeESH_RNS_14CastParametersE Line | Count | Source | 474 | 88 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 475 | 88 | MaxNativeType res; | 476 | | if constexpr (multiply_may_overflow) { | 477 | | if constexpr (IsDecimal128V2<FromCppT>) { | 478 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 479 | | res)) { | 480 | | if (params.is_strict) { | 481 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 482 | | decimal_to_string(from.value(), scale_from), | 483 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 484 | | precision_to, scale_to); | 485 | | } | 486 | | return false; | 487 | | } else { | 488 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 489 | | if (params.is_strict) { | 490 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 491 | | decimal_to_string(from.value(), scale_from), | 492 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 493 | | precision_to, scale_to); | 494 | | } | 495 | | return false; | 496 | | } else { | 497 | | to = ToCppT(res); | 498 | | } | 499 | | } | 500 | | } else { | 501 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 502 | | res)) { | 503 | | if (params.is_strict) { | 504 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 505 | | decimal_to_string(from.value, scale_from), | 506 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 507 | | precision_to, scale_to); | 508 | | } | 509 | | return false; | 510 | | } else { | 511 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 512 | | if (params.is_strict) { | 513 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 514 | | decimal_to_string(from.value, scale_from), | 515 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 516 | | precision_to, scale_to); | 517 | | } | 518 | | return false; | 519 | | } else { | 520 | | to = ToCppT(res); | 521 | | } | 522 | | } | 523 | | } | 524 | 88 | } else { | 525 | | if constexpr (IsDecimal128V2<FromCppT>) { | 526 | | res = from.value() * scale_multiplier; | 527 | 88 | } else { | 528 | 88 | res = from.value * scale_multiplier; | 529 | 88 | } | 530 | 88 | if constexpr (narrow_integral) { | 531 | 88 | if (UNLIKELY(res > max_result || res < -max_result)) { | 532 | | if constexpr (IsDecimal128V2<FromCppT>) { | 533 | | if (params.is_strict) { | 534 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 535 | | decimal_to_string(from.value(), scale_from), | 536 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 537 | | precision_to, scale_to); | 538 | | } | 539 | 36 | } else { | 540 | 36 | if (params.is_strict) { | 541 | 18 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 542 | 18 | decimal_to_string(from.value, scale_from), | 543 | 18 | fmt::format("decimal({}, {})", precision_from, scale_from), | 544 | 18 | precision_to, scale_to); | 545 | 18 | } | 546 | 36 | } | 547 | 36 | return false; | 548 | 36 | } | 549 | 88 | } | 550 | 52 | to = ToCppT(res); | 551 | 88 | } | 552 | 0 | return true; | 553 | 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 | 474 | 420 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 475 | 420 | MaxNativeType res; | 476 | 420 | if constexpr (multiply_may_overflow) { | 477 | | if constexpr (IsDecimal128V2<FromCppT>) { | 478 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 479 | | res)) { | 480 | | if (params.is_strict) { | 481 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 482 | | decimal_to_string(from.value(), scale_from), | 483 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 484 | | precision_to, scale_to); | 485 | | } | 486 | | return false; | 487 | | } else { | 488 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 489 | | if (params.is_strict) { | 490 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 491 | | decimal_to_string(from.value(), scale_from), | 492 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 493 | | precision_to, scale_to); | 494 | | } | 495 | | return false; | 496 | | } else { | 497 | | to = ToCppT(res); | 498 | | } | 499 | | } | 500 | 420 | } else { | 501 | 420 | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 502 | 420 | res)) { | 503 | 76 | if (params.is_strict) { | 504 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 505 | 0 | decimal_to_string(from.value, scale_from), | 506 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 507 | 0 | precision_to, scale_to); | 508 | 0 | } | 509 | 76 | return false; | 510 | 344 | } else { | 511 | 344 | if (UNLIKELY(res > max_result || res < -max_result)) { | 512 | 152 | if (params.is_strict) { | 513 | 114 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 514 | 114 | decimal_to_string(from.value, scale_from), | 515 | 114 | fmt::format("decimal({}, {})", precision_from, scale_from), | 516 | 114 | precision_to, scale_to); | 517 | 114 | } | 518 | 152 | return false; | 519 | 192 | } else { | 520 | 192 | to = ToCppT(res); | 521 | 192 | } | 522 | 344 | } | 523 | 420 | } | 524 | | } else { | 525 | | if constexpr (IsDecimal128V2<FromCppT>) { | 526 | | res = from.value() * scale_multiplier; | 527 | | } else { | 528 | | res = from.value * scale_multiplier; | 529 | | } | 530 | | if constexpr (narrow_integral) { | 531 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 532 | | if constexpr (IsDecimal128V2<FromCppT>) { | 533 | | if (params.is_strict) { | 534 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 535 | | decimal_to_string(from.value(), scale_from), | 536 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 537 | | precision_to, scale_to); | 538 | | } | 539 | | } else { | 540 | | if (params.is_strict) { | 541 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 542 | | decimal_to_string(from.value, scale_from), | 543 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 544 | | precision_to, scale_to); | 545 | | } | 546 | | } | 547 | | return false; | 548 | | } | 549 | | } | 550 | | to = ToCppT(res); | 551 | | } | 552 | 192 | return true; | 553 | 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 | 474 | 30 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 475 | 30 | MaxNativeType res; | 476 | 30 | if constexpr (multiply_may_overflow) { | 477 | 30 | if constexpr (IsDecimal128V2<FromCppT>) { | 478 | 30 | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 479 | 30 | res)) { | 480 | 0 | if (params.is_strict) { | 481 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 482 | 0 | decimal_to_string(from.value(), scale_from), | 483 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 484 | 0 | precision_to, scale_to); | 485 | 0 | } | 486 | 0 | return false; | 487 | 30 | } else { | 488 | 30 | if (UNLIKELY(res > max_result || res < -max_result)) { | 489 | 0 | if (params.is_strict) { | 490 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 491 | 0 | decimal_to_string(from.value(), scale_from), | 492 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 493 | 0 | precision_to, scale_to); | 494 | 0 | } | 495 | 0 | return false; | 496 | 30 | } else { | 497 | 30 | to = ToCppT(res); | 498 | 30 | } | 499 | 30 | } | 500 | | } else { | 501 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 502 | | res)) { | 503 | | if (params.is_strict) { | 504 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 505 | | decimal_to_string(from.value, scale_from), | 506 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 507 | | precision_to, scale_to); | 508 | | } | 509 | | return false; | 510 | | } else { | 511 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 512 | | if (params.is_strict) { | 513 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 514 | | decimal_to_string(from.value, scale_from), | 515 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 516 | | precision_to, scale_to); | 517 | | } | 518 | | return false; | 519 | | } else { | 520 | | to = ToCppT(res); | 521 | | } | 522 | | } | 523 | | } | 524 | | } else { | 525 | | if constexpr (IsDecimal128V2<FromCppT>) { | 526 | | res = from.value() * scale_multiplier; | 527 | | } else { | 528 | | res = from.value * scale_multiplier; | 529 | | } | 530 | | if constexpr (narrow_integral) { | 531 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 532 | | if constexpr (IsDecimal128V2<FromCppT>) { | 533 | | if (params.is_strict) { | 534 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 535 | | decimal_to_string(from.value(), scale_from), | 536 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 537 | | precision_to, scale_to); | 538 | | } | 539 | | } else { | 540 | | if (params.is_strict) { | 541 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 542 | | decimal_to_string(from.value, scale_from), | 543 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 544 | | precision_to, scale_to); | 545 | | } | 546 | | } | 547 | | return false; | 548 | | } | 549 | | } | 550 | | to = ToCppT(res); | 551 | | } | 552 | 30 | return true; | 553 | 30 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_14DecimalV2ValueENS_7DecimalIlEELb1ELb1EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKT3_RKNS5_10NativeTypeESF_RNS_14CastParametersE Line | Count | Source | 474 | 260 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 475 | 260 | MaxNativeType res; | 476 | 260 | if constexpr (multiply_may_overflow) { | 477 | 260 | if constexpr (IsDecimal128V2<FromCppT>) { | 478 | 260 | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 479 | 260 | res)) { | 480 | 0 | if (params.is_strict) { | 481 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 482 | 0 | decimal_to_string(from.value(), scale_from), | 483 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 484 | 0 | precision_to, scale_to); | 485 | 0 | } | 486 | 0 | return false; | 487 | 260 | } else { | 488 | 260 | if (UNLIKELY(res > max_result || res < -max_result)) { | 489 | 96 | if (params.is_strict) { | 490 | 48 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 491 | 48 | decimal_to_string(from.value(), scale_from), | 492 | 48 | fmt::format("decimal({}, {})", precision_from, scale_from), | 493 | 48 | precision_to, scale_to); | 494 | 48 | } | 495 | 96 | return false; | 496 | 164 | } else { | 497 | 164 | to = ToCppT(res); | 498 | 164 | } | 499 | 260 | } | 500 | | } else { | 501 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 502 | | res)) { | 503 | | if (params.is_strict) { | 504 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 505 | | decimal_to_string(from.value, scale_from), | 506 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 507 | | precision_to, scale_to); | 508 | | } | 509 | | return false; | 510 | | } else { | 511 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 512 | | if (params.is_strict) { | 513 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 514 | | decimal_to_string(from.value, scale_from), | 515 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 516 | | precision_to, scale_to); | 517 | | } | 518 | | return false; | 519 | | } else { | 520 | | to = ToCppT(res); | 521 | | } | 522 | | } | 523 | | } | 524 | | } else { | 525 | | if constexpr (IsDecimal128V2<FromCppT>) { | 526 | | res = from.value() * scale_multiplier; | 527 | | } else { | 528 | | res = from.value * scale_multiplier; | 529 | | } | 530 | | if constexpr (narrow_integral) { | 531 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 532 | | if constexpr (IsDecimal128V2<FromCppT>) { | 533 | | if (params.is_strict) { | 534 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 535 | | decimal_to_string(from.value(), scale_from), | 536 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 537 | | precision_to, scale_to); | 538 | | } | 539 | | } else { | 540 | | if (params.is_strict) { | 541 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 542 | | decimal_to_string(from.value, scale_from), | 543 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 544 | | precision_to, scale_to); | 545 | | } | 546 | | } | 547 | | return false; | 548 | | } | 549 | | } | 550 | | to = ToCppT(res); | 551 | | } | 552 | 164 | return true; | 553 | 260 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_14DecimalV2ValueENS_12Decimal128V3ELb0ELb0EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 474 | 22 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 475 | 22 | MaxNativeType res; | 476 | | if constexpr (multiply_may_overflow) { | 477 | | if constexpr (IsDecimal128V2<FromCppT>) { | 478 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 479 | | res)) { | 480 | | if (params.is_strict) { | 481 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 482 | | decimal_to_string(from.value(), scale_from), | 483 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 484 | | precision_to, scale_to); | 485 | | } | 486 | | return false; | 487 | | } else { | 488 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 489 | | if (params.is_strict) { | 490 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 491 | | decimal_to_string(from.value(), scale_from), | 492 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 493 | | precision_to, scale_to); | 494 | | } | 495 | | return false; | 496 | | } else { | 497 | | to = ToCppT(res); | 498 | | } | 499 | | } | 500 | | } else { | 501 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 502 | | res)) { | 503 | | if (params.is_strict) { | 504 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 505 | | decimal_to_string(from.value, scale_from), | 506 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 507 | | precision_to, scale_to); | 508 | | } | 509 | | return false; | 510 | | } else { | 511 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 512 | | if (params.is_strict) { | 513 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 514 | | decimal_to_string(from.value, scale_from), | 515 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 516 | | precision_to, scale_to); | 517 | | } | 518 | | return false; | 519 | | } else { | 520 | | to = ToCppT(res); | 521 | | } | 522 | | } | 523 | | } | 524 | 22 | } else { | 525 | 22 | if constexpr (IsDecimal128V2<FromCppT>) { | 526 | 22 | res = from.value() * scale_multiplier; | 527 | | } else { | 528 | | res = from.value * scale_multiplier; | 529 | | } | 530 | | if constexpr (narrow_integral) { | 531 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 532 | | if constexpr (IsDecimal128V2<FromCppT>) { | 533 | | if (params.is_strict) { | 534 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 535 | | decimal_to_string(from.value(), scale_from), | 536 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 537 | | precision_to, scale_to); | 538 | | } | 539 | | } else { | 540 | | if (params.is_strict) { | 541 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 542 | | decimal_to_string(from.value, scale_from), | 543 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 544 | | precision_to, scale_to); | 545 | | } | 546 | | } | 547 | | return false; | 548 | | } | 549 | | } | 550 | 22 | to = ToCppT(res); | 551 | 22 | } | 552 | 22 | return true; | 553 | 22 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_14DecimalV2ValueENS_12Decimal128V3ELb0ELb1EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 474 | 190 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 475 | 190 | MaxNativeType res; | 476 | | if constexpr (multiply_may_overflow) { | 477 | | if constexpr (IsDecimal128V2<FromCppT>) { | 478 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 479 | | res)) { | 480 | | if (params.is_strict) { | 481 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 482 | | decimal_to_string(from.value(), scale_from), | 483 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 484 | | precision_to, scale_to); | 485 | | } | 486 | | return false; | 487 | | } else { | 488 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 489 | | if (params.is_strict) { | 490 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 491 | | decimal_to_string(from.value(), scale_from), | 492 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 493 | | precision_to, scale_to); | 494 | | } | 495 | | return false; | 496 | | } else { | 497 | | to = ToCppT(res); | 498 | | } | 499 | | } | 500 | | } else { | 501 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 502 | | res)) { | 503 | | if (params.is_strict) { | 504 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 505 | | decimal_to_string(from.value, scale_from), | 506 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 507 | | precision_to, scale_to); | 508 | | } | 509 | | return false; | 510 | | } else { | 511 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 512 | | if (params.is_strict) { | 513 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 514 | | decimal_to_string(from.value, scale_from), | 515 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 516 | | precision_to, scale_to); | 517 | | } | 518 | | return false; | 519 | | } else { | 520 | | to = ToCppT(res); | 521 | | } | 522 | | } | 523 | | } | 524 | 190 | } else { | 525 | 190 | if constexpr (IsDecimal128V2<FromCppT>) { | 526 | 190 | res = from.value() * scale_multiplier; | 527 | | } else { | 528 | | res = from.value * scale_multiplier; | 529 | | } | 530 | 190 | if constexpr (narrow_integral) { | 531 | 190 | if (UNLIKELY(res > max_result || res < -max_result)) { | 532 | 60 | if constexpr (IsDecimal128V2<FromCppT>) { | 533 | 60 | if (params.is_strict) { | 534 | 30 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 535 | 30 | decimal_to_string(from.value(), scale_from), | 536 | 30 | fmt::format("decimal({}, {})", precision_from, scale_from), | 537 | 30 | precision_to, scale_to); | 538 | 30 | } | 539 | | } else { | 540 | | if (params.is_strict) { | 541 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 542 | | decimal_to_string(from.value, scale_from), | 543 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 544 | | precision_to, scale_to); | 545 | | } | 546 | | } | 547 | 60 | return false; | 548 | 60 | } | 549 | 190 | } | 550 | 130 | to = ToCppT(res); | 551 | 190 | } | 552 | 0 | return true; | 553 | 190 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_14DecimalV2ValueENS_12Decimal128V3ELb1ELb0EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 474 | 22 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 475 | 22 | MaxNativeType res; | 476 | 22 | if constexpr (multiply_may_overflow) { | 477 | 22 | if constexpr (IsDecimal128V2<FromCppT>) { | 478 | 22 | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 479 | 22 | res)) { | 480 | 0 | if (params.is_strict) { | 481 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 482 | 0 | decimal_to_string(from.value(), scale_from), | 483 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 484 | 0 | precision_to, scale_to); | 485 | 0 | } | 486 | 0 | return false; | 487 | 22 | } else { | 488 | 22 | if (UNLIKELY(res > max_result || res < -max_result)) { | 489 | 0 | if (params.is_strict) { | 490 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 491 | 0 | decimal_to_string(from.value(), scale_from), | 492 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 493 | 0 | precision_to, scale_to); | 494 | 0 | } | 495 | 0 | return false; | 496 | 22 | } else { | 497 | 22 | to = ToCppT(res); | 498 | 22 | } | 499 | 22 | } | 500 | | } else { | 501 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 502 | | res)) { | 503 | | if (params.is_strict) { | 504 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 505 | | decimal_to_string(from.value, scale_from), | 506 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 507 | | precision_to, scale_to); | 508 | | } | 509 | | return false; | 510 | | } else { | 511 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 512 | | if (params.is_strict) { | 513 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 514 | | decimal_to_string(from.value, scale_from), | 515 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 516 | | precision_to, scale_to); | 517 | | } | 518 | | return false; | 519 | | } else { | 520 | | to = ToCppT(res); | 521 | | } | 522 | | } | 523 | | } | 524 | | } else { | 525 | | if constexpr (IsDecimal128V2<FromCppT>) { | 526 | | res = from.value() * scale_multiplier; | 527 | | } else { | 528 | | res = from.value * scale_multiplier; | 529 | | } | 530 | | if constexpr (narrow_integral) { | 531 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 532 | | if constexpr (IsDecimal128V2<FromCppT>) { | 533 | | if (params.is_strict) { | 534 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 535 | | decimal_to_string(from.value(), scale_from), | 536 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 537 | | precision_to, scale_to); | 538 | | } | 539 | | } else { | 540 | | if (params.is_strict) { | 541 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 542 | | decimal_to_string(from.value, scale_from), | 543 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 544 | | precision_to, scale_to); | 545 | | } | 546 | | } | 547 | | return false; | 548 | | } | 549 | | } | 550 | | to = ToCppT(res); | 551 | | } | 552 | 22 | return true; | 553 | 22 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_14DecimalV2ValueENS_12Decimal128V3ELb1ELb1EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 474 | 190 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 475 | 190 | MaxNativeType res; | 476 | 190 | if constexpr (multiply_may_overflow) { | 477 | 190 | if constexpr (IsDecimal128V2<FromCppT>) { | 478 | 190 | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 479 | 190 | res)) { | 480 | 36 | if (params.is_strict) { | 481 | 12 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 482 | 12 | decimal_to_string(from.value(), scale_from), | 483 | 12 | fmt::format("decimal({}, {})", precision_from, scale_from), | 484 | 12 | precision_to, scale_to); | 485 | 12 | } | 486 | 36 | return false; | 487 | 154 | } else { | 488 | 154 | if (UNLIKELY(res > max_result || res < -max_result)) { | 489 | 24 | if (params.is_strict) { | 490 | 18 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 491 | 18 | decimal_to_string(from.value(), scale_from), | 492 | 18 | fmt::format("decimal({}, {})", precision_from, scale_from), | 493 | 18 | precision_to, scale_to); | 494 | 18 | } | 495 | 24 | return false; | 496 | 130 | } else { | 497 | 130 | to = ToCppT(res); | 498 | 130 | } | 499 | 154 | } | 500 | | } else { | 501 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 502 | | res)) { | 503 | | if (params.is_strict) { | 504 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 505 | | decimal_to_string(from.value, scale_from), | 506 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 507 | | precision_to, scale_to); | 508 | | } | 509 | | return false; | 510 | | } else { | 511 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 512 | | if (params.is_strict) { | 513 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 514 | | decimal_to_string(from.value, scale_from), | 515 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 516 | | precision_to, scale_to); | 517 | | } | 518 | | return false; | 519 | | } else { | 520 | | to = ToCppT(res); | 521 | | } | 522 | | } | 523 | | } | 524 | | } else { | 525 | | if constexpr (IsDecimal128V2<FromCppT>) { | 526 | | res = from.value() * scale_multiplier; | 527 | | } else { | 528 | | res = from.value * scale_multiplier; | 529 | | } | 530 | | if constexpr (narrow_integral) { | 531 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 532 | | if constexpr (IsDecimal128V2<FromCppT>) { | 533 | | if (params.is_strict) { | 534 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 535 | | decimal_to_string(from.value(), scale_from), | 536 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 537 | | precision_to, scale_to); | 538 | | } | 539 | | } else { | 540 | | if (params.is_strict) { | 541 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 542 | | decimal_to_string(from.value, scale_from), | 543 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 544 | | precision_to, scale_to); | 545 | | } | 546 | | } | 547 | | return false; | 548 | | } | 549 | | } | 550 | | to = ToCppT(res); | 551 | | } | 552 | 130 | return true; | 553 | 190 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_14DecimalV2ValueENS_7DecimalIN4wide7integerILm256EiEEEELb0ELb0ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKT3_RKNS8_10NativeTypeESI_RNS_14CastParametersE Line | Count | Source | 474 | 22 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 475 | 22 | MaxNativeType res; | 476 | | if constexpr (multiply_may_overflow) { | 477 | | if constexpr (IsDecimal128V2<FromCppT>) { | 478 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 479 | | res)) { | 480 | | if (params.is_strict) { | 481 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 482 | | decimal_to_string(from.value(), scale_from), | 483 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 484 | | precision_to, scale_to); | 485 | | } | 486 | | return false; | 487 | | } else { | 488 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 489 | | if (params.is_strict) { | 490 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 491 | | decimal_to_string(from.value(), scale_from), | 492 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 493 | | precision_to, scale_to); | 494 | | } | 495 | | return false; | 496 | | } else { | 497 | | to = ToCppT(res); | 498 | | } | 499 | | } | 500 | | } else { | 501 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 502 | | res)) { | 503 | | if (params.is_strict) { | 504 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 505 | | decimal_to_string(from.value, scale_from), | 506 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 507 | | precision_to, scale_to); | 508 | | } | 509 | | return false; | 510 | | } else { | 511 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 512 | | if (params.is_strict) { | 513 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 514 | | decimal_to_string(from.value, scale_from), | 515 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 516 | | precision_to, scale_to); | 517 | | } | 518 | | return false; | 519 | | } else { | 520 | | to = ToCppT(res); | 521 | | } | 522 | | } | 523 | | } | 524 | 22 | } else { | 525 | 22 | if constexpr (IsDecimal128V2<FromCppT>) { | 526 | 22 | res = from.value() * scale_multiplier; | 527 | | } else { | 528 | | res = from.value * scale_multiplier; | 529 | | } | 530 | | if constexpr (narrow_integral) { | 531 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 532 | | if constexpr (IsDecimal128V2<FromCppT>) { | 533 | | if (params.is_strict) { | 534 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 535 | | decimal_to_string(from.value(), scale_from), | 536 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 537 | | precision_to, scale_to); | 538 | | } | 539 | | } else { | 540 | | if (params.is_strict) { | 541 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 542 | | decimal_to_string(from.value, scale_from), | 543 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 544 | | precision_to, scale_to); | 545 | | } | 546 | | } | 547 | | return false; | 548 | | } | 549 | | } | 550 | 22 | to = ToCppT(res); | 551 | 22 | } | 552 | 22 | return true; | 553 | 22 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_14DecimalV2ValueENS_7DecimalIN4wide7integerILm256EiEEEELb0ELb1ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKT3_RKNS8_10NativeTypeESI_RNS_14CastParametersE Line | Count | Source | 474 | 190 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 475 | 190 | MaxNativeType res; | 476 | | if constexpr (multiply_may_overflow) { | 477 | | if constexpr (IsDecimal128V2<FromCppT>) { | 478 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 479 | | res)) { | 480 | | if (params.is_strict) { | 481 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 482 | | decimal_to_string(from.value(), scale_from), | 483 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 484 | | precision_to, scale_to); | 485 | | } | 486 | | return false; | 487 | | } else { | 488 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 489 | | if (params.is_strict) { | 490 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 491 | | decimal_to_string(from.value(), scale_from), | 492 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 493 | | precision_to, scale_to); | 494 | | } | 495 | | return false; | 496 | | } else { | 497 | | to = ToCppT(res); | 498 | | } | 499 | | } | 500 | | } else { | 501 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 502 | | res)) { | 503 | | if (params.is_strict) { | 504 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 505 | | decimal_to_string(from.value, scale_from), | 506 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 507 | | precision_to, scale_to); | 508 | | } | 509 | | return false; | 510 | | } else { | 511 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 512 | | if (params.is_strict) { | 513 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 514 | | decimal_to_string(from.value, scale_from), | 515 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 516 | | precision_to, scale_to); | 517 | | } | 518 | | return false; | 519 | | } else { | 520 | | to = ToCppT(res); | 521 | | } | 522 | | } | 523 | | } | 524 | 190 | } else { | 525 | 190 | if constexpr (IsDecimal128V2<FromCppT>) { | 526 | 190 | res = from.value() * scale_multiplier; | 527 | | } else { | 528 | | res = from.value * scale_multiplier; | 529 | | } | 530 | 190 | if constexpr (narrow_integral) { | 531 | 190 | if (UNLIKELY(res > max_result || res < -max_result)) { | 532 | 60 | if constexpr (IsDecimal128V2<FromCppT>) { | 533 | 60 | if (params.is_strict) { | 534 | 30 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 535 | 30 | decimal_to_string(from.value(), scale_from), | 536 | 30 | fmt::format("decimal({}, {})", precision_from, scale_from), | 537 | 30 | precision_to, scale_to); | 538 | 30 | } | 539 | | } else { | 540 | | if (params.is_strict) { | 541 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 542 | | decimal_to_string(from.value, scale_from), | 543 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 544 | | precision_to, scale_to); | 545 | | } | 546 | | } | 547 | 60 | return false; | 548 | 60 | } | 549 | 190 | } | 550 | 130 | to = ToCppT(res); | 551 | 190 | } | 552 | 0 | return true; | 553 | 190 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_14DecimalV2ValueENS_7DecimalIN4wide7integerILm256EiEEEELb1ELb0ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKT3_RKNS8_10NativeTypeESI_RNS_14CastParametersE Line | Count | Source | 474 | 22 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 475 | 22 | MaxNativeType res; | 476 | 22 | if constexpr (multiply_may_overflow) { | 477 | 22 | if constexpr (IsDecimal128V2<FromCppT>) { | 478 | 22 | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 479 | 22 | res)) { | 480 | 0 | if (params.is_strict) { | 481 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 482 | 0 | decimal_to_string(from.value(), scale_from), | 483 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 484 | 0 | precision_to, scale_to); | 485 | 0 | } | 486 | 0 | return false; | 487 | 22 | } else { | 488 | 22 | if (UNLIKELY(res > max_result || res < -max_result)) { | 489 | 0 | if (params.is_strict) { | 490 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 491 | 0 | decimal_to_string(from.value(), scale_from), | 492 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 493 | 0 | precision_to, scale_to); | 494 | 0 | } | 495 | 0 | return false; | 496 | 22 | } else { | 497 | 22 | to = ToCppT(res); | 498 | 22 | } | 499 | 22 | } | 500 | | } else { | 501 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 502 | | res)) { | 503 | | if (params.is_strict) { | 504 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 505 | | decimal_to_string(from.value, scale_from), | 506 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 507 | | precision_to, scale_to); | 508 | | } | 509 | | return false; | 510 | | } else { | 511 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 512 | | if (params.is_strict) { | 513 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 514 | | decimal_to_string(from.value, scale_from), | 515 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 516 | | precision_to, scale_to); | 517 | | } | 518 | | return false; | 519 | | } else { | 520 | | to = ToCppT(res); | 521 | | } | 522 | | } | 523 | | } | 524 | | } else { | 525 | | if constexpr (IsDecimal128V2<FromCppT>) { | 526 | | res = from.value() * scale_multiplier; | 527 | | } else { | 528 | | res = from.value * scale_multiplier; | 529 | | } | 530 | | if constexpr (narrow_integral) { | 531 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 532 | | if constexpr (IsDecimal128V2<FromCppT>) { | 533 | | if (params.is_strict) { | 534 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 535 | | decimal_to_string(from.value(), scale_from), | 536 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 537 | | precision_to, scale_to); | 538 | | } | 539 | | } else { | 540 | | if (params.is_strict) { | 541 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 542 | | decimal_to_string(from.value, scale_from), | 543 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 544 | | precision_to, scale_to); | 545 | | } | 546 | | } | 547 | | return false; | 548 | | } | 549 | | } | 550 | | to = ToCppT(res); | 551 | | } | 552 | 22 | return true; | 553 | 22 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_14DecimalV2ValueENS_7DecimalIN4wide7integerILm256EiEEEELb1ELb1ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKT3_RKNS8_10NativeTypeESI_RNS_14CastParametersE Line | Count | Source | 474 | 190 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 475 | 190 | MaxNativeType res; | 476 | 190 | if constexpr (multiply_may_overflow) { | 477 | 190 | if constexpr (IsDecimal128V2<FromCppT>) { | 478 | 190 | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 479 | 190 | res)) { | 480 | 20 | if (params.is_strict) { | 481 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 482 | 0 | decimal_to_string(from.value(), scale_from), | 483 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 484 | 0 | precision_to, scale_to); | 485 | 0 | } | 486 | 20 | return false; | 487 | 170 | } else { | 488 | 170 | if (UNLIKELY(res > max_result || res < -max_result)) { | 489 | 40 | if (params.is_strict) { | 490 | 30 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 491 | 30 | decimal_to_string(from.value(), scale_from), | 492 | 30 | fmt::format("decimal({}, {})", precision_from, scale_from), | 493 | 30 | precision_to, scale_to); | 494 | 30 | } | 495 | 40 | return false; | 496 | 130 | } else { | 497 | 130 | to = ToCppT(res); | 498 | 130 | } | 499 | 170 | } | 500 | | } else { | 501 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 502 | | res)) { | 503 | | if (params.is_strict) { | 504 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 505 | | decimal_to_string(from.value, scale_from), | 506 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 507 | | precision_to, scale_to); | 508 | | } | 509 | | return false; | 510 | | } else { | 511 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 512 | | if (params.is_strict) { | 513 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 514 | | decimal_to_string(from.value, scale_from), | 515 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 516 | | precision_to, scale_to); | 517 | | } | 518 | | return false; | 519 | | } else { | 520 | | to = ToCppT(res); | 521 | | } | 522 | | } | 523 | | } | 524 | | } else { | 525 | | if constexpr (IsDecimal128V2<FromCppT>) { | 526 | | res = from.value() * scale_multiplier; | 527 | | } else { | 528 | | res = from.value * scale_multiplier; | 529 | | } | 530 | | if constexpr (narrow_integral) { | 531 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 532 | | if constexpr (IsDecimal128V2<FromCppT>) { | 533 | | if (params.is_strict) { | 534 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 535 | | decimal_to_string(from.value(), scale_from), | 536 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 537 | | precision_to, scale_to); | 538 | | } | 539 | | } else { | 540 | | if (params.is_strict) { | 541 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 542 | | decimal_to_string(from.value, scale_from), | 543 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 544 | | precision_to, scale_to); | 545 | | } | 546 | | } | 547 | | return false; | 548 | | } | 549 | | } | 550 | | to = ToCppT(res); | 551 | | } | 552 | 130 | return true; | 553 | 190 | } |
|
554 | | |
555 | | template <typename FromCppT, typename ToCppT, typename ScaleT, bool narrow_integral> |
556 | | requires(IsDecimalNumber<ToCppT> && IsDecimalNumber<FromCppT>) |
557 | | static inline bool _from_decimal_same_scale(const FromCppT& from, const UInt32 precision_from, |
558 | | const UInt32 scale_from, ToCppT& to, |
559 | | UInt32 precision_to, UInt32 scale_to, |
560 | | const typename ToCppT::NativeType& min_result, |
561 | | const typename ToCppT::NativeType& max_result, |
562 | 3.73k | CastParameters& params) { |
563 | 3.73k | if constexpr (IsDecimal128V2<FromCppT>) { |
564 | 212 | if constexpr (narrow_integral) { |
565 | 190 | if (UNLIKELY(from.value() > max_result || from.value() < -max_result)) { |
566 | 60 | if (params.is_strict) { |
567 | 30 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( |
568 | 30 | decimal_to_string(from.value(), scale_from), |
569 | 30 | fmt::format("decimal({}, {})", precision_from, scale_from), |
570 | 30 | precision_to, scale_to); |
571 | 30 | } |
572 | 60 | return false; |
573 | 60 | } |
574 | 190 | } |
575 | 130 | to = ToCppT(from.value()); |
576 | 3.52k | } else { |
577 | 3.52k | if constexpr (narrow_integral) { |
578 | 2.11k | if (UNLIKELY(from.value > max_result || from.value < -max_result)) { |
579 | 708 | if (params.is_strict) { |
580 | 354 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( |
581 | 354 | decimal_to_string(from.value, scale_from), |
582 | 354 | fmt::format("decimal({}, {})", precision_from, scale_from), |
583 | 354 | precision_to, scale_to); |
584 | 354 | } |
585 | 708 | return false; |
586 | 708 | } |
587 | 2.11k | } |
588 | 1.40k | to = ToCppT(from.value); |
589 | 3.52k | } |
590 | 0 | return true; |
591 | 3.73k | } _ZN5doris13CastToDecimal24_from_decimal_same_scaleINS_7DecimalIiEES3_iLb0EQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKNS4_10NativeTypeESB_RNS_14CastParametersE Line | Count | Source | 562 | 16 | CastParameters& params) { | 563 | | if constexpr (IsDecimal128V2<FromCppT>) { | 564 | | if constexpr (narrow_integral) { | 565 | | if (UNLIKELY(from.value() > max_result || from.value() < -max_result)) { | 566 | | if (params.is_strict) { | 567 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 568 | | decimal_to_string(from.value(), scale_from), | 569 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 570 | | precision_to, scale_to); | 571 | | } | 572 | | return false; | 573 | | } | 574 | | } | 575 | | to = ToCppT(from.value()); | 576 | 16 | } else { | 577 | | if constexpr (narrow_integral) { | 578 | | if (UNLIKELY(from.value > max_result || from.value < -max_result)) { | 579 | | if (params.is_strict) { | 580 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 581 | | decimal_to_string(from.value, scale_from), | 582 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 583 | | precision_to, scale_to); | 584 | | } | 585 | | return false; | 586 | | } | 587 | | } | 588 | 16 | to = ToCppT(from.value); | 589 | 16 | } | 590 | 16 | return true; | 591 | 16 | } |
_ZN5doris13CastToDecimal24_from_decimal_same_scaleINS_7DecimalIiEES3_iLb1EQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKNS4_10NativeTypeESB_RNS_14CastParametersE Line | Count | Source | 562 | 38 | CastParameters& params) { | 563 | | if constexpr (IsDecimal128V2<FromCppT>) { | 564 | | if constexpr (narrow_integral) { | 565 | | if (UNLIKELY(from.value() > max_result || from.value() < -max_result)) { | 566 | | if (params.is_strict) { | 567 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 568 | | decimal_to_string(from.value(), scale_from), | 569 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 570 | | precision_to, scale_to); | 571 | | } | 572 | | return false; | 573 | | } | 574 | | } | 575 | | to = ToCppT(from.value()); | 576 | 38 | } else { | 577 | 38 | if constexpr (narrow_integral) { | 578 | 38 | if (UNLIKELY(from.value > max_result || from.value < -max_result)) { | 579 | 24 | if (params.is_strict) { | 580 | 12 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 581 | 12 | decimal_to_string(from.value, scale_from), | 582 | 12 | fmt::format("decimal({}, {})", precision_from, scale_from), | 583 | 12 | precision_to, scale_to); | 584 | 12 | } | 585 | 24 | return false; | 586 | 24 | } | 587 | 38 | } | 588 | 14 | to = ToCppT(from.value); | 589 | 38 | } | 590 | 0 | return true; | 591 | 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 | 562 | 272 | CastParameters& params) { | 563 | | if constexpr (IsDecimal128V2<FromCppT>) { | 564 | | if constexpr (narrow_integral) { | 565 | | if (UNLIKELY(from.value() > max_result || from.value() < -max_result)) { | 566 | | if (params.is_strict) { | 567 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 568 | | decimal_to_string(from.value(), scale_from), | 569 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 570 | | precision_to, scale_to); | 571 | | } | 572 | | return false; | 573 | | } | 574 | | } | 575 | | to = ToCppT(from.value()); | 576 | 272 | } else { | 577 | 272 | if constexpr (narrow_integral) { | 578 | 272 | if (UNLIKELY(from.value > max_result || from.value < -max_result)) { | 579 | 108 | if (params.is_strict) { | 580 | 54 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 581 | 54 | decimal_to_string(from.value, scale_from), | 582 | 54 | fmt::format("decimal({}, {})", precision_from, scale_from), | 583 | 54 | precision_to, scale_to); | 584 | 54 | } | 585 | 108 | return false; | 586 | 108 | } | 587 | 272 | } | 588 | 164 | to = ToCppT(from.value); | 589 | 272 | } | 590 | 0 | return true; | 591 | 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 | 562 | 244 | CastParameters& params) { | 563 | | if constexpr (IsDecimal128V2<FromCppT>) { | 564 | | if constexpr (narrow_integral) { | 565 | | if (UNLIKELY(from.value() > max_result || from.value() < -max_result)) { | 566 | | if (params.is_strict) { | 567 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 568 | | decimal_to_string(from.value(), scale_from), | 569 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 570 | | precision_to, scale_to); | 571 | | } | 572 | | return false; | 573 | | } | 574 | | } | 575 | | to = ToCppT(from.value()); | 576 | 244 | } else { | 577 | 244 | if constexpr (narrow_integral) { | 578 | 244 | if (UNLIKELY(from.value > max_result || from.value < -max_result)) { | 579 | 96 | if (params.is_strict) { | 580 | 48 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 581 | 48 | decimal_to_string(from.value, scale_from), | 582 | 48 | fmt::format("decimal({}, {})", precision_from, scale_from), | 583 | 48 | precision_to, scale_to); | 584 | 48 | } | 585 | 96 | return false; | 586 | 96 | } | 587 | 244 | } | 588 | 148 | to = ToCppT(from.value); | 589 | 244 | } | 590 | 0 | return true; | 591 | 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 | 562 | 244 | CastParameters& params) { | 563 | | if constexpr (IsDecimal128V2<FromCppT>) { | 564 | | if constexpr (narrow_integral) { | 565 | | if (UNLIKELY(from.value() > max_result || from.value() < -max_result)) { | 566 | | if (params.is_strict) { | 567 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 568 | | decimal_to_string(from.value(), scale_from), | 569 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 570 | | precision_to, scale_to); | 571 | | } | 572 | | return false; | 573 | | } | 574 | | } | 575 | | to = ToCppT(from.value()); | 576 | 244 | } else { | 577 | 244 | if constexpr (narrow_integral) { | 578 | 244 | if (UNLIKELY(from.value > max_result || from.value < -max_result)) { | 579 | 96 | if (params.is_strict) { | 580 | 48 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 581 | 48 | decimal_to_string(from.value, scale_from), | 582 | 48 | fmt::format("decimal({}, {})", precision_from, scale_from), | 583 | 48 | precision_to, scale_to); | 584 | 48 | } | 585 | 96 | return false; | 586 | 96 | } | 587 | 244 | } | 588 | 148 | to = ToCppT(from.value); | 589 | 244 | } | 590 | 0 | return true; | 591 | 244 | } |
_ZN5doris13CastToDecimal24_from_decimal_same_scaleINS_7DecimalIiEENS2_IlEElLb0EQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RNS_14CastParametersE Line | Count | Source | 562 | 164 | CastParameters& params) { | 563 | | if constexpr (IsDecimal128V2<FromCppT>) { | 564 | | if constexpr (narrow_integral) { | 565 | | if (UNLIKELY(from.value() > max_result || from.value() < -max_result)) { | 566 | | if (params.is_strict) { | 567 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 568 | | decimal_to_string(from.value(), scale_from), | 569 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 570 | | precision_to, scale_to); | 571 | | } | 572 | | return false; | 573 | | } | 574 | | } | 575 | | to = ToCppT(from.value()); | 576 | 164 | } else { | 577 | | if constexpr (narrow_integral) { | 578 | | if (UNLIKELY(from.value > max_result || from.value < -max_result)) { | 579 | | if (params.is_strict) { | 580 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 581 | | decimal_to_string(from.value, scale_from), | 582 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 583 | | precision_to, scale_to); | 584 | | } | 585 | | return false; | 586 | | } | 587 | | } | 588 | 164 | to = ToCppT(from.value); | 589 | 164 | } | 590 | 164 | return true; | 591 | 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 | 562 | 60 | CastParameters& params) { | 563 | | if constexpr (IsDecimal128V2<FromCppT>) { | 564 | | if constexpr (narrow_integral) { | 565 | | if (UNLIKELY(from.value() > max_result || from.value() < -max_result)) { | 566 | | if (params.is_strict) { | 567 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 568 | | decimal_to_string(from.value(), scale_from), | 569 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 570 | | precision_to, scale_to); | 571 | | } | 572 | | return false; | 573 | | } | 574 | | } | 575 | | to = ToCppT(from.value()); | 576 | 60 | } else { | 577 | | if constexpr (narrow_integral) { | 578 | | if (UNLIKELY(from.value > max_result || from.value < -max_result)) { | 579 | | if (params.is_strict) { | 580 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 581 | | decimal_to_string(from.value, scale_from), | 582 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 583 | | precision_to, scale_to); | 584 | | } | 585 | | return false; | 586 | | } | 587 | | } | 588 | 60 | to = ToCppT(from.value); | 589 | 60 | } | 590 | 60 | return true; | 591 | 60 | } |
_ZN5doris13CastToDecimal24_from_decimal_same_scaleINS_7DecimalIlEES3_lLb1EQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKNS4_10NativeTypeESB_RNS_14CastParametersE Line | Count | Source | 562 | 84 | CastParameters& params) { | 563 | | if constexpr (IsDecimal128V2<FromCppT>) { | 564 | | if constexpr (narrow_integral) { | 565 | | if (UNLIKELY(from.value() > max_result || from.value() < -max_result)) { | 566 | | if (params.is_strict) { | 567 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 568 | | decimal_to_string(from.value(), scale_from), | 569 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 570 | | precision_to, scale_to); | 571 | | } | 572 | | return false; | 573 | | } | 574 | | } | 575 | | to = ToCppT(from.value()); | 576 | 84 | } else { | 577 | 84 | if constexpr (narrow_integral) { | 578 | 84 | if (UNLIKELY(from.value > max_result || from.value < -max_result)) { | 579 | 24 | if (params.is_strict) { | 580 | 12 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 581 | 12 | decimal_to_string(from.value, scale_from), | 582 | 12 | fmt::format("decimal({}, {})", precision_from, scale_from), | 583 | 12 | precision_to, scale_to); | 584 | 12 | } | 585 | 24 | return false; | 586 | 24 | } | 587 | 84 | } | 588 | 60 | to = ToCppT(from.value); | 589 | 84 | } | 590 | 0 | return true; | 591 | 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 | 562 | 364 | CastParameters& params) { | 563 | | if constexpr (IsDecimal128V2<FromCppT>) { | 564 | | if constexpr (narrow_integral) { | 565 | | if (UNLIKELY(from.value() > max_result || from.value() < -max_result)) { | 566 | | if (params.is_strict) { | 567 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 568 | | decimal_to_string(from.value(), scale_from), | 569 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 570 | | precision_to, scale_to); | 571 | | } | 572 | | return false; | 573 | | } | 574 | | } | 575 | | to = ToCppT(from.value()); | 576 | 364 | } else { | 577 | 364 | if constexpr (narrow_integral) { | 578 | 364 | if (UNLIKELY(from.value > max_result || from.value < -max_result)) { | 579 | 108 | if (params.is_strict) { | 580 | 54 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 581 | 54 | decimal_to_string(from.value, scale_from), | 582 | 54 | fmt::format("decimal({}, {})", precision_from, scale_from), | 583 | 54 | precision_to, scale_to); | 584 | 54 | } | 585 | 108 | return false; | 586 | 108 | } | 587 | 364 | } | 588 | 256 | to = ToCppT(from.value); | 589 | 364 | } | 590 | 0 | return true; | 591 | 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 | 562 | 336 | CastParameters& params) { | 563 | | if constexpr (IsDecimal128V2<FromCppT>) { | 564 | | if constexpr (narrow_integral) { | 565 | | if (UNLIKELY(from.value() > max_result || from.value() < -max_result)) { | 566 | | if (params.is_strict) { | 567 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 568 | | decimal_to_string(from.value(), scale_from), | 569 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 570 | | precision_to, scale_to); | 571 | | } | 572 | | return false; | 573 | | } | 574 | | } | 575 | | to = ToCppT(from.value()); | 576 | 336 | } else { | 577 | 336 | if constexpr (narrow_integral) { | 578 | 336 | if (UNLIKELY(from.value > max_result || from.value < -max_result)) { | 579 | 96 | if (params.is_strict) { | 580 | 48 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 581 | 48 | decimal_to_string(from.value, scale_from), | 582 | 48 | fmt::format("decimal({}, {})", precision_from, scale_from), | 583 | 48 | precision_to, scale_to); | 584 | 48 | } | 585 | 96 | return false; | 586 | 96 | } | 587 | 336 | } | 588 | 240 | to = ToCppT(from.value); | 589 | 336 | } | 590 | 0 | return true; | 591 | 336 | } |
_ZN5doris13CastToDecimal24_from_decimal_same_scaleINS_7DecimalIiEENS_12Decimal128V3EnLb0EQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RNS_14CastParametersE Line | Count | Source | 562 | 148 | CastParameters& params) { | 563 | | if constexpr (IsDecimal128V2<FromCppT>) { | 564 | | if constexpr (narrow_integral) { | 565 | | if (UNLIKELY(from.value() > max_result || from.value() < -max_result)) { | 566 | | if (params.is_strict) { | 567 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 568 | | decimal_to_string(from.value(), scale_from), | 569 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 570 | | precision_to, scale_to); | 571 | | } | 572 | | return false; | 573 | | } | 574 | | } | 575 | | to = ToCppT(from.value()); | 576 | 148 | } else { | 577 | | if constexpr (narrow_integral) { | 578 | | if (UNLIKELY(from.value > max_result || from.value < -max_result)) { | 579 | | if (params.is_strict) { | 580 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 581 | | decimal_to_string(from.value, scale_from), | 582 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 583 | | precision_to, scale_to); | 584 | | } | 585 | | return false; | 586 | | } | 587 | | } | 588 | 148 | to = ToCppT(from.value); | 589 | 148 | } | 590 | 148 | return true; | 591 | 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 | 562 | 256 | CastParameters& params) { | 563 | | if constexpr (IsDecimal128V2<FromCppT>) { | 564 | | if constexpr (narrow_integral) { | 565 | | if (UNLIKELY(from.value() > max_result || from.value() < -max_result)) { | 566 | | if (params.is_strict) { | 567 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 568 | | decimal_to_string(from.value(), scale_from), | 569 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 570 | | precision_to, scale_to); | 571 | | } | 572 | | return false; | 573 | | } | 574 | | } | 575 | | to = ToCppT(from.value()); | 576 | 256 | } else { | 577 | | if constexpr (narrow_integral) { | 578 | | if (UNLIKELY(from.value > max_result || from.value < -max_result)) { | 579 | | if (params.is_strict) { | 580 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 581 | | decimal_to_string(from.value, scale_from), | 582 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 583 | | precision_to, scale_to); | 584 | | } | 585 | | return false; | 586 | | } | 587 | | } | 588 | 256 | to = ToCppT(from.value); | 589 | 256 | } | 590 | 256 | return true; | 591 | 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 | 562 | 62 | CastParameters& params) { | 563 | | if constexpr (IsDecimal128V2<FromCppT>) { | 564 | | if constexpr (narrow_integral) { | 565 | | if (UNLIKELY(from.value() > max_result || from.value() < -max_result)) { | 566 | | if (params.is_strict) { | 567 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 568 | | decimal_to_string(from.value(), scale_from), | 569 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 570 | | precision_to, scale_to); | 571 | | } | 572 | | return false; | 573 | | } | 574 | | } | 575 | | to = ToCppT(from.value()); | 576 | 62 | } else { | 577 | | if constexpr (narrow_integral) { | 578 | | if (UNLIKELY(from.value > max_result || from.value < -max_result)) { | 579 | | if (params.is_strict) { | 580 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 581 | | decimal_to_string(from.value, scale_from), | 582 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 583 | | precision_to, scale_to); | 584 | | } | 585 | | return false; | 586 | | } | 587 | | } | 588 | 62 | to = ToCppT(from.value); | 589 | 62 | } | 590 | 62 | return true; | 591 | 62 | } |
_ZN5doris13CastToDecimal24_from_decimal_same_scaleINS_12Decimal128V3ES2_nLb1EQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS4_jjRS3_jjRKNS3_10NativeTypeESA_RNS_14CastParametersE Line | Count | Source | 562 | 84 | CastParameters& params) { | 563 | | if constexpr (IsDecimal128V2<FromCppT>) { | 564 | | if constexpr (narrow_integral) { | 565 | | if (UNLIKELY(from.value() > max_result || from.value() < -max_result)) { | 566 | | if (params.is_strict) { | 567 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 568 | | decimal_to_string(from.value(), scale_from), | 569 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 570 | | precision_to, scale_to); | 571 | | } | 572 | | return false; | 573 | | } | 574 | | } | 575 | | to = ToCppT(from.value()); | 576 | 84 | } else { | 577 | 84 | if constexpr (narrow_integral) { | 578 | 84 | if (UNLIKELY(from.value > max_result || from.value < -max_result)) { | 579 | 24 | if (params.is_strict) { | 580 | 12 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 581 | 12 | decimal_to_string(from.value, scale_from), | 582 | 12 | fmt::format("decimal({}, {})", precision_from, scale_from), | 583 | 12 | precision_to, scale_to); | 584 | 12 | } | 585 | 24 | return false; | 586 | 24 | } | 587 | 84 | } | 588 | 60 | to = ToCppT(from.value); | 589 | 84 | } | 590 | 0 | return true; | 591 | 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 | 562 | 364 | CastParameters& params) { | 563 | | if constexpr (IsDecimal128V2<FromCppT>) { | 564 | | if constexpr (narrow_integral) { | 565 | | if (UNLIKELY(from.value() > max_result || from.value() < -max_result)) { | 566 | | if (params.is_strict) { | 567 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 568 | | decimal_to_string(from.value(), scale_from), | 569 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 570 | | precision_to, scale_to); | 571 | | } | 572 | | return false; | 573 | | } | 574 | | } | 575 | | to = ToCppT(from.value()); | 576 | 364 | } else { | 577 | 364 | if constexpr (narrow_integral) { | 578 | 364 | if (UNLIKELY(from.value > max_result || from.value < -max_result)) { | 579 | 108 | if (params.is_strict) { | 580 | 54 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 581 | 54 | decimal_to_string(from.value, scale_from), | 582 | 54 | fmt::format("decimal({}, {})", precision_from, scale_from), | 583 | 54 | precision_to, scale_to); | 584 | 54 | } | 585 | 108 | return false; | 586 | 108 | } | 587 | 364 | } | 588 | 256 | to = ToCppT(from.value); | 589 | 364 | } | 590 | 0 | return true; | 591 | 364 | } |
_ZN5doris13CastToDecimal24_from_decimal_same_scaleINS_7DecimalIiEENS2_IN4wide7integerILm256EiEEEES6_Lb0EQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKNS8_10NativeTypeESF_RNS_14CastParametersE Line | Count | Source | 562 | 148 | CastParameters& params) { | 563 | | if constexpr (IsDecimal128V2<FromCppT>) { | 564 | | if constexpr (narrow_integral) { | 565 | | if (UNLIKELY(from.value() > max_result || from.value() < -max_result)) { | 566 | | if (params.is_strict) { | 567 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 568 | | decimal_to_string(from.value(), scale_from), | 569 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 570 | | precision_to, scale_to); | 571 | | } | 572 | | return false; | 573 | | } | 574 | | } | 575 | | to = ToCppT(from.value()); | 576 | 148 | } else { | 577 | | if constexpr (narrow_integral) { | 578 | | if (UNLIKELY(from.value > max_result || from.value < -max_result)) { | 579 | | if (params.is_strict) { | 580 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 581 | | decimal_to_string(from.value, scale_from), | 582 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 583 | | precision_to, scale_to); | 584 | | } | 585 | | return false; | 586 | | } | 587 | | } | 588 | 148 | to = ToCppT(from.value); | 589 | 148 | } | 590 | 148 | return true; | 591 | 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 | 562 | 240 | CastParameters& params) { | 563 | | if constexpr (IsDecimal128V2<FromCppT>) { | 564 | | if constexpr (narrow_integral) { | 565 | | if (UNLIKELY(from.value() > max_result || from.value() < -max_result)) { | 566 | | if (params.is_strict) { | 567 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 568 | | decimal_to_string(from.value(), scale_from), | 569 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 570 | | precision_to, scale_to); | 571 | | } | 572 | | return false; | 573 | | } | 574 | | } | 575 | | to = ToCppT(from.value()); | 576 | 240 | } else { | 577 | | if constexpr (narrow_integral) { | 578 | | if (UNLIKELY(from.value > max_result || from.value < -max_result)) { | 579 | | if (params.is_strict) { | 580 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 581 | | decimal_to_string(from.value, scale_from), | 582 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 583 | | precision_to, scale_to); | 584 | | } | 585 | | return false; | 586 | | } | 587 | | } | 588 | 240 | to = ToCppT(from.value); | 589 | 240 | } | 590 | 240 | return true; | 591 | 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 | 562 | 256 | CastParameters& params) { | 563 | | if constexpr (IsDecimal128V2<FromCppT>) { | 564 | | if constexpr (narrow_integral) { | 565 | | if (UNLIKELY(from.value() > max_result || from.value() < -max_result)) { | 566 | | if (params.is_strict) { | 567 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 568 | | decimal_to_string(from.value(), scale_from), | 569 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 570 | | precision_to, scale_to); | 571 | | } | 572 | | return false; | 573 | | } | 574 | | } | 575 | | to = ToCppT(from.value()); | 576 | 256 | } else { | 577 | | if constexpr (narrow_integral) { | 578 | | if (UNLIKELY(from.value > max_result || from.value < -max_result)) { | 579 | | if (params.is_strict) { | 580 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 581 | | decimal_to_string(from.value, scale_from), | 582 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 583 | | precision_to, scale_to); | 584 | | } | 585 | | return false; | 586 | | } | 587 | | } | 588 | 256 | to = ToCppT(from.value); | 589 | 256 | } | 590 | 256 | return true; | 591 | 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 | 562 | 60 | CastParameters& params) { | 563 | | if constexpr (IsDecimal128V2<FromCppT>) { | 564 | | if constexpr (narrow_integral) { | 565 | | if (UNLIKELY(from.value() > max_result || from.value() < -max_result)) { | 566 | | if (params.is_strict) { | 567 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 568 | | decimal_to_string(from.value(), scale_from), | 569 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 570 | | precision_to, scale_to); | 571 | | } | 572 | | return false; | 573 | | } | 574 | | } | 575 | | to = ToCppT(from.value()); | 576 | 60 | } else { | 577 | | if constexpr (narrow_integral) { | 578 | | if (UNLIKELY(from.value > max_result || from.value < -max_result)) { | 579 | | if (params.is_strict) { | 580 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 581 | | decimal_to_string(from.value, scale_from), | 582 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 583 | | precision_to, scale_to); | 584 | | } | 585 | | return false; | 586 | | } | 587 | | } | 588 | 60 | to = ToCppT(from.value); | 589 | 60 | } | 590 | 60 | return true; | 591 | 60 | } |
_ZN5doris13CastToDecimal24_from_decimal_same_scaleINS_7DecimalIN4wide7integerILm256EiEEEES6_S5_Lb1EQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS8_jjRS7_jjRKNS7_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 562 | 84 | CastParameters& params) { | 563 | | if constexpr (IsDecimal128V2<FromCppT>) { | 564 | | if constexpr (narrow_integral) { | 565 | | if (UNLIKELY(from.value() > max_result || from.value() < -max_result)) { | 566 | | if (params.is_strict) { | 567 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 568 | | decimal_to_string(from.value(), scale_from), | 569 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 570 | | precision_to, scale_to); | 571 | | } | 572 | | return false; | 573 | | } | 574 | | } | 575 | | to = ToCppT(from.value()); | 576 | 84 | } else { | 577 | 84 | if constexpr (narrow_integral) { | 578 | 84 | if (UNLIKELY(from.value > max_result || from.value < -max_result)) { | 579 | 24 | if (params.is_strict) { | 580 | 12 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 581 | 12 | decimal_to_string(from.value, scale_from), | 582 | 12 | fmt::format("decimal({}, {})", precision_from, scale_from), | 583 | 12 | precision_to, scale_to); | 584 | 12 | } | 585 | 24 | return false; | 586 | 24 | } | 587 | 84 | } | 588 | 60 | to = ToCppT(from.value); | 589 | 84 | } | 590 | 0 | return true; | 591 | 84 | } |
_ZN5doris13CastToDecimal24_from_decimal_same_scaleINS_14DecimalV2ValueENS_7DecimalIiEEnLb0EQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RNS_14CastParametersE Line | Count | Source | 562 | 8 | CastParameters& params) { | 563 | 8 | if constexpr (IsDecimal128V2<FromCppT>) { | 564 | | if constexpr (narrow_integral) { | 565 | | if (UNLIKELY(from.value() > max_result || from.value() < -max_result)) { | 566 | | if (params.is_strict) { | 567 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 568 | | decimal_to_string(from.value(), scale_from), | 569 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 570 | | precision_to, scale_to); | 571 | | } | 572 | | return false; | 573 | | } | 574 | | } | 575 | 8 | to = ToCppT(from.value()); | 576 | | } else { | 577 | | if constexpr (narrow_integral) { | 578 | | if (UNLIKELY(from.value > max_result || from.value < -max_result)) { | 579 | | if (params.is_strict) { | 580 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 581 | | decimal_to_string(from.value, scale_from), | 582 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 583 | | precision_to, scale_to); | 584 | | } | 585 | | return false; | 586 | | } | 587 | | } | 588 | | to = ToCppT(from.value); | 589 | | } | 590 | 8 | return true; | 591 | 8 | } |
_ZN5doris13CastToDecimal24_from_decimal_same_scaleINS_14DecimalV2ValueENS_7DecimalIiEEnLb1EQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RNS_14CastParametersE Line | Count | Source | 562 | 70 | CastParameters& params) { | 563 | 70 | if constexpr (IsDecimal128V2<FromCppT>) { | 564 | 70 | if constexpr (narrow_integral) { | 565 | 70 | if (UNLIKELY(from.value() > max_result || from.value() < -max_result)) { | 566 | 36 | if (params.is_strict) { | 567 | 18 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 568 | 18 | decimal_to_string(from.value(), scale_from), | 569 | 18 | fmt::format("decimal({}, {})", precision_from, scale_from), | 570 | 18 | precision_to, scale_to); | 571 | 18 | } | 572 | 36 | return false; | 573 | 36 | } | 574 | 70 | } | 575 | 34 | to = ToCppT(from.value()); | 576 | | } else { | 577 | | if constexpr (narrow_integral) { | 578 | | if (UNLIKELY(from.value > max_result || from.value < -max_result)) { | 579 | | if (params.is_strict) { | 580 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 581 | | decimal_to_string(from.value, scale_from), | 582 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 583 | | precision_to, scale_to); | 584 | | } | 585 | | return false; | 586 | | } | 587 | | } | 588 | | to = ToCppT(from.value); | 589 | | } | 590 | 0 | return true; | 591 | 70 | } |
_ZN5doris13CastToDecimal24_from_decimal_same_scaleINS_14DecimalV2ValueENS_7DecimalIlEEnLb0EQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RNS_14CastParametersE Line | Count | Source | 562 | 14 | CastParameters& params) { | 563 | 14 | if constexpr (IsDecimal128V2<FromCppT>) { | 564 | | if constexpr (narrow_integral) { | 565 | | if (UNLIKELY(from.value() > max_result || from.value() < -max_result)) { | 566 | | if (params.is_strict) { | 567 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 568 | | decimal_to_string(from.value(), scale_from), | 569 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 570 | | precision_to, scale_to); | 571 | | } | 572 | | return false; | 573 | | } | 574 | | } | 575 | 14 | to = ToCppT(from.value()); | 576 | | } else { | 577 | | if constexpr (narrow_integral) { | 578 | | if (UNLIKELY(from.value > max_result || from.value < -max_result)) { | 579 | | if (params.is_strict) { | 580 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 581 | | decimal_to_string(from.value, scale_from), | 582 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 583 | | precision_to, scale_to); | 584 | | } | 585 | | return false; | 586 | | } | 587 | | } | 588 | | to = ToCppT(from.value); | 589 | | } | 590 | 14 | return true; | 591 | 14 | } |
_ZN5doris13CastToDecimal24_from_decimal_same_scaleINS_14DecimalV2ValueENS_7DecimalIlEEnLb1EQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RNS_14CastParametersE Line | Count | Source | 562 | 120 | CastParameters& params) { | 563 | 120 | if constexpr (IsDecimal128V2<FromCppT>) { | 564 | 120 | if constexpr (narrow_integral) { | 565 | 120 | if (UNLIKELY(from.value() > max_result || from.value() < -max_result)) { | 566 | 24 | if (params.is_strict) { | 567 | 12 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 568 | 12 | decimal_to_string(from.value(), scale_from), | 569 | 12 | fmt::format("decimal({}, {})", precision_from, scale_from), | 570 | 12 | precision_to, scale_to); | 571 | 12 | } | 572 | 24 | return false; | 573 | 24 | } | 574 | 120 | } | 575 | 96 | to = ToCppT(from.value()); | 576 | | } else { | 577 | | if constexpr (narrow_integral) { | 578 | | if (UNLIKELY(from.value > max_result || from.value < -max_result)) { | 579 | | if (params.is_strict) { | 580 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 581 | | decimal_to_string(from.value, scale_from), | 582 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 583 | | precision_to, scale_to); | 584 | | } | 585 | | return false; | 586 | | } | 587 | | } | 588 | | to = ToCppT(from.value); | 589 | | } | 590 | 0 | return true; | 591 | 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 |
592 | | |
593 | | template < |
594 | | typename FromCppT, typename ToCppT, bool multiply_may_overflow, bool narrow_integral, |
595 | | typename MaxNativeType = std::conditional_t< |
596 | | (sizeof(FromCppT) == sizeof(ToCppT)) && |
597 | | (std::is_same_v<ToCppT, Decimal128V3> || |
598 | | std::is_same_v<FromCppT, Decimal128V3>), |
599 | | Decimal128V3::NativeType, |
600 | | std::conditional_t<(sizeof(FromCppT) > sizeof(ToCppT)), |
601 | | typename FromCppT::NativeType, typename ToCppT::NativeType>>> |
602 | | requires(IsDecimalNumber<ToCppT> && IsDecimalNumber<FromCppT>) |
603 | | static inline bool _from_decimal_bigger_scale(const FromCppT& from, const UInt32 precision_from, |
604 | | const UInt32 scale_from, ToCppT& to, |
605 | | UInt32 precision_to, UInt32 scale_to, |
606 | | const MaxNativeType& scale_multiplier, |
607 | | const typename ToCppT::NativeType& min_result, |
608 | | const typename ToCppT::NativeType& max_result, |
609 | 16.7k | CastParameters& params) { |
610 | 16.7k | MaxNativeType res; |
611 | 16.7k | if (from >= FromCppT(0)) { |
612 | 16.7k | if constexpr (narrow_integral) { |
613 | 6.66k | if constexpr (IsDecimal128V2<FromCppT>) { |
614 | 1.67k | res = (from.value() + scale_multiplier / 2) / scale_multiplier; |
615 | 1.67k | if (UNLIKELY(res > max_result)) { |
616 | 488 | if (params.is_strict) { |
617 | 244 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( |
618 | 244 | decimal_to_string(from.value(), scale_from), |
619 | 244 | fmt::format("decimal({}, {})", precision_from, scale_from), |
620 | 244 | precision_to, scale_to); |
621 | 244 | } |
622 | 488 | return false; |
623 | 488 | } |
624 | 4.98k | } else { |
625 | 4.98k | res = (from.value + scale_multiplier / 2) / scale_multiplier; |
626 | 4.98k | if (UNLIKELY(res > max_result)) { |
627 | 2.07k | if (params.is_strict) { |
628 | 1.03k | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( |
629 | 1.03k | decimal_to_string(from.value, scale_from), |
630 | 1.03k | fmt::format("decimal({}, {})", precision_from, scale_from), |
631 | 1.03k | precision_to, scale_to); |
632 | 1.03k | } |
633 | 2.07k | return false; |
634 | 2.07k | } |
635 | 4.98k | } |
636 | 4.09k | to = ToCppT(res); |
637 | 10.1k | } else { |
638 | 10.1k | if constexpr (IsDecimal128V2<FromCppT>) { |
639 | 1.86k | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); |
640 | 8.24k | } else { |
641 | 8.24k | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); |
642 | 8.24k | } |
643 | 10.1k | } |
644 | 16.7k | } else { |
645 | 0 | if constexpr (narrow_integral) { |
646 | 0 | if constexpr (IsDecimal128V2<FromCppT>) { |
647 | 0 | res = (from.value() - scale_multiplier / 2) / scale_multiplier; |
648 | 0 | if (UNLIKELY(res < -max_result)) { |
649 | 0 | if (params.is_strict) { |
650 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( |
651 | 0 | decimal_to_string(from.value(), scale_from), |
652 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), |
653 | 0 | precision_to, scale_to); |
654 | 0 | } |
655 | 0 | return false; |
656 | 0 | } |
657 | 0 | } else { |
658 | 0 | res = (from.value - scale_multiplier / 2) / scale_multiplier; |
659 | 0 | if (UNLIKELY(res < -max_result)) { |
660 | 0 | if (params.is_strict) { |
661 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( |
662 | 0 | decimal_to_string(from.value, scale_from), |
663 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), |
664 | 0 | precision_to, scale_to); |
665 | 0 | } |
666 | 0 | return false; |
667 | 0 | } |
668 | 0 | } |
669 | 0 | to = ToCppT(res); |
670 | 0 | } else { |
671 | 0 | if constexpr (IsDecimal128V2<FromCppT>) { |
672 | 0 | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); |
673 | 0 | } else { |
674 | 0 | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); |
675 | 0 | } |
676 | 0 | } |
677 | 0 | } |
678 | 0 | return true; |
679 | 16.7k | } _ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_7DecimalIiEES3_Lb0ELb0EiQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 609 | 224 | CastParameters& params) { | 610 | 224 | MaxNativeType res; | 611 | 224 | if (from >= FromCppT(0)) { | 612 | | if constexpr (narrow_integral) { | 613 | | if constexpr (IsDecimal128V2<FromCppT>) { | 614 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 615 | | if (UNLIKELY(res > max_result)) { | 616 | | if (params.is_strict) { | 617 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 618 | | decimal_to_string(from.value(), scale_from), | 619 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 620 | | precision_to, scale_to); | 621 | | } | 622 | | return false; | 623 | | } | 624 | | } else { | 625 | | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 626 | | if (UNLIKELY(res > max_result)) { | 627 | | if (params.is_strict) { | 628 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 629 | | decimal_to_string(from.value, scale_from), | 630 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 631 | | precision_to, scale_to); | 632 | | } | 633 | | return false; | 634 | | } | 635 | | } | 636 | | to = ToCppT(res); | 637 | 224 | } else { | 638 | | if constexpr (IsDecimal128V2<FromCppT>) { | 639 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 640 | 224 | } else { | 641 | 224 | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 642 | 224 | } | 643 | 224 | } | 644 | 224 | } else { | 645 | | if constexpr (narrow_integral) { | 646 | | if constexpr (IsDecimal128V2<FromCppT>) { | 647 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 648 | | if (UNLIKELY(res < -max_result)) { | 649 | | if (params.is_strict) { | 650 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 651 | | decimal_to_string(from.value(), scale_from), | 652 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 653 | | precision_to, scale_to); | 654 | | } | 655 | | return false; | 656 | | } | 657 | | } else { | 658 | | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 659 | | if (UNLIKELY(res < -max_result)) { | 660 | | if (params.is_strict) { | 661 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 662 | | decimal_to_string(from.value, scale_from), | 663 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 664 | | precision_to, scale_to); | 665 | | } | 666 | | return false; | 667 | | } | 668 | | } | 669 | | to = ToCppT(res); | 670 | 0 | } else { | 671 | | if constexpr (IsDecimal128V2<FromCppT>) { | 672 | | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 673 | 0 | } else { | 674 | 0 | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 675 | 0 | } | 676 | 0 | } | 677 | 0 | } | 678 | 224 | return true; | 679 | 224 | } |
_ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_7DecimalIiEES3_Lb0ELb1EiQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 609 | 164 | CastParameters& params) { | 610 | 164 | MaxNativeType res; | 611 | 164 | if (from >= FromCppT(0)) { | 612 | 164 | if constexpr (narrow_integral) { | 613 | | if constexpr (IsDecimal128V2<FromCppT>) { | 614 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 615 | | if (UNLIKELY(res > max_result)) { | 616 | | if (params.is_strict) { | 617 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 618 | | decimal_to_string(from.value(), scale_from), | 619 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 620 | | precision_to, scale_to); | 621 | | } | 622 | | return false; | 623 | | } | 624 | 164 | } else { | 625 | 164 | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 626 | 164 | if (UNLIKELY(res > max_result)) { | 627 | 80 | if (params.is_strict) { | 628 | 40 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 629 | 40 | decimal_to_string(from.value, scale_from), | 630 | 40 | fmt::format("decimal({}, {})", precision_from, scale_from), | 631 | 40 | precision_to, scale_to); | 632 | 40 | } | 633 | 80 | return false; | 634 | 80 | } | 635 | 164 | } | 636 | 84 | to = ToCppT(res); | 637 | | } else { | 638 | | if constexpr (IsDecimal128V2<FromCppT>) { | 639 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 640 | | } else { | 641 | | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 642 | | } | 643 | | } | 644 | 164 | } else { | 645 | 0 | if constexpr (narrow_integral) { | 646 | | if constexpr (IsDecimal128V2<FromCppT>) { | 647 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 648 | | if (UNLIKELY(res < -max_result)) { | 649 | | if (params.is_strict) { | 650 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 651 | | decimal_to_string(from.value(), scale_from), | 652 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 653 | | precision_to, scale_to); | 654 | | } | 655 | | return false; | 656 | | } | 657 | 0 | } else { | 658 | 0 | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 659 | 0 | if (UNLIKELY(res < -max_result)) { | 660 | 0 | if (params.is_strict) { | 661 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 662 | 0 | decimal_to_string(from.value, scale_from), | 663 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 664 | 0 | precision_to, scale_to); | 665 | 0 | } | 666 | 0 | return false; | 667 | 0 | } | 668 | 0 | } | 669 | 0 | to = ToCppT(res); | 670 | | } else { | 671 | | if constexpr (IsDecimal128V2<FromCppT>) { | 672 | | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 673 | | } else { | 674 | | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 675 | | } | 676 | | } | 677 | 0 | } | 678 | 0 | return true; | 679 | 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 | 609 | 320 | CastParameters& params) { | 610 | 320 | MaxNativeType res; | 611 | 320 | if (from >= FromCppT(0)) { | 612 | | if constexpr (narrow_integral) { | 613 | | if constexpr (IsDecimal128V2<FromCppT>) { | 614 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 615 | | if (UNLIKELY(res > max_result)) { | 616 | | if (params.is_strict) { | 617 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 618 | | decimal_to_string(from.value(), scale_from), | 619 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 620 | | precision_to, scale_to); | 621 | | } | 622 | | return false; | 623 | | } | 624 | | } else { | 625 | | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 626 | | if (UNLIKELY(res > max_result)) { | 627 | | if (params.is_strict) { | 628 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 629 | | decimal_to_string(from.value, scale_from), | 630 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 631 | | precision_to, scale_to); | 632 | | } | 633 | | return false; | 634 | | } | 635 | | } | 636 | | to = ToCppT(res); | 637 | 320 | } else { | 638 | | if constexpr (IsDecimal128V2<FromCppT>) { | 639 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 640 | 320 | } else { | 641 | 320 | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 642 | 320 | } | 643 | 320 | } | 644 | 320 | } else { | 645 | | if constexpr (narrow_integral) { | 646 | | if constexpr (IsDecimal128V2<FromCppT>) { | 647 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 648 | | if (UNLIKELY(res < -max_result)) { | 649 | | if (params.is_strict) { | 650 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 651 | | decimal_to_string(from.value(), scale_from), | 652 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 653 | | precision_to, scale_to); | 654 | | } | 655 | | return false; | 656 | | } | 657 | | } else { | 658 | | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 659 | | if (UNLIKELY(res < -max_result)) { | 660 | | if (params.is_strict) { | 661 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 662 | | decimal_to_string(from.value, scale_from), | 663 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 664 | | precision_to, scale_to); | 665 | | } | 666 | | return false; | 667 | | } | 668 | | } | 669 | | to = ToCppT(res); | 670 | 0 | } else { | 671 | | if constexpr (IsDecimal128V2<FromCppT>) { | 672 | | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 673 | 0 | } else { | 674 | 0 | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 675 | 0 | } | 676 | 0 | } | 677 | 0 | } | 678 | 320 | return true; | 679 | 320 | } |
_ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_7DecimalIlEENS2_IiEELb0ELb1ElQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKT3_RKNS5_10NativeTypeESF_RNS_14CastParametersE Line | Count | Source | 609 | 646 | CastParameters& params) { | 610 | 646 | MaxNativeType res; | 611 | 646 | if (from >= FromCppT(0)) { | 612 | 646 | if constexpr (narrow_integral) { | 613 | | if constexpr (IsDecimal128V2<FromCppT>) { | 614 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 615 | | if (UNLIKELY(res > max_result)) { | 616 | | if (params.is_strict) { | 617 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 618 | | decimal_to_string(from.value(), scale_from), | 619 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 620 | | precision_to, scale_to); | 621 | | } | 622 | | return false; | 623 | | } | 624 | 646 | } else { | 625 | 646 | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 626 | 646 | if (UNLIKELY(res > max_result)) { | 627 | 266 | if (params.is_strict) { | 628 | 132 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 629 | 132 | decimal_to_string(from.value, scale_from), | 630 | 132 | fmt::format("decimal({}, {})", precision_from, scale_from), | 631 | 132 | precision_to, scale_to); | 632 | 132 | } | 633 | 266 | return false; | 634 | 266 | } | 635 | 646 | } | 636 | 380 | to = ToCppT(res); | 637 | | } else { | 638 | | if constexpr (IsDecimal128V2<FromCppT>) { | 639 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 640 | | } else { | 641 | | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 642 | | } | 643 | | } | 644 | 646 | } else { | 645 | 0 | if constexpr (narrow_integral) { | 646 | | if constexpr (IsDecimal128V2<FromCppT>) { | 647 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 648 | | if (UNLIKELY(res < -max_result)) { | 649 | | if (params.is_strict) { | 650 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 651 | | decimal_to_string(from.value(), scale_from), | 652 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 653 | | precision_to, scale_to); | 654 | | } | 655 | | return false; | 656 | | } | 657 | 0 | } else { | 658 | 0 | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 659 | 0 | if (UNLIKELY(res < -max_result)) { | 660 | 0 | if (params.is_strict) { | 661 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 662 | 0 | decimal_to_string(from.value, scale_from), | 663 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 664 | 0 | precision_to, scale_to); | 665 | 0 | } | 666 | 0 | return false; | 667 | 0 | } | 668 | 0 | } | 669 | 0 | to = ToCppT(res); | 670 | | } else { | 671 | | if constexpr (IsDecimal128V2<FromCppT>) { | 672 | | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 673 | | } else { | 674 | | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 675 | | } | 676 | | } | 677 | 0 | } | 678 | 0 | return true; | 679 | 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 | 609 | 320 | CastParameters& params) { | 610 | 320 | MaxNativeType res; | 611 | 320 | if (from >= FromCppT(0)) { | 612 | | if constexpr (narrow_integral) { | 613 | | if constexpr (IsDecimal128V2<FromCppT>) { | 614 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 615 | | if (UNLIKELY(res > max_result)) { | 616 | | if (params.is_strict) { | 617 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 618 | | decimal_to_string(from.value(), scale_from), | 619 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 620 | | precision_to, scale_to); | 621 | | } | 622 | | return false; | 623 | | } | 624 | | } else { | 625 | | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 626 | | if (UNLIKELY(res > max_result)) { | 627 | | if (params.is_strict) { | 628 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 629 | | decimal_to_string(from.value, scale_from), | 630 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 631 | | precision_to, scale_to); | 632 | | } | 633 | | return false; | 634 | | } | 635 | | } | 636 | | to = ToCppT(res); | 637 | 320 | } else { | 638 | | if constexpr (IsDecimal128V2<FromCppT>) { | 639 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 640 | 320 | } else { | 641 | 320 | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 642 | 320 | } | 643 | 320 | } | 644 | 320 | } else { | 645 | | if constexpr (narrow_integral) { | 646 | | if constexpr (IsDecimal128V2<FromCppT>) { | 647 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 648 | | if (UNLIKELY(res < -max_result)) { | 649 | | if (params.is_strict) { | 650 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 651 | | decimal_to_string(from.value(), scale_from), | 652 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 653 | | precision_to, scale_to); | 654 | | } | 655 | | return false; | 656 | | } | 657 | | } else { | 658 | | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 659 | | if (UNLIKELY(res < -max_result)) { | 660 | | if (params.is_strict) { | 661 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 662 | | decimal_to_string(from.value, scale_from), | 663 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 664 | | precision_to, scale_to); | 665 | | } | 666 | | return false; | 667 | | } | 668 | | } | 669 | | to = ToCppT(res); | 670 | 0 | } else { | 671 | | if constexpr (IsDecimal128V2<FromCppT>) { | 672 | | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 673 | 0 | } else { | 674 | 0 | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 675 | 0 | } | 676 | 0 | } | 677 | 0 | } | 678 | 320 | return true; | 679 | 320 | } |
_ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_12Decimal128V3ENS_7DecimalIiEELb0ELb1EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKT3_RKNS5_10NativeTypeESF_RNS_14CastParametersE Line | Count | Source | 609 | 714 | CastParameters& params) { | 610 | 714 | MaxNativeType res; | 611 | 714 | if (from >= FromCppT(0)) { | 612 | 714 | if constexpr (narrow_integral) { | 613 | | if constexpr (IsDecimal128V2<FromCppT>) { | 614 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 615 | | if (UNLIKELY(res > max_result)) { | 616 | | if (params.is_strict) { | 617 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 618 | | decimal_to_string(from.value(), scale_from), | 619 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 620 | | precision_to, scale_to); | 621 | | } | 622 | | return false; | 623 | | } | 624 | 714 | } else { | 625 | 714 | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 626 | 714 | if (UNLIKELY(res > max_result)) { | 627 | 322 | if (params.is_strict) { | 628 | 160 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 629 | 160 | decimal_to_string(from.value, scale_from), | 630 | 160 | fmt::format("decimal({}, {})", precision_from, scale_from), | 631 | 160 | precision_to, scale_to); | 632 | 160 | } | 633 | 322 | return false; | 634 | 322 | } | 635 | 714 | } | 636 | 392 | to = ToCppT(res); | 637 | | } else { | 638 | | if constexpr (IsDecimal128V2<FromCppT>) { | 639 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 640 | | } else { | 641 | | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 642 | | } | 643 | | } | 644 | 714 | } else { | 645 | 0 | if constexpr (narrow_integral) { | 646 | | if constexpr (IsDecimal128V2<FromCppT>) { | 647 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 648 | | if (UNLIKELY(res < -max_result)) { | 649 | | if (params.is_strict) { | 650 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 651 | | decimal_to_string(from.value(), scale_from), | 652 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 653 | | precision_to, scale_to); | 654 | | } | 655 | | return false; | 656 | | } | 657 | 0 | } else { | 658 | 0 | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 659 | 0 | if (UNLIKELY(res < -max_result)) { | 660 | 0 | if (params.is_strict) { | 661 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 662 | 0 | decimal_to_string(from.value, scale_from), | 663 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 664 | 0 | precision_to, scale_to); | 665 | 0 | } | 666 | 0 | return false; | 667 | 0 | } | 668 | 0 | } | 669 | 0 | to = ToCppT(res); | 670 | | } else { | 671 | | if constexpr (IsDecimal128V2<FromCppT>) { | 672 | | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 673 | | } else { | 674 | | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 675 | | } | 676 | | } | 677 | 0 | } | 678 | 0 | return true; | 679 | 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 | 609 | 320 | CastParameters& params) { | 610 | 320 | MaxNativeType res; | 611 | 320 | if (from >= FromCppT(0)) { | 612 | | if constexpr (narrow_integral) { | 613 | | if constexpr (IsDecimal128V2<FromCppT>) { | 614 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 615 | | if (UNLIKELY(res > max_result)) { | 616 | | if (params.is_strict) { | 617 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 618 | | decimal_to_string(from.value(), scale_from), | 619 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 620 | | precision_to, scale_to); | 621 | | } | 622 | | return false; | 623 | | } | 624 | | } else { | 625 | | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 626 | | if (UNLIKELY(res > max_result)) { | 627 | | if (params.is_strict) { | 628 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 629 | | decimal_to_string(from.value, scale_from), | 630 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 631 | | precision_to, scale_to); | 632 | | } | 633 | | return false; | 634 | | } | 635 | | } | 636 | | to = ToCppT(res); | 637 | 320 | } else { | 638 | | if constexpr (IsDecimal128V2<FromCppT>) { | 639 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 640 | 320 | } else { | 641 | 320 | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 642 | 320 | } | 643 | 320 | } | 644 | 320 | } else { | 645 | | if constexpr (narrow_integral) { | 646 | | if constexpr (IsDecimal128V2<FromCppT>) { | 647 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 648 | | if (UNLIKELY(res < -max_result)) { | 649 | | if (params.is_strict) { | 650 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 651 | | decimal_to_string(from.value(), scale_from), | 652 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 653 | | precision_to, scale_to); | 654 | | } | 655 | | return false; | 656 | | } | 657 | | } else { | 658 | | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 659 | | if (UNLIKELY(res < -max_result)) { | 660 | | if (params.is_strict) { | 661 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 662 | | decimal_to_string(from.value, scale_from), | 663 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 664 | | precision_to, scale_to); | 665 | | } | 666 | | return false; | 667 | | } | 668 | | } | 669 | | to = ToCppT(res); | 670 | 0 | } else { | 671 | | if constexpr (IsDecimal128V2<FromCppT>) { | 672 | | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 673 | 0 | } else { | 674 | 0 | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 675 | 0 | } | 676 | 0 | } | 677 | 0 | } | 678 | 320 | return true; | 679 | 320 | } |
_ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_7DecimalIN4wide7integerILm256EiEEEENS2_IiEELb0ELb1ES5_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKT3_RKNS8_10NativeTypeESI_RNS_14CastParametersE Line | Count | Source | 609 | 714 | CastParameters& params) { | 610 | 714 | MaxNativeType res; | 611 | 714 | if (from >= FromCppT(0)) { | 612 | 714 | if constexpr (narrow_integral) { | 613 | | if constexpr (IsDecimal128V2<FromCppT>) { | 614 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 615 | | if (UNLIKELY(res > max_result)) { | 616 | | if (params.is_strict) { | 617 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 618 | | decimal_to_string(from.value(), scale_from), | 619 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 620 | | precision_to, scale_to); | 621 | | } | 622 | | return false; | 623 | | } | 624 | 714 | } else { | 625 | 714 | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 626 | 714 | if (UNLIKELY(res > max_result)) { | 627 | 322 | if (params.is_strict) { | 628 | 160 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 629 | 160 | decimal_to_string(from.value, scale_from), | 630 | 160 | fmt::format("decimal({}, {})", precision_from, scale_from), | 631 | 160 | precision_to, scale_to); | 632 | 160 | } | 633 | 322 | return false; | 634 | 322 | } | 635 | 714 | } | 636 | 392 | to = ToCppT(res); | 637 | | } else { | 638 | | if constexpr (IsDecimal128V2<FromCppT>) { | 639 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 640 | | } else { | 641 | | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 642 | | } | 643 | | } | 644 | 714 | } else { | 645 | 0 | if constexpr (narrow_integral) { | 646 | | if constexpr (IsDecimal128V2<FromCppT>) { | 647 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 648 | | if (UNLIKELY(res < -max_result)) { | 649 | | if (params.is_strict) { | 650 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 651 | | decimal_to_string(from.value(), scale_from), | 652 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 653 | | precision_to, scale_to); | 654 | | } | 655 | | return false; | 656 | | } | 657 | 0 | } else { | 658 | 0 | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 659 | 0 | if (UNLIKELY(res < -max_result)) { | 660 | 0 | if (params.is_strict) { | 661 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 662 | 0 | decimal_to_string(from.value, scale_from), | 663 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 664 | 0 | precision_to, scale_to); | 665 | 0 | } | 666 | 0 | return false; | 667 | 0 | } | 668 | 0 | } | 669 | 0 | to = ToCppT(res); | 670 | | } else { | 671 | | if constexpr (IsDecimal128V2<FromCppT>) { | 672 | | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 673 | | } else { | 674 | | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 675 | | } | 676 | | } | 677 | 0 | } | 678 | 0 | return true; | 679 | 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 | 609 | 368 | CastParameters& params) { | 610 | 368 | MaxNativeType res; | 611 | 368 | if (from >= FromCppT(0)) { | 612 | | if constexpr (narrow_integral) { | 613 | | if constexpr (IsDecimal128V2<FromCppT>) { | 614 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 615 | | if (UNLIKELY(res > max_result)) { | 616 | | if (params.is_strict) { | 617 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 618 | | decimal_to_string(from.value(), scale_from), | 619 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 620 | | precision_to, scale_to); | 621 | | } | 622 | | return false; | 623 | | } | 624 | | } else { | 625 | | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 626 | | if (UNLIKELY(res > max_result)) { | 627 | | if (params.is_strict) { | 628 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 629 | | decimal_to_string(from.value, scale_from), | 630 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 631 | | precision_to, scale_to); | 632 | | } | 633 | | return false; | 634 | | } | 635 | | } | 636 | | to = ToCppT(res); | 637 | 368 | } else { | 638 | | if constexpr (IsDecimal128V2<FromCppT>) { | 639 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 640 | 368 | } else { | 641 | 368 | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 642 | 368 | } | 643 | 368 | } | 644 | 368 | } else { | 645 | | if constexpr (narrow_integral) { | 646 | | if constexpr (IsDecimal128V2<FromCppT>) { | 647 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 648 | | if (UNLIKELY(res < -max_result)) { | 649 | | if (params.is_strict) { | 650 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 651 | | decimal_to_string(from.value(), scale_from), | 652 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 653 | | precision_to, scale_to); | 654 | | } | 655 | | return false; | 656 | | } | 657 | | } else { | 658 | | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 659 | | if (UNLIKELY(res < -max_result)) { | 660 | | if (params.is_strict) { | 661 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 662 | | decimal_to_string(from.value, scale_from), | 663 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 664 | | precision_to, scale_to); | 665 | | } | 666 | | return false; | 667 | | } | 668 | | } | 669 | | to = ToCppT(res); | 670 | 0 | } else { | 671 | | if constexpr (IsDecimal128V2<FromCppT>) { | 672 | | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 673 | 0 | } else { | 674 | 0 | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 675 | 0 | } | 676 | 0 | } | 677 | 0 | } | 678 | 368 | return true; | 679 | 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 | 609 | 704 | CastParameters& params) { | 610 | 704 | MaxNativeType res; | 611 | 704 | if (from >= FromCppT(0)) { | 612 | | if constexpr (narrow_integral) { | 613 | | if constexpr (IsDecimal128V2<FromCppT>) { | 614 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 615 | | if (UNLIKELY(res > max_result)) { | 616 | | if (params.is_strict) { | 617 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 618 | | decimal_to_string(from.value(), scale_from), | 619 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 620 | | precision_to, scale_to); | 621 | | } | 622 | | return false; | 623 | | } | 624 | | } else { | 625 | | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 626 | | if (UNLIKELY(res > max_result)) { | 627 | | if (params.is_strict) { | 628 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 629 | | decimal_to_string(from.value, scale_from), | 630 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 631 | | precision_to, scale_to); | 632 | | } | 633 | | return false; | 634 | | } | 635 | | } | 636 | | to = ToCppT(res); | 637 | 704 | } else { | 638 | | if constexpr (IsDecimal128V2<FromCppT>) { | 639 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 640 | 704 | } else { | 641 | 704 | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 642 | 704 | } | 643 | 704 | } | 644 | 704 | } else { | 645 | | if constexpr (narrow_integral) { | 646 | | if constexpr (IsDecimal128V2<FromCppT>) { | 647 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 648 | | if (UNLIKELY(res < -max_result)) { | 649 | | if (params.is_strict) { | 650 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 651 | | decimal_to_string(from.value(), scale_from), | 652 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 653 | | precision_to, scale_to); | 654 | | } | 655 | | return false; | 656 | | } | 657 | | } else { | 658 | | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 659 | | if (UNLIKELY(res < -max_result)) { | 660 | | if (params.is_strict) { | 661 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 662 | | decimal_to_string(from.value, scale_from), | 663 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 664 | | precision_to, scale_to); | 665 | | } | 666 | | return false; | 667 | | } | 668 | | } | 669 | | to = ToCppT(res); | 670 | 0 | } else { | 671 | | if constexpr (IsDecimal128V2<FromCppT>) { | 672 | | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 673 | 0 | } else { | 674 | 0 | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 675 | 0 | } | 676 | 0 | } | 677 | 0 | } | 678 | 704 | return true; | 679 | 704 | } |
_ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_7DecimalIlEES3_Lb0ELb1ElQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 609 | 192 | CastParameters& params) { | 610 | 192 | MaxNativeType res; | 611 | 192 | if (from >= FromCppT(0)) { | 612 | 192 | if constexpr (narrow_integral) { | 613 | | if constexpr (IsDecimal128V2<FromCppT>) { | 614 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 615 | | if (UNLIKELY(res > max_result)) { | 616 | | if (params.is_strict) { | 617 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 618 | | decimal_to_string(from.value(), scale_from), | 619 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 620 | | precision_to, scale_to); | 621 | | } | 622 | | return false; | 623 | | } | 624 | 192 | } else { | 625 | 192 | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 626 | 192 | if (UNLIKELY(res > max_result)) { | 627 | 80 | if (params.is_strict) { | 628 | 40 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 629 | 40 | decimal_to_string(from.value, scale_from), | 630 | 40 | fmt::format("decimal({}, {})", precision_from, scale_from), | 631 | 40 | precision_to, scale_to); | 632 | 40 | } | 633 | 80 | return false; | 634 | 80 | } | 635 | 192 | } | 636 | 112 | to = ToCppT(res); | 637 | | } else { | 638 | | if constexpr (IsDecimal128V2<FromCppT>) { | 639 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 640 | | } else { | 641 | | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 642 | | } | 643 | | } | 644 | 192 | } else { | 645 | 0 | if constexpr (narrow_integral) { | 646 | | if constexpr (IsDecimal128V2<FromCppT>) { | 647 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 648 | | if (UNLIKELY(res < -max_result)) { | 649 | | if (params.is_strict) { | 650 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 651 | | decimal_to_string(from.value(), scale_from), | 652 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 653 | | precision_to, scale_to); | 654 | | } | 655 | | return false; | 656 | | } | 657 | 0 | } else { | 658 | 0 | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 659 | 0 | if (UNLIKELY(res < -max_result)) { | 660 | 0 | if (params.is_strict) { | 661 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 662 | 0 | decimal_to_string(from.value, scale_from), | 663 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 664 | 0 | precision_to, scale_to); | 665 | 0 | } | 666 | 0 | return false; | 667 | 0 | } | 668 | 0 | } | 669 | 0 | to = ToCppT(res); | 670 | | } else { | 671 | | if constexpr (IsDecimal128V2<FromCppT>) { | 672 | | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 673 | | } else { | 674 | | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 675 | | } | 676 | | } | 677 | 0 | } | 678 | 0 | return true; | 679 | 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 | 609 | 576 | CastParameters& params) { | 610 | 576 | MaxNativeType res; | 611 | 576 | if (from >= FromCppT(0)) { | 612 | | if constexpr (narrow_integral) { | 613 | | if constexpr (IsDecimal128V2<FromCppT>) { | 614 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 615 | | if (UNLIKELY(res > max_result)) { | 616 | | if (params.is_strict) { | 617 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 618 | | decimal_to_string(from.value(), scale_from), | 619 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 620 | | precision_to, scale_to); | 621 | | } | 622 | | return false; | 623 | | } | 624 | | } else { | 625 | | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 626 | | if (UNLIKELY(res > max_result)) { | 627 | | if (params.is_strict) { | 628 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 629 | | decimal_to_string(from.value, scale_from), | 630 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 631 | | precision_to, scale_to); | 632 | | } | 633 | | return false; | 634 | | } | 635 | | } | 636 | | to = ToCppT(res); | 637 | 576 | } else { | 638 | | if constexpr (IsDecimal128V2<FromCppT>) { | 639 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 640 | 576 | } else { | 641 | 576 | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 642 | 576 | } | 643 | 576 | } | 644 | 576 | } else { | 645 | | if constexpr (narrow_integral) { | 646 | | if constexpr (IsDecimal128V2<FromCppT>) { | 647 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 648 | | if (UNLIKELY(res < -max_result)) { | 649 | | if (params.is_strict) { | 650 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 651 | | decimal_to_string(from.value(), scale_from), | 652 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 653 | | precision_to, scale_to); | 654 | | } | 655 | | return false; | 656 | | } | 657 | | } else { | 658 | | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 659 | | if (UNLIKELY(res < -max_result)) { | 660 | | if (params.is_strict) { | 661 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 662 | | decimal_to_string(from.value, scale_from), | 663 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 664 | | precision_to, scale_to); | 665 | | } | 666 | | return false; | 667 | | } | 668 | | } | 669 | | to = ToCppT(res); | 670 | 0 | } else { | 671 | | if constexpr (IsDecimal128V2<FromCppT>) { | 672 | | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 673 | 0 | } else { | 674 | 0 | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 675 | 0 | } | 676 | 0 | } | 677 | 0 | } | 678 | 576 | return true; | 679 | 576 | } |
_ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_12Decimal128V3ENS_7DecimalIlEELb0ELb1EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKT3_RKNS5_10NativeTypeESF_RNS_14CastParametersE Line | Count | Source | 609 | 700 | CastParameters& params) { | 610 | 700 | MaxNativeType res; | 611 | 700 | if (from >= FromCppT(0)) { | 612 | 700 | if constexpr (narrow_integral) { | 613 | | if constexpr (IsDecimal128V2<FromCppT>) { | 614 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 615 | | if (UNLIKELY(res > max_result)) { | 616 | | if (params.is_strict) { | 617 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 618 | | decimal_to_string(from.value(), scale_from), | 619 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 620 | | precision_to, scale_to); | 621 | | } | 622 | | return false; | 623 | | } | 624 | 700 | } else { | 625 | 700 | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 626 | 700 | if (UNLIKELY(res > max_result)) { | 627 | 264 | if (params.is_strict) { | 628 | 132 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 629 | 132 | decimal_to_string(from.value, scale_from), | 630 | 132 | fmt::format("decimal({}, {})", precision_from, scale_from), | 631 | 132 | precision_to, scale_to); | 632 | 132 | } | 633 | 264 | return false; | 634 | 264 | } | 635 | 700 | } | 636 | 436 | to = ToCppT(res); | 637 | | } else { | 638 | | if constexpr (IsDecimal128V2<FromCppT>) { | 639 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 640 | | } else { | 641 | | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 642 | | } | 643 | | } | 644 | 700 | } else { | 645 | 0 | if constexpr (narrow_integral) { | 646 | | if constexpr (IsDecimal128V2<FromCppT>) { | 647 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 648 | | if (UNLIKELY(res < -max_result)) { | 649 | | if (params.is_strict) { | 650 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 651 | | decimal_to_string(from.value(), scale_from), | 652 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 653 | | precision_to, scale_to); | 654 | | } | 655 | | return false; | 656 | | } | 657 | 0 | } else { | 658 | 0 | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 659 | 0 | if (UNLIKELY(res < -max_result)) { | 660 | 0 | if (params.is_strict) { | 661 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 662 | 0 | decimal_to_string(from.value, scale_from), | 663 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 664 | 0 | precision_to, scale_to); | 665 | 0 | } | 666 | 0 | return false; | 667 | 0 | } | 668 | 0 | } | 669 | 0 | to = ToCppT(res); | 670 | | } else { | 671 | | if constexpr (IsDecimal128V2<FromCppT>) { | 672 | | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 673 | | } else { | 674 | | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 675 | | } | 676 | | } | 677 | 0 | } | 678 | 0 | return true; | 679 | 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 | 609 | 576 | CastParameters& params) { | 610 | 576 | MaxNativeType res; | 611 | 576 | if (from >= FromCppT(0)) { | 612 | | if constexpr (narrow_integral) { | 613 | | if constexpr (IsDecimal128V2<FromCppT>) { | 614 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 615 | | if (UNLIKELY(res > max_result)) { | 616 | | if (params.is_strict) { | 617 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 618 | | decimal_to_string(from.value(), scale_from), | 619 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 620 | | precision_to, scale_to); | 621 | | } | 622 | | return false; | 623 | | } | 624 | | } else { | 625 | | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 626 | | if (UNLIKELY(res > max_result)) { | 627 | | if (params.is_strict) { | 628 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 629 | | decimal_to_string(from.value, scale_from), | 630 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 631 | | precision_to, scale_to); | 632 | | } | 633 | | return false; | 634 | | } | 635 | | } | 636 | | to = ToCppT(res); | 637 | 576 | } else { | 638 | | if constexpr (IsDecimal128V2<FromCppT>) { | 639 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 640 | 576 | } else { | 641 | 576 | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 642 | 576 | } | 643 | 576 | } | 644 | 576 | } else { | 645 | | if constexpr (narrow_integral) { | 646 | | if constexpr (IsDecimal128V2<FromCppT>) { | 647 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 648 | | if (UNLIKELY(res < -max_result)) { | 649 | | if (params.is_strict) { | 650 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 651 | | decimal_to_string(from.value(), scale_from), | 652 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 653 | | precision_to, scale_to); | 654 | | } | 655 | | return false; | 656 | | } | 657 | | } else { | 658 | | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 659 | | if (UNLIKELY(res < -max_result)) { | 660 | | if (params.is_strict) { | 661 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 662 | | decimal_to_string(from.value, scale_from), | 663 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 664 | | precision_to, scale_to); | 665 | | } | 666 | | return false; | 667 | | } | 668 | | } | 669 | | to = ToCppT(res); | 670 | 0 | } else { | 671 | | if constexpr (IsDecimal128V2<FromCppT>) { | 672 | | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 673 | 0 | } else { | 674 | 0 | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 675 | 0 | } | 676 | 0 | } | 677 | 0 | } | 678 | 576 | return true; | 679 | 576 | } |
_ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_7DecimalIN4wide7integerILm256EiEEEENS2_IlEELb0ELb1ES5_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKT3_RKNS8_10NativeTypeESI_RNS_14CastParametersE Line | Count | Source | 609 | 768 | CastParameters& params) { | 610 | 768 | MaxNativeType res; | 611 | 768 | if (from >= FromCppT(0)) { | 612 | 768 | if constexpr (narrow_integral) { | 613 | | if constexpr (IsDecimal128V2<FromCppT>) { | 614 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 615 | | if (UNLIKELY(res > max_result)) { | 616 | | if (params.is_strict) { | 617 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 618 | | decimal_to_string(from.value(), scale_from), | 619 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 620 | | precision_to, scale_to); | 621 | | } | 622 | | return false; | 623 | | } | 624 | 768 | } else { | 625 | 768 | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 626 | 768 | if (UNLIKELY(res > max_result)) { | 627 | 320 | if (params.is_strict) { | 628 | 160 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 629 | 160 | decimal_to_string(from.value, scale_from), | 630 | 160 | fmt::format("decimal({}, {})", precision_from, scale_from), | 631 | 160 | precision_to, scale_to); | 632 | 160 | } | 633 | 320 | return false; | 634 | 320 | } | 635 | 768 | } | 636 | 448 | to = ToCppT(res); | 637 | | } else { | 638 | | if constexpr (IsDecimal128V2<FromCppT>) { | 639 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 640 | | } else { | 641 | | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 642 | | } | 643 | | } | 644 | 768 | } else { | 645 | 0 | if constexpr (narrow_integral) { | 646 | | if constexpr (IsDecimal128V2<FromCppT>) { | 647 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 648 | | if (UNLIKELY(res < -max_result)) { | 649 | | if (params.is_strict) { | 650 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 651 | | decimal_to_string(from.value(), scale_from), | 652 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 653 | | precision_to, scale_to); | 654 | | } | 655 | | return false; | 656 | | } | 657 | 0 | } else { | 658 | 0 | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 659 | 0 | if (UNLIKELY(res < -max_result)) { | 660 | 0 | if (params.is_strict) { | 661 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 662 | 0 | decimal_to_string(from.value, scale_from), | 663 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 664 | 0 | precision_to, scale_to); | 665 | 0 | } | 666 | 0 | return false; | 667 | 0 | } | 668 | 0 | } | 669 | 0 | to = ToCppT(res); | 670 | | } else { | 671 | | if constexpr (IsDecimal128V2<FromCppT>) { | 672 | | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 673 | | } else { | 674 | | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 675 | | } | 676 | | } | 677 | 0 | } | 678 | 0 | return true; | 679 | 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 | 609 | 368 | CastParameters& params) { | 610 | 368 | MaxNativeType res; | 611 | 368 | if (from >= FromCppT(0)) { | 612 | | if constexpr (narrow_integral) { | 613 | | if constexpr (IsDecimal128V2<FromCppT>) { | 614 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 615 | | if (UNLIKELY(res > max_result)) { | 616 | | if (params.is_strict) { | 617 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 618 | | decimal_to_string(from.value(), scale_from), | 619 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 620 | | precision_to, scale_to); | 621 | | } | 622 | | return false; | 623 | | } | 624 | | } else { | 625 | | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 626 | | if (UNLIKELY(res > max_result)) { | 627 | | if (params.is_strict) { | 628 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 629 | | decimal_to_string(from.value, scale_from), | 630 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 631 | | precision_to, scale_to); | 632 | | } | 633 | | return false; | 634 | | } | 635 | | } | 636 | | to = ToCppT(res); | 637 | 368 | } else { | 638 | | if constexpr (IsDecimal128V2<FromCppT>) { | 639 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 640 | 368 | } else { | 641 | 368 | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 642 | 368 | } | 643 | 368 | } | 644 | 368 | } else { | 645 | | if constexpr (narrow_integral) { | 646 | | if constexpr (IsDecimal128V2<FromCppT>) { | 647 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 648 | | if (UNLIKELY(res < -max_result)) { | 649 | | if (params.is_strict) { | 650 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 651 | | decimal_to_string(from.value(), scale_from), | 652 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 653 | | precision_to, scale_to); | 654 | | } | 655 | | return false; | 656 | | } | 657 | | } else { | 658 | | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 659 | | if (UNLIKELY(res < -max_result)) { | 660 | | if (params.is_strict) { | 661 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 662 | | decimal_to_string(from.value, scale_from), | 663 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 664 | | precision_to, scale_to); | 665 | | } | 666 | | return false; | 667 | | } | 668 | | } | 669 | | to = ToCppT(res); | 670 | 0 | } else { | 671 | | if constexpr (IsDecimal128V2<FromCppT>) { | 672 | | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 673 | 0 | } else { | 674 | 0 | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 675 | 0 | } | 676 | 0 | } | 677 | 0 | } | 678 | 368 | return true; | 679 | 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 | 609 | 704 | CastParameters& params) { | 610 | 704 | MaxNativeType res; | 611 | 704 | if (from >= FromCppT(0)) { | 612 | | if constexpr (narrow_integral) { | 613 | | if constexpr (IsDecimal128V2<FromCppT>) { | 614 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 615 | | if (UNLIKELY(res > max_result)) { | 616 | | if (params.is_strict) { | 617 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 618 | | decimal_to_string(from.value(), scale_from), | 619 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 620 | | precision_to, scale_to); | 621 | | } | 622 | | return false; | 623 | | } | 624 | | } else { | 625 | | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 626 | | if (UNLIKELY(res > max_result)) { | 627 | | if (params.is_strict) { | 628 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 629 | | decimal_to_string(from.value, scale_from), | 630 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 631 | | precision_to, scale_to); | 632 | | } | 633 | | return false; | 634 | | } | 635 | | } | 636 | | to = ToCppT(res); | 637 | 704 | } else { | 638 | | if constexpr (IsDecimal128V2<FromCppT>) { | 639 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 640 | 704 | } else { | 641 | 704 | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 642 | 704 | } | 643 | 704 | } | 644 | 704 | } else { | 645 | | if constexpr (narrow_integral) { | 646 | | if constexpr (IsDecimal128V2<FromCppT>) { | 647 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 648 | | if (UNLIKELY(res < -max_result)) { | 649 | | if (params.is_strict) { | 650 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 651 | | decimal_to_string(from.value(), scale_from), | 652 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 653 | | precision_to, scale_to); | 654 | | } | 655 | | return false; | 656 | | } | 657 | | } else { | 658 | | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 659 | | if (UNLIKELY(res < -max_result)) { | 660 | | if (params.is_strict) { | 661 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 662 | | decimal_to_string(from.value, scale_from), | 663 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 664 | | precision_to, scale_to); | 665 | | } | 666 | | return false; | 667 | | } | 668 | | } | 669 | | to = ToCppT(res); | 670 | 0 | } else { | 671 | | if constexpr (IsDecimal128V2<FromCppT>) { | 672 | | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 673 | 0 | } else { | 674 | 0 | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 675 | 0 | } | 676 | 0 | } | 677 | 0 | } | 678 | 704 | return true; | 679 | 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 | 609 | 704 | CastParameters& params) { | 610 | 704 | MaxNativeType res; | 611 | 704 | if (from >= FromCppT(0)) { | 612 | | if constexpr (narrow_integral) { | 613 | | if constexpr (IsDecimal128V2<FromCppT>) { | 614 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 615 | | if (UNLIKELY(res > max_result)) { | 616 | | if (params.is_strict) { | 617 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 618 | | decimal_to_string(from.value(), scale_from), | 619 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 620 | | precision_to, scale_to); | 621 | | } | 622 | | return false; | 623 | | } | 624 | | } else { | 625 | | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 626 | | if (UNLIKELY(res > max_result)) { | 627 | | if (params.is_strict) { | 628 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 629 | | decimal_to_string(from.value, scale_from), | 630 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 631 | | precision_to, scale_to); | 632 | | } | 633 | | return false; | 634 | | } | 635 | | } | 636 | | to = ToCppT(res); | 637 | 704 | } else { | 638 | | if constexpr (IsDecimal128V2<FromCppT>) { | 639 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 640 | 704 | } else { | 641 | 704 | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 642 | 704 | } | 643 | 704 | } | 644 | 704 | } else { | 645 | | if constexpr (narrow_integral) { | 646 | | if constexpr (IsDecimal128V2<FromCppT>) { | 647 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 648 | | if (UNLIKELY(res < -max_result)) { | 649 | | if (params.is_strict) { | 650 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 651 | | decimal_to_string(from.value(), scale_from), | 652 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 653 | | precision_to, scale_to); | 654 | | } | 655 | | return false; | 656 | | } | 657 | | } else { | 658 | | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 659 | | if (UNLIKELY(res < -max_result)) { | 660 | | if (params.is_strict) { | 661 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 662 | | decimal_to_string(from.value, scale_from), | 663 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 664 | | precision_to, scale_to); | 665 | | } | 666 | | return false; | 667 | | } | 668 | | } | 669 | | to = ToCppT(res); | 670 | 0 | } else { | 671 | | if constexpr (IsDecimal128V2<FromCppT>) { | 672 | | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 673 | 0 | } else { | 674 | 0 | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 675 | 0 | } | 676 | 0 | } | 677 | 0 | } | 678 | 704 | return true; | 679 | 704 | } |
_ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_12Decimal128V3ES2_Lb0ELb1EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS4_jjRS3_jjRKT3_RKNS3_10NativeTypeESD_RNS_14CastParametersE Line | Count | Source | 609 | 192 | CastParameters& params) { | 610 | 192 | MaxNativeType res; | 611 | 192 | if (from >= FromCppT(0)) { | 612 | 192 | if constexpr (narrow_integral) { | 613 | | if constexpr (IsDecimal128V2<FromCppT>) { | 614 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 615 | | if (UNLIKELY(res > max_result)) { | 616 | | if (params.is_strict) { | 617 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 618 | | decimal_to_string(from.value(), scale_from), | 619 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 620 | | precision_to, scale_to); | 621 | | } | 622 | | return false; | 623 | | } | 624 | 192 | } else { | 625 | 192 | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 626 | 192 | if (UNLIKELY(res > max_result)) { | 627 | 80 | if (params.is_strict) { | 628 | 40 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 629 | 40 | decimal_to_string(from.value, scale_from), | 630 | 40 | fmt::format("decimal({}, {})", precision_from, scale_from), | 631 | 40 | precision_to, scale_to); | 632 | 40 | } | 633 | 80 | return false; | 634 | 80 | } | 635 | 192 | } | 636 | 112 | to = ToCppT(res); | 637 | | } else { | 638 | | if constexpr (IsDecimal128V2<FromCppT>) { | 639 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 640 | | } else { | 641 | | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 642 | | } | 643 | | } | 644 | 192 | } else { | 645 | 0 | if constexpr (narrow_integral) { | 646 | | if constexpr (IsDecimal128V2<FromCppT>) { | 647 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 648 | | if (UNLIKELY(res < -max_result)) { | 649 | | if (params.is_strict) { | 650 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 651 | | decimal_to_string(from.value(), scale_from), | 652 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 653 | | precision_to, scale_to); | 654 | | } | 655 | | return false; | 656 | | } | 657 | 0 | } else { | 658 | 0 | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 659 | 0 | if (UNLIKELY(res < -max_result)) { | 660 | 0 | if (params.is_strict) { | 661 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 662 | 0 | decimal_to_string(from.value, scale_from), | 663 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 664 | 0 | precision_to, scale_to); | 665 | 0 | } | 666 | 0 | return false; | 667 | 0 | } | 668 | 0 | } | 669 | 0 | to = ToCppT(res); | 670 | | } else { | 671 | | if constexpr (IsDecimal128V2<FromCppT>) { | 672 | | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 673 | | } else { | 674 | | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 675 | | } | 676 | | } | 677 | 0 | } | 678 | 0 | return true; | 679 | 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 | 609 | 576 | CastParameters& params) { | 610 | 576 | MaxNativeType res; | 611 | 576 | if (from >= FromCppT(0)) { | 612 | | if constexpr (narrow_integral) { | 613 | | if constexpr (IsDecimal128V2<FromCppT>) { | 614 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 615 | | if (UNLIKELY(res > max_result)) { | 616 | | if (params.is_strict) { | 617 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 618 | | decimal_to_string(from.value(), scale_from), | 619 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 620 | | precision_to, scale_to); | 621 | | } | 622 | | return false; | 623 | | } | 624 | | } else { | 625 | | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 626 | | if (UNLIKELY(res > max_result)) { | 627 | | if (params.is_strict) { | 628 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 629 | | decimal_to_string(from.value, scale_from), | 630 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 631 | | precision_to, scale_to); | 632 | | } | 633 | | return false; | 634 | | } | 635 | | } | 636 | | to = ToCppT(res); | 637 | 576 | } else { | 638 | | if constexpr (IsDecimal128V2<FromCppT>) { | 639 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 640 | 576 | } else { | 641 | 576 | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 642 | 576 | } | 643 | 576 | } | 644 | 576 | } else { | 645 | | if constexpr (narrow_integral) { | 646 | | if constexpr (IsDecimal128V2<FromCppT>) { | 647 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 648 | | if (UNLIKELY(res < -max_result)) { | 649 | | if (params.is_strict) { | 650 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 651 | | decimal_to_string(from.value(), scale_from), | 652 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 653 | | precision_to, scale_to); | 654 | | } | 655 | | return false; | 656 | | } | 657 | | } else { | 658 | | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 659 | | if (UNLIKELY(res < -max_result)) { | 660 | | if (params.is_strict) { | 661 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 662 | | decimal_to_string(from.value, scale_from), | 663 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 664 | | precision_to, scale_to); | 665 | | } | 666 | | return false; | 667 | | } | 668 | | } | 669 | | to = ToCppT(res); | 670 | 0 | } else { | 671 | | if constexpr (IsDecimal128V2<FromCppT>) { | 672 | | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 673 | 0 | } else { | 674 | 0 | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 675 | 0 | } | 676 | 0 | } | 677 | 0 | } | 678 | 576 | return true; | 679 | 576 | } |
_ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_7DecimalIN4wide7integerILm256EiEEEENS_12Decimal128V3ELb0ELb1ES5_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKT3_RKNS8_10NativeTypeESI_RNS_14CastParametersE Line | Count | Source | 609 | 700 | CastParameters& params) { | 610 | 700 | MaxNativeType res; | 611 | 700 | if (from >= FromCppT(0)) { | 612 | 700 | if constexpr (narrow_integral) { | 613 | | if constexpr (IsDecimal128V2<FromCppT>) { | 614 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 615 | | if (UNLIKELY(res > max_result)) { | 616 | | if (params.is_strict) { | 617 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 618 | | decimal_to_string(from.value(), scale_from), | 619 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 620 | | precision_to, scale_to); | 621 | | } | 622 | | return false; | 623 | | } | 624 | 700 | } else { | 625 | 700 | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 626 | 700 | if (UNLIKELY(res > max_result)) { | 627 | 264 | if (params.is_strict) { | 628 | 132 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 629 | 132 | decimal_to_string(from.value, scale_from), | 630 | 132 | fmt::format("decimal({}, {})", precision_from, scale_from), | 631 | 132 | precision_to, scale_to); | 632 | 132 | } | 633 | 264 | return false; | 634 | 264 | } | 635 | 700 | } | 636 | 436 | to = ToCppT(res); | 637 | | } else { | 638 | | if constexpr (IsDecimal128V2<FromCppT>) { | 639 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 640 | | } else { | 641 | | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 642 | | } | 643 | | } | 644 | 700 | } else { | 645 | 0 | if constexpr (narrow_integral) { | 646 | | if constexpr (IsDecimal128V2<FromCppT>) { | 647 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 648 | | if (UNLIKELY(res < -max_result)) { | 649 | | if (params.is_strict) { | 650 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 651 | | decimal_to_string(from.value(), scale_from), | 652 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 653 | | precision_to, scale_to); | 654 | | } | 655 | | return false; | 656 | | } | 657 | 0 | } else { | 658 | 0 | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 659 | 0 | if (UNLIKELY(res < -max_result)) { | 660 | 0 | if (params.is_strict) { | 661 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 662 | 0 | decimal_to_string(from.value, scale_from), | 663 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 664 | 0 | precision_to, scale_to); | 665 | 0 | } | 666 | 0 | return false; | 667 | 0 | } | 668 | 0 | } | 669 | 0 | to = ToCppT(res); | 670 | | } else { | 671 | | if constexpr (IsDecimal128V2<FromCppT>) { | 672 | | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 673 | | } else { | 674 | | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 675 | | } | 676 | | } | 677 | 0 | } | 678 | 0 | return true; | 679 | 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 | 609 | 368 | CastParameters& params) { | 610 | 368 | MaxNativeType res; | 611 | 368 | if (from >= FromCppT(0)) { | 612 | | if constexpr (narrow_integral) { | 613 | | if constexpr (IsDecimal128V2<FromCppT>) { | 614 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 615 | | if (UNLIKELY(res > max_result)) { | 616 | | if (params.is_strict) { | 617 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 618 | | decimal_to_string(from.value(), scale_from), | 619 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 620 | | precision_to, scale_to); | 621 | | } | 622 | | return false; | 623 | | } | 624 | | } else { | 625 | | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 626 | | if (UNLIKELY(res > max_result)) { | 627 | | if (params.is_strict) { | 628 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 629 | | decimal_to_string(from.value, scale_from), | 630 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 631 | | precision_to, scale_to); | 632 | | } | 633 | | return false; | 634 | | } | 635 | | } | 636 | | to = ToCppT(res); | 637 | 368 | } else { | 638 | | if constexpr (IsDecimal128V2<FromCppT>) { | 639 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 640 | 368 | } else { | 641 | 368 | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 642 | 368 | } | 643 | 368 | } | 644 | 368 | } else { | 645 | | if constexpr (narrow_integral) { | 646 | | if constexpr (IsDecimal128V2<FromCppT>) { | 647 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 648 | | if (UNLIKELY(res < -max_result)) { | 649 | | if (params.is_strict) { | 650 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 651 | | decimal_to_string(from.value(), scale_from), | 652 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 653 | | precision_to, scale_to); | 654 | | } | 655 | | return false; | 656 | | } | 657 | | } else { | 658 | | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 659 | | if (UNLIKELY(res < -max_result)) { | 660 | | if (params.is_strict) { | 661 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 662 | | decimal_to_string(from.value, scale_from), | 663 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 664 | | precision_to, scale_to); | 665 | | } | 666 | | return false; | 667 | | } | 668 | | } | 669 | | to = ToCppT(res); | 670 | 0 | } else { | 671 | | if constexpr (IsDecimal128V2<FromCppT>) { | 672 | | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 673 | 0 | } else { | 674 | 0 | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 675 | 0 | } | 676 | 0 | } | 677 | 0 | } | 678 | 368 | return true; | 679 | 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 | 609 | 704 | CastParameters& params) { | 610 | 704 | MaxNativeType res; | 611 | 704 | if (from >= FromCppT(0)) { | 612 | | if constexpr (narrow_integral) { | 613 | | if constexpr (IsDecimal128V2<FromCppT>) { | 614 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 615 | | if (UNLIKELY(res > max_result)) { | 616 | | if (params.is_strict) { | 617 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 618 | | decimal_to_string(from.value(), scale_from), | 619 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 620 | | precision_to, scale_to); | 621 | | } | 622 | | return false; | 623 | | } | 624 | | } else { | 625 | | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 626 | | if (UNLIKELY(res > max_result)) { | 627 | | if (params.is_strict) { | 628 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 629 | | decimal_to_string(from.value, scale_from), | 630 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 631 | | precision_to, scale_to); | 632 | | } | 633 | | return false; | 634 | | } | 635 | | } | 636 | | to = ToCppT(res); | 637 | 704 | } else { | 638 | | if constexpr (IsDecimal128V2<FromCppT>) { | 639 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 640 | 704 | } else { | 641 | 704 | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 642 | 704 | } | 643 | 704 | } | 644 | 704 | } else { | 645 | | if constexpr (narrow_integral) { | 646 | | if constexpr (IsDecimal128V2<FromCppT>) { | 647 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 648 | | if (UNLIKELY(res < -max_result)) { | 649 | | if (params.is_strict) { | 650 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 651 | | decimal_to_string(from.value(), scale_from), | 652 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 653 | | precision_to, scale_to); | 654 | | } | 655 | | return false; | 656 | | } | 657 | | } else { | 658 | | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 659 | | if (UNLIKELY(res < -max_result)) { | 660 | | if (params.is_strict) { | 661 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 662 | | decimal_to_string(from.value, scale_from), | 663 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 664 | | precision_to, scale_to); | 665 | | } | 666 | | return false; | 667 | | } | 668 | | } | 669 | | to = ToCppT(res); | 670 | 0 | } else { | 671 | | if constexpr (IsDecimal128V2<FromCppT>) { | 672 | | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 673 | 0 | } else { | 674 | 0 | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 675 | 0 | } | 676 | 0 | } | 677 | 0 | } | 678 | 704 | return true; | 679 | 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 | 609 | 704 | CastParameters& params) { | 610 | 704 | MaxNativeType res; | 611 | 704 | if (from >= FromCppT(0)) { | 612 | | if constexpr (narrow_integral) { | 613 | | if constexpr (IsDecimal128V2<FromCppT>) { | 614 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 615 | | if (UNLIKELY(res > max_result)) { | 616 | | if (params.is_strict) { | 617 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 618 | | decimal_to_string(from.value(), scale_from), | 619 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 620 | | precision_to, scale_to); | 621 | | } | 622 | | return false; | 623 | | } | 624 | | } else { | 625 | | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 626 | | if (UNLIKELY(res > max_result)) { | 627 | | if (params.is_strict) { | 628 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 629 | | decimal_to_string(from.value, scale_from), | 630 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 631 | | precision_to, scale_to); | 632 | | } | 633 | | return false; | 634 | | } | 635 | | } | 636 | | to = ToCppT(res); | 637 | 704 | } else { | 638 | | if constexpr (IsDecimal128V2<FromCppT>) { | 639 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 640 | 704 | } else { | 641 | 704 | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 642 | 704 | } | 643 | 704 | } | 644 | 704 | } else { | 645 | | if constexpr (narrow_integral) { | 646 | | if constexpr (IsDecimal128V2<FromCppT>) { | 647 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 648 | | if (UNLIKELY(res < -max_result)) { | 649 | | if (params.is_strict) { | 650 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 651 | | decimal_to_string(from.value(), scale_from), | 652 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 653 | | precision_to, scale_to); | 654 | | } | 655 | | return false; | 656 | | } | 657 | | } else { | 658 | | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 659 | | if (UNLIKELY(res < -max_result)) { | 660 | | if (params.is_strict) { | 661 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 662 | | decimal_to_string(from.value, scale_from), | 663 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 664 | | precision_to, scale_to); | 665 | | } | 666 | | return false; | 667 | | } | 668 | | } | 669 | | to = ToCppT(res); | 670 | 0 | } else { | 671 | | if constexpr (IsDecimal128V2<FromCppT>) { | 672 | | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 673 | 0 | } else { | 674 | 0 | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 675 | 0 | } | 676 | 0 | } | 677 | 0 | } | 678 | 704 | return true; | 679 | 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 | 609 | 704 | CastParameters& params) { | 610 | 704 | MaxNativeType res; | 611 | 704 | if (from >= FromCppT(0)) { | 612 | | if constexpr (narrow_integral) { | 613 | | if constexpr (IsDecimal128V2<FromCppT>) { | 614 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 615 | | if (UNLIKELY(res > max_result)) { | 616 | | if (params.is_strict) { | 617 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 618 | | decimal_to_string(from.value(), scale_from), | 619 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 620 | | precision_to, scale_to); | 621 | | } | 622 | | return false; | 623 | | } | 624 | | } else { | 625 | | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 626 | | if (UNLIKELY(res > max_result)) { | 627 | | if (params.is_strict) { | 628 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 629 | | decimal_to_string(from.value, scale_from), | 630 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 631 | | precision_to, scale_to); | 632 | | } | 633 | | return false; | 634 | | } | 635 | | } | 636 | | to = ToCppT(res); | 637 | 704 | } else { | 638 | | if constexpr (IsDecimal128V2<FromCppT>) { | 639 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 640 | 704 | } else { | 641 | 704 | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 642 | 704 | } | 643 | 704 | } | 644 | 704 | } else { | 645 | | if constexpr (narrow_integral) { | 646 | | if constexpr (IsDecimal128V2<FromCppT>) { | 647 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 648 | | if (UNLIKELY(res < -max_result)) { | 649 | | if (params.is_strict) { | 650 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 651 | | decimal_to_string(from.value(), scale_from), | 652 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 653 | | precision_to, scale_to); | 654 | | } | 655 | | return false; | 656 | | } | 657 | | } else { | 658 | | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 659 | | if (UNLIKELY(res < -max_result)) { | 660 | | if (params.is_strict) { | 661 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 662 | | decimal_to_string(from.value, scale_from), | 663 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 664 | | precision_to, scale_to); | 665 | | } | 666 | | return false; | 667 | | } | 668 | | } | 669 | | to = ToCppT(res); | 670 | 0 | } else { | 671 | | if constexpr (IsDecimal128V2<FromCppT>) { | 672 | | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 673 | 0 | } else { | 674 | 0 | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 675 | 0 | } | 676 | 0 | } | 677 | 0 | } | 678 | 704 | return true; | 679 | 704 | } |
_ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_7DecimalIN4wide7integerILm256EiEEEES6_Lb0ELb1ES5_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS8_jjRS7_jjRKT3_RKNS7_10NativeTypeESH_RNS_14CastParametersE Line | Count | Source | 609 | 192 | CastParameters& params) { | 610 | 192 | MaxNativeType res; | 611 | 192 | if (from >= FromCppT(0)) { | 612 | 192 | if constexpr (narrow_integral) { | 613 | | if constexpr (IsDecimal128V2<FromCppT>) { | 614 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 615 | | if (UNLIKELY(res > max_result)) { | 616 | | if (params.is_strict) { | 617 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 618 | | decimal_to_string(from.value(), scale_from), | 619 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 620 | | precision_to, scale_to); | 621 | | } | 622 | | return false; | 623 | | } | 624 | 192 | } else { | 625 | 192 | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 626 | 192 | if (UNLIKELY(res > max_result)) { | 627 | 80 | if (params.is_strict) { | 628 | 40 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 629 | 40 | decimal_to_string(from.value, scale_from), | 630 | 40 | fmt::format("decimal({}, {})", precision_from, scale_from), | 631 | 40 | precision_to, scale_to); | 632 | 40 | } | 633 | 80 | return false; | 634 | 80 | } | 635 | 192 | } | 636 | 112 | to = ToCppT(res); | 637 | | } else { | 638 | | if constexpr (IsDecimal128V2<FromCppT>) { | 639 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 640 | | } else { | 641 | | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 642 | | } | 643 | | } | 644 | 192 | } else { | 645 | 0 | if constexpr (narrow_integral) { | 646 | | if constexpr (IsDecimal128V2<FromCppT>) { | 647 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 648 | | if (UNLIKELY(res < -max_result)) { | 649 | | if (params.is_strict) { | 650 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 651 | | decimal_to_string(from.value(), scale_from), | 652 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 653 | | precision_to, scale_to); | 654 | | } | 655 | | return false; | 656 | | } | 657 | 0 | } else { | 658 | 0 | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 659 | 0 | if (UNLIKELY(res < -max_result)) { | 660 | 0 | if (params.is_strict) { | 661 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 662 | 0 | decimal_to_string(from.value, scale_from), | 663 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 664 | 0 | precision_to, scale_to); | 665 | 0 | } | 666 | 0 | return false; | 667 | 0 | } | 668 | 0 | } | 669 | 0 | to = ToCppT(res); | 670 | | } else { | 671 | | if constexpr (IsDecimal128V2<FromCppT>) { | 672 | | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 673 | | } else { | 674 | | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 675 | | } | 676 | | } | 677 | 0 | } | 678 | 0 | return true; | 679 | 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 | 609 | 64 | CastParameters& params) { | 610 | 64 | MaxNativeType res; | 611 | 64 | if (from >= FromCppT(0)) { | 612 | | if constexpr (narrow_integral) { | 613 | | if constexpr (IsDecimal128V2<FromCppT>) { | 614 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 615 | | if (UNLIKELY(res > max_result)) { | 616 | | if (params.is_strict) { | 617 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 618 | | decimal_to_string(from.value(), scale_from), | 619 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 620 | | precision_to, scale_to); | 621 | | } | 622 | | return false; | 623 | | } | 624 | | } else { | 625 | | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 626 | | if (UNLIKELY(res > max_result)) { | 627 | | if (params.is_strict) { | 628 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 629 | | decimal_to_string(from.value, scale_from), | 630 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 631 | | precision_to, scale_to); | 632 | | } | 633 | | return false; | 634 | | } | 635 | | } | 636 | | to = ToCppT(res); | 637 | 64 | } else { | 638 | 64 | if constexpr (IsDecimal128V2<FromCppT>) { | 639 | 64 | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 640 | | } else { | 641 | | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 642 | | } | 643 | 64 | } | 644 | 64 | } else { | 645 | | if constexpr (narrow_integral) { | 646 | | if constexpr (IsDecimal128V2<FromCppT>) { | 647 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 648 | | if (UNLIKELY(res < -max_result)) { | 649 | | if (params.is_strict) { | 650 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 651 | | decimal_to_string(from.value(), scale_from), | 652 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 653 | | precision_to, scale_to); | 654 | | } | 655 | | return false; | 656 | | } | 657 | | } else { | 658 | | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 659 | | if (UNLIKELY(res < -max_result)) { | 660 | | if (params.is_strict) { | 661 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 662 | | decimal_to_string(from.value, scale_from), | 663 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 664 | | precision_to, scale_to); | 665 | | } | 666 | | return false; | 667 | | } | 668 | | } | 669 | | to = ToCppT(res); | 670 | 0 | } else { | 671 | 0 | if constexpr (IsDecimal128V2<FromCppT>) { | 672 | 0 | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 673 | | } else { | 674 | | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 675 | | } | 676 | 0 | } | 677 | 0 | } | 678 | 64 | return true; | 679 | 64 | } |
_ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_14DecimalV2ValueENS_7DecimalIiEELb0ELb1EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKT3_RKNS5_10NativeTypeESF_RNS_14CastParametersE Line | Count | Source | 609 | 870 | CastParameters& params) { | 610 | 870 | MaxNativeType res; | 611 | 870 | if (from >= FromCppT(0)) { | 612 | 870 | if constexpr (narrow_integral) { | 613 | 870 | if constexpr (IsDecimal128V2<FromCppT>) { | 614 | 870 | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 615 | 870 | if (UNLIKELY(res > max_result)) { | 616 | 312 | if (params.is_strict) { | 617 | 156 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 618 | 156 | decimal_to_string(from.value(), scale_from), | 619 | 156 | fmt::format("decimal({}, {})", precision_from, scale_from), | 620 | 156 | precision_to, scale_to); | 621 | 156 | } | 622 | 312 | return false; | 623 | 312 | } | 624 | | } else { | 625 | | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 626 | | if (UNLIKELY(res > max_result)) { | 627 | | if (params.is_strict) { | 628 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 629 | | decimal_to_string(from.value, scale_from), | 630 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 631 | | precision_to, scale_to); | 632 | | } | 633 | | return false; | 634 | | } | 635 | | } | 636 | 558 | to = ToCppT(res); | 637 | | } else { | 638 | | if constexpr (IsDecimal128V2<FromCppT>) { | 639 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 640 | | } else { | 641 | | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 642 | | } | 643 | | } | 644 | 870 | } else { | 645 | 0 | if constexpr (narrow_integral) { | 646 | 0 | if constexpr (IsDecimal128V2<FromCppT>) { | 647 | 0 | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 648 | 0 | if (UNLIKELY(res < -max_result)) { | 649 | 0 | if (params.is_strict) { | 650 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 651 | 0 | decimal_to_string(from.value(), scale_from), | 652 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 653 | 0 | precision_to, scale_to); | 654 | 0 | } | 655 | 0 | return false; | 656 | 0 | } | 657 | | } else { | 658 | | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 659 | | if (UNLIKELY(res < -max_result)) { | 660 | | if (params.is_strict) { | 661 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 662 | | decimal_to_string(from.value, scale_from), | 663 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 664 | | precision_to, scale_to); | 665 | | } | 666 | | return false; | 667 | | } | 668 | | } | 669 | 0 | to = ToCppT(res); | 670 | | } else { | 671 | | if constexpr (IsDecimal128V2<FromCppT>) { | 672 | | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 673 | | } else { | 674 | | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 675 | | } | 676 | | } | 677 | 0 | } | 678 | 0 | return true; | 679 | 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 | 609 | 248 | CastParameters& params) { | 610 | 248 | MaxNativeType res; | 611 | 248 | if (from >= FromCppT(0)) { | 612 | | if constexpr (narrow_integral) { | 613 | | if constexpr (IsDecimal128V2<FromCppT>) { | 614 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 615 | | if (UNLIKELY(res > max_result)) { | 616 | | if (params.is_strict) { | 617 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 618 | | decimal_to_string(from.value(), scale_from), | 619 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 620 | | precision_to, scale_to); | 621 | | } | 622 | | return false; | 623 | | } | 624 | | } else { | 625 | | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 626 | | if (UNLIKELY(res > max_result)) { | 627 | | if (params.is_strict) { | 628 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 629 | | decimal_to_string(from.value, scale_from), | 630 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 631 | | precision_to, scale_to); | 632 | | } | 633 | | return false; | 634 | | } | 635 | | } | 636 | | to = ToCppT(res); | 637 | 248 | } else { | 638 | 248 | if constexpr (IsDecimal128V2<FromCppT>) { | 639 | 248 | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 640 | | } else { | 641 | | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 642 | | } | 643 | 248 | } | 644 | 248 | } else { | 645 | | if constexpr (narrow_integral) { | 646 | | if constexpr (IsDecimal128V2<FromCppT>) { | 647 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 648 | | if (UNLIKELY(res < -max_result)) { | 649 | | if (params.is_strict) { | 650 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 651 | | decimal_to_string(from.value(), scale_from), | 652 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 653 | | precision_to, scale_to); | 654 | | } | 655 | | return false; | 656 | | } | 657 | | } else { | 658 | | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 659 | | if (UNLIKELY(res < -max_result)) { | 660 | | if (params.is_strict) { | 661 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 662 | | decimal_to_string(from.value, scale_from), | 663 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 664 | | precision_to, scale_to); | 665 | | } | 666 | | return false; | 667 | | } | 668 | | } | 669 | | to = ToCppT(res); | 670 | 0 | } else { | 671 | 0 | if constexpr (IsDecimal128V2<FromCppT>) { | 672 | 0 | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 673 | | } else { | 674 | | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 675 | | } | 676 | 0 | } | 677 | 0 | } | 678 | 248 | return true; | 679 | 248 | } |
_ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_14DecimalV2ValueENS_7DecimalIlEELb0ELb1EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKT3_RKNS5_10NativeTypeESF_RNS_14CastParametersE Line | Count | Source | 609 | 708 | CastParameters& params) { | 610 | 708 | MaxNativeType res; | 611 | 708 | if (from >= FromCppT(0)) { | 612 | 708 | if constexpr (narrow_integral) { | 613 | 708 | if constexpr (IsDecimal128V2<FromCppT>) { | 614 | 708 | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 615 | 708 | if (UNLIKELY(res > max_result)) { | 616 | 168 | if (params.is_strict) { | 617 | 84 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 618 | 84 | decimal_to_string(from.value(), scale_from), | 619 | 84 | fmt::format("decimal({}, {})", precision_from, scale_from), | 620 | 84 | precision_to, scale_to); | 621 | 84 | } | 622 | 168 | return false; | 623 | 168 | } | 624 | | } else { | 625 | | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 626 | | if (UNLIKELY(res > max_result)) { | 627 | | if (params.is_strict) { | 628 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 629 | | decimal_to_string(from.value, scale_from), | 630 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 631 | | precision_to, scale_to); | 632 | | } | 633 | | return false; | 634 | | } | 635 | | } | 636 | 540 | to = ToCppT(res); | 637 | | } else { | 638 | | if constexpr (IsDecimal128V2<FromCppT>) { | 639 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 640 | | } else { | 641 | | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 642 | | } | 643 | | } | 644 | 708 | } else { | 645 | 0 | if constexpr (narrow_integral) { | 646 | 0 | if constexpr (IsDecimal128V2<FromCppT>) { | 647 | 0 | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 648 | 0 | if (UNLIKELY(res < -max_result)) { | 649 | 0 | if (params.is_strict) { | 650 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 651 | 0 | decimal_to_string(from.value(), scale_from), | 652 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 653 | 0 | precision_to, scale_to); | 654 | 0 | } | 655 | 0 | return false; | 656 | 0 | } | 657 | | } else { | 658 | | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 659 | | if (UNLIKELY(res < -max_result)) { | 660 | | if (params.is_strict) { | 661 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 662 | | decimal_to_string(from.value, scale_from), | 663 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 664 | | precision_to, scale_to); | 665 | | } | 666 | | return false; | 667 | | } | 668 | | } | 669 | 0 | to = ToCppT(res); | 670 | | } else { | 671 | | if constexpr (IsDecimal128V2<FromCppT>) { | 672 | | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 673 | | } else { | 674 | | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 675 | | } | 676 | | } | 677 | 0 | } | 678 | 0 | return true; | 679 | 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 | 609 | 728 | CastParameters& params) { | 610 | 728 | MaxNativeType res; | 611 | 728 | if (from >= FromCppT(0)) { | 612 | | if constexpr (narrow_integral) { | 613 | | if constexpr (IsDecimal128V2<FromCppT>) { | 614 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 615 | | if (UNLIKELY(res > max_result)) { | 616 | | if (params.is_strict) { | 617 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 618 | | decimal_to_string(from.value(), scale_from), | 619 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 620 | | precision_to, scale_to); | 621 | | } | 622 | | return false; | 623 | | } | 624 | | } else { | 625 | | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 626 | | if (UNLIKELY(res > max_result)) { | 627 | | if (params.is_strict) { | 628 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 629 | | decimal_to_string(from.value, scale_from), | 630 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 631 | | precision_to, scale_to); | 632 | | } | 633 | | return false; | 634 | | } | 635 | | } | 636 | | to = ToCppT(res); | 637 | 728 | } else { | 638 | 728 | if constexpr (IsDecimal128V2<FromCppT>) { | 639 | 728 | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 640 | | } else { | 641 | | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 642 | | } | 643 | 728 | } | 644 | 728 | } else { | 645 | | if constexpr (narrow_integral) { | 646 | | if constexpr (IsDecimal128V2<FromCppT>) { | 647 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 648 | | if (UNLIKELY(res < -max_result)) { | 649 | | if (params.is_strict) { | 650 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 651 | | decimal_to_string(from.value(), scale_from), | 652 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 653 | | precision_to, scale_to); | 654 | | } | 655 | | return false; | 656 | | } | 657 | | } else { | 658 | | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 659 | | if (UNLIKELY(res < -max_result)) { | 660 | | if (params.is_strict) { | 661 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 662 | | decimal_to_string(from.value, scale_from), | 663 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 664 | | precision_to, scale_to); | 665 | | } | 666 | | return false; | 667 | | } | 668 | | } | 669 | | to = ToCppT(res); | 670 | 0 | } else { | 671 | 0 | if constexpr (IsDecimal128V2<FromCppT>) { | 672 | 0 | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 673 | | } else { | 674 | | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 675 | | } | 676 | 0 | } | 677 | 0 | } | 678 | 728 | return true; | 679 | 728 | } |
_ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_14DecimalV2ValueENS_12Decimal128V3ELb0ELb1EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 609 | 100 | CastParameters& params) { | 610 | 100 | MaxNativeType res; | 611 | 100 | if (from >= FromCppT(0)) { | 612 | 100 | if constexpr (narrow_integral) { | 613 | 100 | if constexpr (IsDecimal128V2<FromCppT>) { | 614 | 100 | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 615 | 100 | if (UNLIKELY(res > max_result)) { | 616 | 8 | if (params.is_strict) { | 617 | 4 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 618 | 4 | decimal_to_string(from.value(), scale_from), | 619 | 4 | fmt::format("decimal({}, {})", precision_from, scale_from), | 620 | 4 | precision_to, scale_to); | 621 | 4 | } | 622 | 8 | return false; | 623 | 8 | } | 624 | | } else { | 625 | | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 626 | | if (UNLIKELY(res > max_result)) { | 627 | | if (params.is_strict) { | 628 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 629 | | decimal_to_string(from.value, scale_from), | 630 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 631 | | precision_to, scale_to); | 632 | | } | 633 | | return false; | 634 | | } | 635 | | } | 636 | 92 | to = ToCppT(res); | 637 | | } else { | 638 | | if constexpr (IsDecimal128V2<FromCppT>) { | 639 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 640 | | } else { | 641 | | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 642 | | } | 643 | | } | 644 | 100 | } else { | 645 | 0 | if constexpr (narrow_integral) { | 646 | 0 | if constexpr (IsDecimal128V2<FromCppT>) { | 647 | 0 | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 648 | 0 | if (UNLIKELY(res < -max_result)) { | 649 | 0 | if (params.is_strict) { | 650 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 651 | 0 | decimal_to_string(from.value(), scale_from), | 652 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 653 | 0 | precision_to, scale_to); | 654 | 0 | } | 655 | 0 | return false; | 656 | 0 | } | 657 | | } else { | 658 | | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 659 | | if (UNLIKELY(res < -max_result)) { | 660 | | if (params.is_strict) { | 661 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 662 | | decimal_to_string(from.value, scale_from), | 663 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 664 | | precision_to, scale_to); | 665 | | } | 666 | | return false; | 667 | | } | 668 | | } | 669 | 0 | to = ToCppT(res); | 670 | | } else { | 671 | | if constexpr (IsDecimal128V2<FromCppT>) { | 672 | | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 673 | | } else { | 674 | | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 675 | | } | 676 | | } | 677 | 0 | } | 678 | 0 | return true; | 679 | 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 | 609 | 824 | CastParameters& params) { | 610 | 824 | MaxNativeType res; | 611 | 824 | if (from >= FromCppT(0)) { | 612 | | if constexpr (narrow_integral) { | 613 | | if constexpr (IsDecimal128V2<FromCppT>) { | 614 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 615 | | if (UNLIKELY(res > max_result)) { | 616 | | if (params.is_strict) { | 617 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 618 | | decimal_to_string(from.value(), scale_from), | 619 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 620 | | precision_to, scale_to); | 621 | | } | 622 | | return false; | 623 | | } | 624 | | } else { | 625 | | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 626 | | if (UNLIKELY(res > max_result)) { | 627 | | if (params.is_strict) { | 628 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 629 | | decimal_to_string(from.value, scale_from), | 630 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 631 | | precision_to, scale_to); | 632 | | } | 633 | | return false; | 634 | | } | 635 | | } | 636 | | to = ToCppT(res); | 637 | 824 | } else { | 638 | 824 | if constexpr (IsDecimal128V2<FromCppT>) { | 639 | 824 | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 640 | | } else { | 641 | | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 642 | | } | 643 | 824 | } | 644 | 824 | } else { | 645 | | if constexpr (narrow_integral) { | 646 | | if constexpr (IsDecimal128V2<FromCppT>) { | 647 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 648 | | if (UNLIKELY(res < -max_result)) { | 649 | | if (params.is_strict) { | 650 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 651 | | decimal_to_string(from.value(), scale_from), | 652 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 653 | | precision_to, scale_to); | 654 | | } | 655 | | return false; | 656 | | } | 657 | | } else { | 658 | | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 659 | | if (UNLIKELY(res < -max_result)) { | 660 | | if (params.is_strict) { | 661 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 662 | | decimal_to_string(from.value, scale_from), | 663 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 664 | | precision_to, scale_to); | 665 | | } | 666 | | return false; | 667 | | } | 668 | | } | 669 | | to = ToCppT(res); | 670 | 0 | } else { | 671 | 0 | if constexpr (IsDecimal128V2<FromCppT>) { | 672 | 0 | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 673 | | } else { | 674 | | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 675 | | } | 676 | 0 | } | 677 | 0 | } | 678 | 824 | return true; | 679 | 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 |
680 | | }; |
681 | | |
682 | | // Casting from string to decimal types. |
683 | | template <CastModeType Mode, typename ToDataType> |
684 | | requires(IsDataTypeDecimal<ToDataType>) |
685 | | class CastToImpl<Mode, DataTypeString, ToDataType> : public CastToBase { |
686 | | Status execute_impl(FunctionContext* context, Block& block, const ColumnNumbers& arguments, |
687 | | uint32_t result, size_t /*input_rows_count*/, |
688 | 11.7k | const NullMap::value_type* null_map = nullptr) const override { |
689 | 11.7k | const auto* col_from = assert_cast<const DataTypeString::ColumnType*>( |
690 | 11.7k | block.get_by_position(arguments[0]).column.get()); |
691 | | |
692 | 11.7k | auto to_type = block.get_by_position(result).type; |
693 | 11.7k | auto nested_to_type = remove_nullable(to_type); |
694 | 11.7k | auto serde = nested_to_type->get_serde(); |
695 | | |
696 | 11.7k | if constexpr (Mode == CastModeType::NonStrictMode) { |
697 | 5.79k | auto nullable_col_to = create_empty_nullable_column(nested_to_type); |
698 | | // may write nulls to nullable_col_to |
699 | 5.79k | RETURN_IF_ERROR(serde->from_string_batch(*col_from, *nullable_col_to, {})); |
700 | 5.79k | block.get_by_position(result).column = std::move(nullable_col_to); |
701 | 5.93k | } else if constexpr (Mode == CastModeType::StrictMode) { |
702 | 5.93k | MutableColumnPtr column_to = nested_to_type->create_column(); |
703 | | // WON'T write nulls to the result column, just raise errors. null_map is only used to skip invalid rows |
704 | 5.93k | RETURN_IF_ERROR( |
705 | 5.93k | serde->from_string_strict_mode_batch(*col_from, *column_to, {}, null_map)); |
706 | 5.11k | block.get_by_position(result).column = std::move(column_to); |
707 | | } else { |
708 | | return Status::InternalError("Unsupported cast mode"); |
709 | | } |
710 | | |
711 | 0 | return Status::OK(); |
712 | 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 | 688 | 1.70k | const NullMap::value_type* null_map = nullptr) const override { | 689 | 1.70k | const auto* col_from = assert_cast<const DataTypeString::ColumnType*>( | 690 | 1.70k | block.get_by_position(arguments[0]).column.get()); | 691 | | | 692 | 1.70k | auto to_type = block.get_by_position(result).type; | 693 | 1.70k | auto nested_to_type = remove_nullable(to_type); | 694 | 1.70k | auto serde = nested_to_type->get_serde(); | 695 | | | 696 | | if constexpr (Mode == CastModeType::NonStrictMode) { | 697 | | auto nullable_col_to = create_empty_nullable_column(nested_to_type); | 698 | | // may write nulls to nullable_col_to | 699 | | RETURN_IF_ERROR(serde->from_string_batch(*col_from, *nullable_col_to, {})); | 700 | | block.get_by_position(result).column = std::move(nullable_col_to); | 701 | 1.70k | } else if constexpr (Mode == CastModeType::StrictMode) { | 702 | 1.70k | MutableColumnPtr column_to = nested_to_type->create_column(); | 703 | | // WON'T write nulls to the result column, just raise errors. null_map is only used to skip invalid rows | 704 | 1.70k | RETURN_IF_ERROR( | 705 | 1.70k | serde->from_string_strict_mode_batch(*col_from, *column_to, {}, null_map)); | 706 | 1.33k | block.get_by_position(result).column = std::move(column_to); | 707 | | } else { | 708 | | return Status::InternalError("Unsupported cast mode"); | 709 | | } | 710 | | | 711 | 0 | return Status::OK(); | 712 | 1.70k | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeStringENS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 688 | 1.56k | const NullMap::value_type* null_map = nullptr) const override { | 689 | 1.56k | const auto* col_from = assert_cast<const DataTypeString::ColumnType*>( | 690 | 1.56k | block.get_by_position(arguments[0]).column.get()); | 691 | | | 692 | 1.56k | auto to_type = block.get_by_position(result).type; | 693 | 1.56k | auto nested_to_type = remove_nullable(to_type); | 694 | 1.56k | auto serde = nested_to_type->get_serde(); | 695 | | | 696 | 1.56k | if constexpr (Mode == CastModeType::NonStrictMode) { | 697 | 1.56k | auto nullable_col_to = create_empty_nullable_column(nested_to_type); | 698 | | // may write nulls to nullable_col_to | 699 | 1.56k | RETURN_IF_ERROR(serde->from_string_batch(*col_from, *nullable_col_to, {})); | 700 | 1.56k | block.get_by_position(result).column = std::move(nullable_col_to); | 701 | | } else if constexpr (Mode == CastModeType::StrictMode) { | 702 | | MutableColumnPtr column_to = nested_to_type->create_column(); | 703 | | // WON'T write nulls to the result column, just raise errors. null_map is only used to skip invalid rows | 704 | | RETURN_IF_ERROR( | 705 | | serde->from_string_strict_mode_batch(*col_from, *column_to, {}, null_map)); | 706 | | block.get_by_position(result).column = std::move(column_to); | 707 | | } else { | 708 | | return Status::InternalError("Unsupported cast mode"); | 709 | | } | 710 | | | 711 | 0 | return Status::OK(); | 712 | 1.56k | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeStringENS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 688 | 1.41k | const NullMap::value_type* null_map = nullptr) const override { | 689 | 1.41k | const auto* col_from = assert_cast<const DataTypeString::ColumnType*>( | 690 | 1.41k | block.get_by_position(arguments[0]).column.get()); | 691 | | | 692 | 1.41k | auto to_type = block.get_by_position(result).type; | 693 | 1.41k | auto nested_to_type = remove_nullable(to_type); | 694 | 1.41k | auto serde = nested_to_type->get_serde(); | 695 | | | 696 | | if constexpr (Mode == CastModeType::NonStrictMode) { | 697 | | auto nullable_col_to = create_empty_nullable_column(nested_to_type); | 698 | | // may write nulls to nullable_col_to | 699 | | RETURN_IF_ERROR(serde->from_string_batch(*col_from, *nullable_col_to, {})); | 700 | | block.get_by_position(result).column = std::move(nullable_col_to); | 701 | 1.41k | } else if constexpr (Mode == CastModeType::StrictMode) { | 702 | 1.41k | MutableColumnPtr column_to = nested_to_type->create_column(); | 703 | | // WON'T write nulls to the result column, just raise errors. null_map is only used to skip invalid rows | 704 | 1.41k | RETURN_IF_ERROR( | 705 | 1.41k | serde->from_string_strict_mode_batch(*col_from, *column_to, {}, null_map)); | 706 | 1.26k | block.get_by_position(result).column = std::move(column_to); | 707 | | } else { | 708 | | return Status::InternalError("Unsupported cast mode"); | 709 | | } | 710 | | | 711 | 0 | return Status::OK(); | 712 | 1.41k | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeStringENS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 688 | 1.41k | const NullMap::value_type* null_map = nullptr) const override { | 689 | 1.41k | const auto* col_from = assert_cast<const DataTypeString::ColumnType*>( | 690 | 1.41k | block.get_by_position(arguments[0]).column.get()); | 691 | | | 692 | 1.41k | auto to_type = block.get_by_position(result).type; | 693 | 1.41k | auto nested_to_type = remove_nullable(to_type); | 694 | 1.41k | auto serde = nested_to_type->get_serde(); | 695 | | | 696 | 1.41k | if constexpr (Mode == CastModeType::NonStrictMode) { | 697 | 1.41k | auto nullable_col_to = create_empty_nullable_column(nested_to_type); | 698 | | // may write nulls to nullable_col_to | 699 | 1.41k | RETURN_IF_ERROR(serde->from_string_batch(*col_from, *nullable_col_to, {})); | 700 | 1.41k | block.get_by_position(result).column = std::move(nullable_col_to); | 701 | | } else if constexpr (Mode == CastModeType::StrictMode) { | 702 | | MutableColumnPtr column_to = nested_to_type->create_column(); | 703 | | // WON'T write nulls to the result column, just raise errors. null_map is only used to skip invalid rows | 704 | | RETURN_IF_ERROR( | 705 | | serde->from_string_strict_mode_batch(*col_from, *column_to, {}, null_map)); | 706 | | block.get_by_position(result).column = std::move(column_to); | 707 | | } else { | 708 | | return Status::InternalError("Unsupported cast mode"); | 709 | | } | 710 | | | 711 | 0 | return Status::OK(); | 712 | 1.41k | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeStringENS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 688 | 1.41k | const NullMap::value_type* null_map = nullptr) const override { | 689 | 1.41k | const auto* col_from = assert_cast<const DataTypeString::ColumnType*>( | 690 | 1.41k | block.get_by_position(arguments[0]).column.get()); | 691 | | | 692 | 1.41k | auto to_type = block.get_by_position(result).type; | 693 | 1.41k | auto nested_to_type = remove_nullable(to_type); | 694 | 1.41k | auto serde = nested_to_type->get_serde(); | 695 | | | 696 | | if constexpr (Mode == CastModeType::NonStrictMode) { | 697 | | auto nullable_col_to = create_empty_nullable_column(nested_to_type); | 698 | | // may write nulls to nullable_col_to | 699 | | RETURN_IF_ERROR(serde->from_string_batch(*col_from, *nullable_col_to, {})); | 700 | | block.get_by_position(result).column = std::move(nullable_col_to); | 701 | 1.41k | } else if constexpr (Mode == CastModeType::StrictMode) { | 702 | 1.41k | MutableColumnPtr column_to = nested_to_type->create_column(); | 703 | | // WON'T write nulls to the result column, just raise errors. null_map is only used to skip invalid rows | 704 | 1.41k | RETURN_IF_ERROR( | 705 | 1.41k | serde->from_string_strict_mode_batch(*col_from, *column_to, {}, null_map)); | 706 | 1.26k | block.get_by_position(result).column = std::move(column_to); | 707 | | } else { | 708 | | return Status::InternalError("Unsupported cast mode"); | 709 | | } | 710 | | | 711 | 0 | return Status::OK(); | 712 | 1.41k | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeStringENS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 688 | 1.42k | const NullMap::value_type* null_map = nullptr) const override { | 689 | 1.42k | const auto* col_from = assert_cast<const DataTypeString::ColumnType*>( | 690 | 1.42k | block.get_by_position(arguments[0]).column.get()); | 691 | | | 692 | 1.42k | auto to_type = block.get_by_position(result).type; | 693 | 1.42k | auto nested_to_type = remove_nullable(to_type); | 694 | 1.42k | auto serde = nested_to_type->get_serde(); | 695 | | | 696 | 1.42k | if constexpr (Mode == CastModeType::NonStrictMode) { | 697 | 1.42k | auto nullable_col_to = create_empty_nullable_column(nested_to_type); | 698 | | // may write nulls to nullable_col_to | 699 | 1.42k | RETURN_IF_ERROR(serde->from_string_batch(*col_from, *nullable_col_to, {})); | 700 | 1.42k | block.get_by_position(result).column = std::move(nullable_col_to); | 701 | | } else if constexpr (Mode == CastModeType::StrictMode) { | 702 | | MutableColumnPtr column_to = nested_to_type->create_column(); | 703 | | // WON'T write nulls to the result column, just raise errors. null_map is only used to skip invalid rows | 704 | | RETURN_IF_ERROR( | 705 | | serde->from_string_strict_mode_batch(*col_from, *column_to, {}, null_map)); | 706 | | block.get_by_position(result).column = std::move(column_to); | 707 | | } else { | 708 | | return Status::InternalError("Unsupported cast mode"); | 709 | | } | 710 | | | 711 | 0 | return Status::OK(); | 712 | 1.42k | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeStringENS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 688 | 1.39k | const NullMap::value_type* null_map = nullptr) const override { | 689 | 1.39k | const auto* col_from = assert_cast<const DataTypeString::ColumnType*>( | 690 | 1.39k | block.get_by_position(arguments[0]).column.get()); | 691 | | | 692 | 1.39k | auto to_type = block.get_by_position(result).type; | 693 | 1.39k | auto nested_to_type = remove_nullable(to_type); | 694 | 1.39k | auto serde = nested_to_type->get_serde(); | 695 | | | 696 | | if constexpr (Mode == CastModeType::NonStrictMode) { | 697 | | auto nullable_col_to = create_empty_nullable_column(nested_to_type); | 698 | | // may write nulls to nullable_col_to | 699 | | RETURN_IF_ERROR(serde->from_string_batch(*col_from, *nullable_col_to, {})); | 700 | | block.get_by_position(result).column = std::move(nullable_col_to); | 701 | 1.39k | } else if constexpr (Mode == CastModeType::StrictMode) { | 702 | 1.39k | MutableColumnPtr column_to = nested_to_type->create_column(); | 703 | | // WON'T write nulls to the result column, just raise errors. null_map is only used to skip invalid rows | 704 | 1.39k | RETURN_IF_ERROR( | 705 | 1.39k | serde->from_string_strict_mode_batch(*col_from, *column_to, {}, null_map)); | 706 | 1.26k | block.get_by_position(result).column = std::move(column_to); | 707 | | } else { | 708 | | return Status::InternalError("Unsupported cast mode"); | 709 | | } | 710 | | | 711 | 0 | return Status::OK(); | 712 | 1.39k | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeStringENS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 688 | 1.39k | const NullMap::value_type* null_map = nullptr) const override { | 689 | 1.39k | const auto* col_from = assert_cast<const DataTypeString::ColumnType*>( | 690 | 1.39k | block.get_by_position(arguments[0]).column.get()); | 691 | | | 692 | 1.39k | auto to_type = block.get_by_position(result).type; | 693 | 1.39k | auto nested_to_type = remove_nullable(to_type); | 694 | 1.39k | auto serde = nested_to_type->get_serde(); | 695 | | | 696 | 1.39k | if constexpr (Mode == CastModeType::NonStrictMode) { | 697 | 1.39k | auto nullable_col_to = create_empty_nullable_column(nested_to_type); | 698 | | // may write nulls to nullable_col_to | 699 | 1.39k | RETURN_IF_ERROR(serde->from_string_batch(*col_from, *nullable_col_to, {})); | 700 | 1.39k | block.get_by_position(result).column = std::move(nullable_col_to); | 701 | | } else if constexpr (Mode == CastModeType::StrictMode) { | 702 | | MutableColumnPtr column_to = nested_to_type->create_column(); | 703 | | // WON'T write nulls to the result column, just raise errors. null_map is only used to skip invalid rows | 704 | | RETURN_IF_ERROR( | 705 | | serde->from_string_strict_mode_batch(*col_from, *column_to, {}, null_map)); | 706 | | block.get_by_position(result).column = std::move(column_to); | 707 | | } else { | 708 | | return Status::InternalError("Unsupported cast mode"); | 709 | | } | 710 | | | 711 | 0 | return Status::OK(); | 712 | 1.39k | } |
|
713 | | }; |
714 | | |
715 | | // cast bool and int to decimal. when may overflow, result column is nullable. |
716 | | template <CastModeType CastMode, typename FromDataType, typename ToDataType> |
717 | | requires(IsDataTypeDecimal<ToDataType> && |
718 | | (IsDataTypeInt<FromDataType> || IsDataTypeBool<FromDataType>)) |
719 | | class CastToImpl<CastMode, FromDataType, ToDataType> : public CastToBase { |
720 | | public: |
721 | | Status execute_impl(FunctionContext* context, Block& block, const ColumnNumbers& arguments, |
722 | | uint32_t result, size_t input_rows_count, |
723 | 1.56k | const NullMap::value_type* null_map = nullptr) const override { |
724 | 1.56k | using FromFieldType = typename FromDataType::FieldType; |
725 | 1.56k | using ToFieldType = typename ToDataType::FieldType; |
726 | 1.56k | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); |
727 | 1.56k | const auto* col_from = |
728 | 1.56k | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); |
729 | 1.56k | if (!col_from) { |
730 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", |
731 | 0 | named_from.column->get_name()); |
732 | 0 | } |
733 | | |
734 | 1.56k | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); |
735 | 1.56k | constexpr UInt32 from_scale = 0; |
736 | | |
737 | 1.56k | const ColumnWithTypeAndName& named_to = block.get_by_position(result); |
738 | 1.56k | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); |
739 | 1.56k | UInt32 to_precision = to_decimal_type.get_precision(); |
740 | 1.56k | ToDataType::check_type_precision(to_precision); |
741 | 1.56k | UInt32 to_scale = to_decimal_type.get_scale(); |
742 | 1.56k | ToDataType::check_type_scale(to_scale); |
743 | | |
744 | 1.56k | auto from_max_int_digit_count = from_precision - from_scale; |
745 | 1.56k | auto to_max_int_digit_count = to_precision - to_scale; |
746 | | // may overflow. nullable result column. |
747 | 1.56k | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); |
748 | | // only in non-strict mode and may overflow, we set nullable |
749 | 1.56k | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; |
750 | | |
751 | 1.56k | constexpr UInt32 to_max_digits = |
752 | 1.56k | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); |
753 | 1.56k | bool multiply_may_overflow = false; |
754 | 1.56k | if (to_scale > from_scale) { |
755 | 966 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; |
756 | 966 | } |
757 | 1.56k | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > |
758 | 1.56k | sizeof(typename ToFieldType::NativeType)), |
759 | 1.56k | FromFieldType, typename ToFieldType::NativeType>; |
760 | 1.56k | MaxNativeType scale_multiplier = |
761 | 1.56k | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); |
762 | 1.56k | typename ToFieldType::NativeType max_result = |
763 | 1.56k | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); |
764 | 1.56k | typename ToFieldType::NativeType min_result = -max_result; |
765 | | |
766 | 1.56k | ColumnUInt8::MutablePtr col_null_map_to; |
767 | 1.56k | NullMap::value_type* null_map_data = nullptr; |
768 | 1.56k | if (narrow_integral) { |
769 | 1.34k | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); |
770 | 1.34k | null_map_data = col_null_map_to->get_data().data(); |
771 | 1.34k | } |
772 | | |
773 | 1.56k | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); |
774 | 1.56k | const auto& vec_from = col_from->get_data(); |
775 | 1.56k | const auto* vec_from_data = vec_from.data(); |
776 | 1.56k | auto& vec_to = col_to->get_data(); |
777 | 1.56k | auto* vec_to_data = vec_to.data(); |
778 | | |
779 | 1.56k | CastParameters params; |
780 | 1.56k | params.is_strict = (CastMode == CastModeType::StrictMode); |
781 | 1.56k | size_t size = vec_from.size(); |
782 | | |
783 | 1.56k | RETURN_IF_ERROR(std::visit( |
784 | 1.56k | [&](auto multiply_may_overflow, auto narrow_integral) { |
785 | 1.56k | for (size_t i = 0; i < size; i++) { |
786 | 1.56k | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, |
787 | 1.56k | typename ToDataType::FieldType, |
788 | 1.56k | multiply_may_overflow, narrow_integral>( |
789 | 1.56k | vec_from_data[i], vec_to_data[i], to_precision, to_scale, |
790 | 1.56k | scale_multiplier, min_result, max_result, params)) { |
791 | 1.56k | if (set_nullable) { |
792 | 1.56k | null_map_data[i] = 1; |
793 | 1.56k | } else { |
794 | 1.56k | return params.status; |
795 | 1.56k | } |
796 | 1.56k | } |
797 | 1.56k | } |
798 | 1.56k | return Status::OK(); |
799 | 1.56k | }, |
800 | 1.56k | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); |
801 | | |
802 | 802 | if (narrow_integral) { |
803 | 584 | block.get_by_position(result).column = |
804 | 584 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); |
805 | 584 | } else { |
806 | 218 | block.get_by_position(result).column = std::move(col_to); |
807 | 218 | } |
808 | 802 | return Status::OK(); |
809 | 1.56k | } _ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE2EEENS_15DataTypeDecimalILS3_20EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 723 | 4 | const NullMap::value_type* null_map = nullptr) const override { | 724 | 4 | using FromFieldType = typename FromDataType::FieldType; | 725 | 4 | using ToFieldType = typename ToDataType::FieldType; | 726 | 4 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 727 | 4 | const auto* col_from = | 728 | 4 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 729 | 4 | if (!col_from) { | 730 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 731 | 0 | named_from.column->get_name()); | 732 | 0 | } | 733 | | | 734 | 4 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 735 | 4 | constexpr UInt32 from_scale = 0; | 736 | | | 737 | 4 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 738 | 4 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 739 | 4 | UInt32 to_precision = to_decimal_type.get_precision(); | 740 | 4 | ToDataType::check_type_precision(to_precision); | 741 | 4 | UInt32 to_scale = to_decimal_type.get_scale(); | 742 | 4 | ToDataType::check_type_scale(to_scale); | 743 | | | 744 | 4 | auto from_max_int_digit_count = from_precision - from_scale; | 745 | 4 | auto to_max_int_digit_count = to_precision - to_scale; | 746 | | // may overflow. nullable result column. | 747 | 4 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 748 | | // only in non-strict mode and may overflow, we set nullable | 749 | 4 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 750 | | | 751 | 4 | constexpr UInt32 to_max_digits = | 752 | 4 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 753 | 4 | bool multiply_may_overflow = false; | 754 | 4 | if (to_scale > from_scale) { | 755 | 4 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 756 | 4 | } | 757 | 4 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 758 | 4 | sizeof(typename ToFieldType::NativeType)), | 759 | 4 | FromFieldType, typename ToFieldType::NativeType>; | 760 | 4 | MaxNativeType scale_multiplier = | 761 | 4 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 762 | 4 | typename ToFieldType::NativeType max_result = | 763 | 4 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 764 | 4 | typename ToFieldType::NativeType min_result = -max_result; | 765 | | | 766 | 4 | ColumnUInt8::MutablePtr col_null_map_to; | 767 | 4 | NullMap::value_type* null_map_data = nullptr; | 768 | 4 | if (narrow_integral) { | 769 | 4 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 770 | 4 | null_map_data = col_null_map_to->get_data().data(); | 771 | 4 | } | 772 | | | 773 | 4 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 774 | 4 | const auto& vec_from = col_from->get_data(); | 775 | 4 | const auto* vec_from_data = vec_from.data(); | 776 | 4 | auto& vec_to = col_to->get_data(); | 777 | 4 | auto* vec_to_data = vec_to.data(); | 778 | | | 779 | 4 | CastParameters params; | 780 | 4 | params.is_strict = (CastMode == CastModeType::StrictMode); | 781 | 4 | size_t size = vec_from.size(); | 782 | | | 783 | 4 | RETURN_IF_ERROR(std::visit( | 784 | 4 | [&](auto multiply_may_overflow, auto narrow_integral) { | 785 | 4 | for (size_t i = 0; i < size; i++) { | 786 | 4 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 787 | 4 | typename ToDataType::FieldType, | 788 | 4 | multiply_may_overflow, narrow_integral>( | 789 | 4 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 790 | 4 | scale_multiplier, min_result, max_result, params)) { | 791 | 4 | if (set_nullable) { | 792 | 4 | null_map_data[i] = 1; | 793 | 4 | } else { | 794 | 4 | return params.status; | 795 | 4 | } | 796 | 4 | } | 797 | 4 | } | 798 | 4 | return Status::OK(); | 799 | 4 | }, | 800 | 4 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 801 | | | 802 | 2 | if (narrow_integral) { | 803 | 2 | block.get_by_position(result).column = | 804 | 2 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 805 | 2 | } else { | 806 | 0 | block.get_by_position(result).column = std::move(col_to); | 807 | 0 | } | 808 | 2 | return Status::OK(); | 809 | 4 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE2EEENS_15DataTypeDecimalILS3_20EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 723 | 4 | const NullMap::value_type* null_map = nullptr) const override { | 724 | 4 | using FromFieldType = typename FromDataType::FieldType; | 725 | 4 | using ToFieldType = typename ToDataType::FieldType; | 726 | 4 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 727 | 4 | const auto* col_from = | 728 | 4 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 729 | 4 | if (!col_from) { | 730 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 731 | 0 | named_from.column->get_name()); | 732 | 0 | } | 733 | | | 734 | 4 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 735 | 4 | constexpr UInt32 from_scale = 0; | 736 | | | 737 | 4 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 738 | 4 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 739 | 4 | UInt32 to_precision = to_decimal_type.get_precision(); | 740 | 4 | ToDataType::check_type_precision(to_precision); | 741 | 4 | UInt32 to_scale = to_decimal_type.get_scale(); | 742 | 4 | ToDataType::check_type_scale(to_scale); | 743 | | | 744 | 4 | auto from_max_int_digit_count = from_precision - from_scale; | 745 | 4 | auto to_max_int_digit_count = to_precision - to_scale; | 746 | | // may overflow. nullable result column. | 747 | 4 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 748 | | // only in non-strict mode and may overflow, we set nullable | 749 | 4 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 750 | | | 751 | 4 | constexpr UInt32 to_max_digits = | 752 | 4 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 753 | 4 | bool multiply_may_overflow = false; | 754 | 4 | if (to_scale > from_scale) { | 755 | 4 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 756 | 4 | } | 757 | 4 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 758 | 4 | sizeof(typename ToFieldType::NativeType)), | 759 | 4 | FromFieldType, typename ToFieldType::NativeType>; | 760 | 4 | MaxNativeType scale_multiplier = | 761 | 4 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 762 | 4 | typename ToFieldType::NativeType max_result = | 763 | 4 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 764 | 4 | typename ToFieldType::NativeType min_result = -max_result; | 765 | | | 766 | 4 | ColumnUInt8::MutablePtr col_null_map_to; | 767 | 4 | NullMap::value_type* null_map_data = nullptr; | 768 | 4 | if (narrow_integral) { | 769 | 2 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 770 | 2 | null_map_data = col_null_map_to->get_data().data(); | 771 | 2 | } | 772 | | | 773 | 4 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 774 | 4 | const auto& vec_from = col_from->get_data(); | 775 | 4 | const auto* vec_from_data = vec_from.data(); | 776 | 4 | auto& vec_to = col_to->get_data(); | 777 | 4 | auto* vec_to_data = vec_to.data(); | 778 | | | 779 | 4 | CastParameters params; | 780 | 4 | params.is_strict = (CastMode == CastModeType::StrictMode); | 781 | 4 | size_t size = vec_from.size(); | 782 | | | 783 | 4 | RETURN_IF_ERROR(std::visit( | 784 | 4 | [&](auto multiply_may_overflow, auto narrow_integral) { | 785 | 4 | for (size_t i = 0; i < size; i++) { | 786 | 4 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 787 | 4 | typename ToDataType::FieldType, | 788 | 4 | multiply_may_overflow, narrow_integral>( | 789 | 4 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 790 | 4 | scale_multiplier, min_result, max_result, params)) { | 791 | 4 | if (set_nullable) { | 792 | 4 | null_map_data[i] = 1; | 793 | 4 | } else { | 794 | 4 | return params.status; | 795 | 4 | } | 796 | 4 | } | 797 | 4 | } | 798 | 4 | return Status::OK(); | 799 | 4 | }, | 800 | 4 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 801 | | | 802 | 4 | if (narrow_integral) { | 803 | 2 | block.get_by_position(result).column = | 804 | 2 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 805 | 2 | } else { | 806 | 2 | block.get_by_position(result).column = std::move(col_to); | 807 | 2 | } | 808 | 4 | return Status::OK(); | 809 | 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 | 723 | 4 | const NullMap::value_type* null_map = nullptr) const override { | 724 | 4 | using FromFieldType = typename FromDataType::FieldType; | 725 | 4 | using ToFieldType = typename ToDataType::FieldType; | 726 | 4 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 727 | 4 | const auto* col_from = | 728 | 4 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 729 | 4 | if (!col_from) { | 730 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 731 | 0 | named_from.column->get_name()); | 732 | 0 | } | 733 | | | 734 | 4 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 735 | 4 | constexpr UInt32 from_scale = 0; | 736 | | | 737 | 4 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 738 | 4 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 739 | 4 | UInt32 to_precision = to_decimal_type.get_precision(); | 740 | 4 | ToDataType::check_type_precision(to_precision); | 741 | 4 | UInt32 to_scale = to_decimal_type.get_scale(); | 742 | 4 | ToDataType::check_type_scale(to_scale); | 743 | | | 744 | 4 | auto from_max_int_digit_count = from_precision - from_scale; | 745 | 4 | auto to_max_int_digit_count = to_precision - to_scale; | 746 | | // may overflow. nullable result column. | 747 | 4 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 748 | | // only in non-strict mode and may overflow, we set nullable | 749 | 4 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 750 | | | 751 | 4 | constexpr UInt32 to_max_digits = | 752 | 4 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 753 | 4 | bool multiply_may_overflow = false; | 754 | 4 | if (to_scale > from_scale) { | 755 | 4 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 756 | 4 | } | 757 | 4 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 758 | 4 | sizeof(typename ToFieldType::NativeType)), | 759 | 4 | FromFieldType, typename ToFieldType::NativeType>; | 760 | 4 | MaxNativeType scale_multiplier = | 761 | 4 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 762 | 4 | typename ToFieldType::NativeType max_result = | 763 | 4 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 764 | 4 | typename ToFieldType::NativeType min_result = -max_result; | 765 | | | 766 | 4 | ColumnUInt8::MutablePtr col_null_map_to; | 767 | 4 | NullMap::value_type* null_map_data = nullptr; | 768 | 4 | if (narrow_integral) { | 769 | 4 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 770 | 4 | null_map_data = col_null_map_to->get_data().data(); | 771 | 4 | } | 772 | | | 773 | 4 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 774 | 4 | const auto& vec_from = col_from->get_data(); | 775 | 4 | const auto* vec_from_data = vec_from.data(); | 776 | 4 | auto& vec_to = col_to->get_data(); | 777 | 4 | auto* vec_to_data = vec_to.data(); | 778 | | | 779 | 4 | CastParameters params; | 780 | 4 | params.is_strict = (CastMode == CastModeType::StrictMode); | 781 | 4 | size_t size = vec_from.size(); | 782 | | | 783 | 4 | RETURN_IF_ERROR(std::visit( | 784 | 4 | [&](auto multiply_may_overflow, auto narrow_integral) { | 785 | 4 | for (size_t i = 0; i < size; i++) { | 786 | 4 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 787 | 4 | typename ToDataType::FieldType, | 788 | 4 | multiply_may_overflow, narrow_integral>( | 789 | 4 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 790 | 4 | scale_multiplier, min_result, max_result, params)) { | 791 | 4 | if (set_nullable) { | 792 | 4 | null_map_data[i] = 1; | 793 | 4 | } else { | 794 | 4 | return params.status; | 795 | 4 | } | 796 | 4 | } | 797 | 4 | } | 798 | 4 | return Status::OK(); | 799 | 4 | }, | 800 | 4 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 801 | | | 802 | 2 | if (narrow_integral) { | 803 | 2 | block.get_by_position(result).column = | 804 | 2 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 805 | 2 | } else { | 806 | 0 | block.get_by_position(result).column = std::move(col_to); | 807 | 0 | } | 808 | 2 | return Status::OK(); | 809 | 4 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE2EEENS_15DataTypeDecimalILS3_28EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 723 | 10 | const NullMap::value_type* null_map = nullptr) const override { | 724 | 10 | using FromFieldType = typename FromDataType::FieldType; | 725 | 10 | using ToFieldType = typename ToDataType::FieldType; | 726 | 10 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 727 | 10 | const auto* col_from = | 728 | 10 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 729 | 10 | if (!col_from) { | 730 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 731 | 0 | named_from.column->get_name()); | 732 | 0 | } | 733 | | | 734 | 10 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 735 | 10 | constexpr UInt32 from_scale = 0; | 736 | | | 737 | 10 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 738 | 10 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 739 | 10 | UInt32 to_precision = to_decimal_type.get_precision(); | 740 | 10 | ToDataType::check_type_precision(to_precision); | 741 | 10 | UInt32 to_scale = to_decimal_type.get_scale(); | 742 | 10 | ToDataType::check_type_scale(to_scale); | 743 | | | 744 | 10 | auto from_max_int_digit_count = from_precision - from_scale; | 745 | 10 | auto to_max_int_digit_count = to_precision - to_scale; | 746 | | // may overflow. nullable result column. | 747 | 10 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 748 | | // only in non-strict mode and may overflow, we set nullable | 749 | 10 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 750 | | | 751 | 10 | constexpr UInt32 to_max_digits = | 752 | 10 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 753 | 10 | bool multiply_may_overflow = false; | 754 | 10 | if (to_scale > from_scale) { | 755 | 8 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 756 | 8 | } | 757 | 10 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 758 | 10 | sizeof(typename ToFieldType::NativeType)), | 759 | 10 | FromFieldType, typename ToFieldType::NativeType>; | 760 | 10 | MaxNativeType scale_multiplier = | 761 | 10 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 762 | 10 | typename ToFieldType::NativeType max_result = | 763 | 10 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 764 | 10 | typename ToFieldType::NativeType min_result = -max_result; | 765 | | | 766 | 10 | ColumnUInt8::MutablePtr col_null_map_to; | 767 | 10 | NullMap::value_type* null_map_data = nullptr; | 768 | 10 | if (narrow_integral) { | 769 | 2 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 770 | 2 | null_map_data = col_null_map_to->get_data().data(); | 771 | 2 | } | 772 | | | 773 | 10 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 774 | 10 | const auto& vec_from = col_from->get_data(); | 775 | 10 | const auto* vec_from_data = vec_from.data(); | 776 | 10 | auto& vec_to = col_to->get_data(); | 777 | 10 | auto* vec_to_data = vec_to.data(); | 778 | | | 779 | 10 | CastParameters params; | 780 | 10 | params.is_strict = (CastMode == CastModeType::StrictMode); | 781 | 10 | size_t size = vec_from.size(); | 782 | | | 783 | 10 | RETURN_IF_ERROR(std::visit( | 784 | 10 | [&](auto multiply_may_overflow, auto narrow_integral) { | 785 | 10 | for (size_t i = 0; i < size; i++) { | 786 | 10 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 787 | 10 | typename ToDataType::FieldType, | 788 | 10 | multiply_may_overflow, narrow_integral>( | 789 | 10 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 790 | 10 | scale_multiplier, min_result, max_result, params)) { | 791 | 10 | if (set_nullable) { | 792 | 10 | null_map_data[i] = 1; | 793 | 10 | } else { | 794 | 10 | return params.status; | 795 | 10 | } | 796 | 10 | } | 797 | 10 | } | 798 | 10 | return Status::OK(); | 799 | 10 | }, | 800 | 10 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 801 | | | 802 | 10 | if (narrow_integral) { | 803 | 2 | block.get_by_position(result).column = | 804 | 2 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 805 | 8 | } else { | 806 | 8 | block.get_by_position(result).column = std::move(col_to); | 807 | 8 | } | 808 | 10 | return Status::OK(); | 809 | 10 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE3EEENS_15DataTypeDecimalILS3_28EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 723 | 46 | const NullMap::value_type* null_map = nullptr) const override { | 724 | 46 | using FromFieldType = typename FromDataType::FieldType; | 725 | 46 | using ToFieldType = typename ToDataType::FieldType; | 726 | 46 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 727 | 46 | const auto* col_from = | 728 | 46 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 729 | 46 | if (!col_from) { | 730 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 731 | 0 | named_from.column->get_name()); | 732 | 0 | } | 733 | | | 734 | 46 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 735 | 46 | constexpr UInt32 from_scale = 0; | 736 | | | 737 | 46 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 738 | 46 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 739 | 46 | UInt32 to_precision = to_decimal_type.get_precision(); | 740 | 46 | ToDataType::check_type_precision(to_precision); | 741 | 46 | UInt32 to_scale = to_decimal_type.get_scale(); | 742 | 46 | ToDataType::check_type_scale(to_scale); | 743 | | | 744 | 46 | auto from_max_int_digit_count = from_precision - from_scale; | 745 | 46 | auto to_max_int_digit_count = to_precision - to_scale; | 746 | | // may overflow. nullable result column. | 747 | 46 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 748 | | // only in non-strict mode and may overflow, we set nullable | 749 | 46 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 750 | | | 751 | 46 | constexpr UInt32 to_max_digits = | 752 | 46 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 753 | 46 | bool multiply_may_overflow = false; | 754 | 46 | if (to_scale > from_scale) { | 755 | 32 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 756 | 32 | } | 757 | 46 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 758 | 46 | sizeof(typename ToFieldType::NativeType)), | 759 | 46 | FromFieldType, typename ToFieldType::NativeType>; | 760 | 46 | MaxNativeType scale_multiplier = | 761 | 46 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 762 | 46 | typename ToFieldType::NativeType max_result = | 763 | 46 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 764 | 46 | typename ToFieldType::NativeType min_result = -max_result; | 765 | | | 766 | 46 | ColumnUInt8::MutablePtr col_null_map_to; | 767 | 46 | NullMap::value_type* null_map_data = nullptr; | 768 | 46 | if (narrow_integral) { | 769 | 40 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 770 | 40 | null_map_data = col_null_map_to->get_data().data(); | 771 | 40 | } | 772 | | | 773 | 46 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 774 | 46 | const auto& vec_from = col_from->get_data(); | 775 | 46 | const auto* vec_from_data = vec_from.data(); | 776 | 46 | auto& vec_to = col_to->get_data(); | 777 | 46 | auto* vec_to_data = vec_to.data(); | 778 | | | 779 | 46 | CastParameters params; | 780 | 46 | params.is_strict = (CastMode == CastModeType::StrictMode); | 781 | 46 | size_t size = vec_from.size(); | 782 | | | 783 | 46 | RETURN_IF_ERROR(std::visit( | 784 | 46 | [&](auto multiply_may_overflow, auto narrow_integral) { | 785 | 46 | for (size_t i = 0; i < size; i++) { | 786 | 46 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 787 | 46 | typename ToDataType::FieldType, | 788 | 46 | multiply_may_overflow, narrow_integral>( | 789 | 46 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 790 | 46 | scale_multiplier, min_result, max_result, params)) { | 791 | 46 | if (set_nullable) { | 792 | 46 | null_map_data[i] = 1; | 793 | 46 | } else { | 794 | 46 | return params.status; | 795 | 46 | } | 796 | 46 | } | 797 | 46 | } | 798 | 46 | return Status::OK(); | 799 | 46 | }, | 800 | 46 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 801 | | | 802 | 14 | if (narrow_integral) { | 803 | 8 | block.get_by_position(result).column = | 804 | 8 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 805 | 8 | } else { | 806 | 6 | block.get_by_position(result).column = std::move(col_to); | 807 | 6 | } | 808 | 14 | return Status::OK(); | 809 | 46 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE3EEENS_15DataTypeDecimalILS3_28EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 723 | 22 | const NullMap::value_type* null_map = nullptr) const override { | 724 | 22 | using FromFieldType = typename FromDataType::FieldType; | 725 | 22 | using ToFieldType = typename ToDataType::FieldType; | 726 | 22 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 727 | 22 | const auto* col_from = | 728 | 22 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 729 | 22 | if (!col_from) { | 730 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 731 | 0 | named_from.column->get_name()); | 732 | 0 | } | 733 | | | 734 | 22 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 735 | 22 | constexpr UInt32 from_scale = 0; | 736 | | | 737 | 22 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 738 | 22 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 739 | 22 | UInt32 to_precision = to_decimal_type.get_precision(); | 740 | 22 | ToDataType::check_type_precision(to_precision); | 741 | 22 | UInt32 to_scale = to_decimal_type.get_scale(); | 742 | 22 | ToDataType::check_type_scale(to_scale); | 743 | | | 744 | 22 | auto from_max_int_digit_count = from_precision - from_scale; | 745 | 22 | auto to_max_int_digit_count = to_precision - to_scale; | 746 | | // may overflow. nullable result column. | 747 | 22 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 748 | | // only in non-strict mode and may overflow, we set nullable | 749 | 22 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 750 | | | 751 | 22 | constexpr UInt32 to_max_digits = | 752 | 22 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 753 | 22 | bool multiply_may_overflow = false; | 754 | 22 | if (to_scale > from_scale) { | 755 | 14 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 756 | 14 | } | 757 | 22 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 758 | 22 | sizeof(typename ToFieldType::NativeType)), | 759 | 22 | FromFieldType, typename ToFieldType::NativeType>; | 760 | 22 | MaxNativeType scale_multiplier = | 761 | 22 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 762 | 22 | typename ToFieldType::NativeType max_result = | 763 | 22 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 764 | 22 | typename ToFieldType::NativeType min_result = -max_result; | 765 | | | 766 | 22 | ColumnUInt8::MutablePtr col_null_map_to; | 767 | 22 | NullMap::value_type* null_map_data = nullptr; | 768 | 22 | if (narrow_integral) { | 769 | 16 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 770 | 16 | null_map_data = col_null_map_to->get_data().data(); | 771 | 16 | } | 772 | | | 773 | 22 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 774 | 22 | const auto& vec_from = col_from->get_data(); | 775 | 22 | const auto* vec_from_data = vec_from.data(); | 776 | 22 | auto& vec_to = col_to->get_data(); | 777 | 22 | auto* vec_to_data = vec_to.data(); | 778 | | | 779 | 22 | CastParameters params; | 780 | 22 | params.is_strict = (CastMode == CastModeType::StrictMode); | 781 | 22 | size_t size = vec_from.size(); | 782 | | | 783 | 22 | RETURN_IF_ERROR(std::visit( | 784 | 22 | [&](auto multiply_may_overflow, auto narrow_integral) { | 785 | 22 | for (size_t i = 0; i < size; i++) { | 786 | 22 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 787 | 22 | typename ToDataType::FieldType, | 788 | 22 | multiply_may_overflow, narrow_integral>( | 789 | 22 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 790 | 22 | scale_multiplier, min_result, max_result, params)) { | 791 | 22 | if (set_nullable) { | 792 | 22 | null_map_data[i] = 1; | 793 | 22 | } else { | 794 | 22 | return params.status; | 795 | 22 | } | 796 | 22 | } | 797 | 22 | } | 798 | 22 | return Status::OK(); | 799 | 22 | }, | 800 | 22 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 801 | | | 802 | 22 | if (narrow_integral) { | 803 | 16 | block.get_by_position(result).column = | 804 | 16 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 805 | 16 | } else { | 806 | 6 | block.get_by_position(result).column = std::move(col_to); | 807 | 6 | } | 808 | 22 | return Status::OK(); | 809 | 22 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE4EEENS_15DataTypeDecimalILS3_28EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 723 | 54 | const NullMap::value_type* null_map = nullptr) const override { | 724 | 54 | using FromFieldType = typename FromDataType::FieldType; | 725 | 54 | using ToFieldType = typename ToDataType::FieldType; | 726 | 54 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 727 | 54 | const auto* col_from = | 728 | 54 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 729 | 54 | if (!col_from) { | 730 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 731 | 0 | named_from.column->get_name()); | 732 | 0 | } | 733 | | | 734 | 54 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 735 | 54 | constexpr UInt32 from_scale = 0; | 736 | | | 737 | 54 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 738 | 54 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 739 | 54 | UInt32 to_precision = to_decimal_type.get_precision(); | 740 | 54 | ToDataType::check_type_precision(to_precision); | 741 | 54 | UInt32 to_scale = to_decimal_type.get_scale(); | 742 | 54 | ToDataType::check_type_scale(to_scale); | 743 | | | 744 | 54 | auto from_max_int_digit_count = from_precision - from_scale; | 745 | 54 | auto to_max_int_digit_count = to_precision - to_scale; | 746 | | // may overflow. nullable result column. | 747 | 54 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 748 | | // only in non-strict mode and may overflow, we set nullable | 749 | 54 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 750 | | | 751 | 54 | constexpr UInt32 to_max_digits = | 752 | 54 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 753 | 54 | bool multiply_may_overflow = false; | 754 | 54 | if (to_scale > from_scale) { | 755 | 32 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 756 | 32 | } | 757 | 54 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 758 | 54 | sizeof(typename ToFieldType::NativeType)), | 759 | 54 | FromFieldType, typename ToFieldType::NativeType>; | 760 | 54 | MaxNativeType scale_multiplier = | 761 | 54 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 762 | 54 | typename ToFieldType::NativeType max_result = | 763 | 54 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 764 | 54 | typename ToFieldType::NativeType min_result = -max_result; | 765 | | | 766 | 54 | ColumnUInt8::MutablePtr col_null_map_to; | 767 | 54 | NullMap::value_type* null_map_data = nullptr; | 768 | 54 | if (narrow_integral) { | 769 | 50 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 770 | 50 | null_map_data = col_null_map_to->get_data().data(); | 771 | 50 | } | 772 | | | 773 | 54 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 774 | 54 | const auto& vec_from = col_from->get_data(); | 775 | 54 | const auto* vec_from_data = vec_from.data(); | 776 | 54 | auto& vec_to = col_to->get_data(); | 777 | 54 | auto* vec_to_data = vec_to.data(); | 778 | | | 779 | 54 | CastParameters params; | 780 | 54 | params.is_strict = (CastMode == CastModeType::StrictMode); | 781 | 54 | size_t size = vec_from.size(); | 782 | | | 783 | 54 | RETURN_IF_ERROR(std::visit( | 784 | 54 | [&](auto multiply_may_overflow, auto narrow_integral) { | 785 | 54 | for (size_t i = 0; i < size; i++) { | 786 | 54 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 787 | 54 | typename ToDataType::FieldType, | 788 | 54 | multiply_may_overflow, narrow_integral>( | 789 | 54 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 790 | 54 | scale_multiplier, min_result, max_result, params)) { | 791 | 54 | if (set_nullable) { | 792 | 54 | null_map_data[i] = 1; | 793 | 54 | } else { | 794 | 54 | return params.status; | 795 | 54 | } | 796 | 54 | } | 797 | 54 | } | 798 | 54 | return Status::OK(); | 799 | 54 | }, | 800 | 54 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 801 | | | 802 | 14 | if (narrow_integral) { | 803 | 10 | block.get_by_position(result).column = | 804 | 10 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 805 | 10 | } else { | 806 | 4 | block.get_by_position(result).column = std::move(col_to); | 807 | 4 | } | 808 | 14 | return Status::OK(); | 809 | 54 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE4EEENS_15DataTypeDecimalILS3_28EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 723 | 24 | const NullMap::value_type* null_map = nullptr) const override { | 724 | 24 | using FromFieldType = typename FromDataType::FieldType; | 725 | 24 | using ToFieldType = typename ToDataType::FieldType; | 726 | 24 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 727 | 24 | const auto* col_from = | 728 | 24 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 729 | 24 | if (!col_from) { | 730 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 731 | 0 | named_from.column->get_name()); | 732 | 0 | } | 733 | | | 734 | 24 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 735 | 24 | constexpr UInt32 from_scale = 0; | 736 | | | 737 | 24 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 738 | 24 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 739 | 24 | UInt32 to_precision = to_decimal_type.get_precision(); | 740 | 24 | ToDataType::check_type_precision(to_precision); | 741 | 24 | UInt32 to_scale = to_decimal_type.get_scale(); | 742 | 24 | ToDataType::check_type_scale(to_scale); | 743 | | | 744 | 24 | auto from_max_int_digit_count = from_precision - from_scale; | 745 | 24 | auto to_max_int_digit_count = to_precision - to_scale; | 746 | | // may overflow. nullable result column. | 747 | 24 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 748 | | // only in non-strict mode and may overflow, we set nullable | 749 | 24 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 750 | | | 751 | 24 | constexpr UInt32 to_max_digits = | 752 | 24 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 753 | 24 | bool multiply_may_overflow = false; | 754 | 24 | if (to_scale > from_scale) { | 755 | 14 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 756 | 14 | } | 757 | 24 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 758 | 24 | sizeof(typename ToFieldType::NativeType)), | 759 | 24 | FromFieldType, typename ToFieldType::NativeType>; | 760 | 24 | MaxNativeType scale_multiplier = | 761 | 24 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 762 | 24 | typename ToFieldType::NativeType max_result = | 763 | 24 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 764 | 24 | typename ToFieldType::NativeType min_result = -max_result; | 765 | | | 766 | 24 | ColumnUInt8::MutablePtr col_null_map_to; | 767 | 24 | NullMap::value_type* null_map_data = nullptr; | 768 | 24 | if (narrow_integral) { | 769 | 20 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 770 | 20 | null_map_data = col_null_map_to->get_data().data(); | 771 | 20 | } | 772 | | | 773 | 24 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 774 | 24 | const auto& vec_from = col_from->get_data(); | 775 | 24 | const auto* vec_from_data = vec_from.data(); | 776 | 24 | auto& vec_to = col_to->get_data(); | 777 | 24 | auto* vec_to_data = vec_to.data(); | 778 | | | 779 | 24 | CastParameters params; | 780 | 24 | params.is_strict = (CastMode == CastModeType::StrictMode); | 781 | 24 | size_t size = vec_from.size(); | 782 | | | 783 | 24 | RETURN_IF_ERROR(std::visit( | 784 | 24 | [&](auto multiply_may_overflow, auto narrow_integral) { | 785 | 24 | for (size_t i = 0; i < size; i++) { | 786 | 24 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 787 | 24 | typename ToDataType::FieldType, | 788 | 24 | multiply_may_overflow, narrow_integral>( | 789 | 24 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 790 | 24 | scale_multiplier, min_result, max_result, params)) { | 791 | 24 | if (set_nullable) { | 792 | 24 | null_map_data[i] = 1; | 793 | 24 | } else { | 794 | 24 | return params.status; | 795 | 24 | } | 796 | 24 | } | 797 | 24 | } | 798 | 24 | return Status::OK(); | 799 | 24 | }, | 800 | 24 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 801 | | | 802 | 24 | if (narrow_integral) { | 803 | 20 | block.get_by_position(result).column = | 804 | 20 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 805 | 20 | } else { | 806 | 4 | block.get_by_position(result).column = std::move(col_to); | 807 | 4 | } | 808 | 24 | return Status::OK(); | 809 | 24 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE5EEENS_15DataTypeDecimalILS3_28EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 723 | 70 | const NullMap::value_type* null_map = nullptr) const override { | 724 | 70 | using FromFieldType = typename FromDataType::FieldType; | 725 | 70 | using ToFieldType = typename ToDataType::FieldType; | 726 | 70 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 727 | 70 | const auto* col_from = | 728 | 70 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 729 | 70 | if (!col_from) { | 730 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 731 | 0 | named_from.column->get_name()); | 732 | 0 | } | 733 | | | 734 | 70 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 735 | 70 | constexpr UInt32 from_scale = 0; | 736 | | | 737 | 70 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 738 | 70 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 739 | 70 | UInt32 to_precision = to_decimal_type.get_precision(); | 740 | 70 | ToDataType::check_type_precision(to_precision); | 741 | 70 | UInt32 to_scale = to_decimal_type.get_scale(); | 742 | 70 | ToDataType::check_type_scale(to_scale); | 743 | | | 744 | 70 | auto from_max_int_digit_count = from_precision - from_scale; | 745 | 70 | auto to_max_int_digit_count = to_precision - to_scale; | 746 | | // may overflow. nullable result column. | 747 | 70 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 748 | | // only in non-strict mode and may overflow, we set nullable | 749 | 70 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 750 | | | 751 | 70 | constexpr UInt32 to_max_digits = | 752 | 70 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 753 | 70 | bool multiply_may_overflow = false; | 754 | 70 | if (to_scale > from_scale) { | 755 | 40 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 756 | 40 | } | 757 | 70 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 758 | 70 | sizeof(typename ToFieldType::NativeType)), | 759 | 70 | FromFieldType, typename ToFieldType::NativeType>; | 760 | 70 | MaxNativeType scale_multiplier = | 761 | 70 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 762 | 70 | typename ToFieldType::NativeType max_result = | 763 | 70 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 764 | 70 | typename ToFieldType::NativeType min_result = -max_result; | 765 | | | 766 | 70 | ColumnUInt8::MutablePtr col_null_map_to; | 767 | 70 | NullMap::value_type* null_map_data = nullptr; | 768 | 70 | if (narrow_integral) { | 769 | 70 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 770 | 70 | null_map_data = col_null_map_to->get_data().data(); | 771 | 70 | } | 772 | | | 773 | 70 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 774 | 70 | const auto& vec_from = col_from->get_data(); | 775 | 70 | const auto* vec_from_data = vec_from.data(); | 776 | 70 | auto& vec_to = col_to->get_data(); | 777 | 70 | auto* vec_to_data = vec_to.data(); | 778 | | | 779 | 70 | CastParameters params; | 780 | 70 | params.is_strict = (CastMode == CastModeType::StrictMode); | 781 | 70 | size_t size = vec_from.size(); | 782 | | | 783 | 70 | RETURN_IF_ERROR(std::visit( | 784 | 70 | [&](auto multiply_may_overflow, auto narrow_integral) { | 785 | 70 | for (size_t i = 0; i < size; i++) { | 786 | 70 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 787 | 70 | typename ToDataType::FieldType, | 788 | 70 | multiply_may_overflow, narrow_integral>( | 789 | 70 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 790 | 70 | scale_multiplier, min_result, max_result, params)) { | 791 | 70 | if (set_nullable) { | 792 | 70 | null_map_data[i] = 1; | 793 | 70 | } else { | 794 | 70 | return params.status; | 795 | 70 | } | 796 | 70 | } | 797 | 70 | } | 798 | 70 | return Status::OK(); | 799 | 70 | }, | 800 | 70 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 801 | | | 802 | 14 | if (narrow_integral) { | 803 | 14 | block.get_by_position(result).column = | 804 | 14 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 805 | 14 | } else { | 806 | 0 | block.get_by_position(result).column = std::move(col_to); | 807 | 0 | } | 808 | 14 | return Status::OK(); | 809 | 70 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE5EEENS_15DataTypeDecimalILS3_28EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 723 | 28 | const NullMap::value_type* null_map = nullptr) const override { | 724 | 28 | using FromFieldType = typename FromDataType::FieldType; | 725 | 28 | using ToFieldType = typename ToDataType::FieldType; | 726 | 28 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 727 | 28 | const auto* col_from = | 728 | 28 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 729 | 28 | if (!col_from) { | 730 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 731 | 0 | named_from.column->get_name()); | 732 | 0 | } | 733 | | | 734 | 28 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 735 | 28 | constexpr UInt32 from_scale = 0; | 736 | | | 737 | 28 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 738 | 28 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 739 | 28 | UInt32 to_precision = to_decimal_type.get_precision(); | 740 | 28 | ToDataType::check_type_precision(to_precision); | 741 | 28 | UInt32 to_scale = to_decimal_type.get_scale(); | 742 | 28 | ToDataType::check_type_scale(to_scale); | 743 | | | 744 | 28 | auto from_max_int_digit_count = from_precision - from_scale; | 745 | 28 | auto to_max_int_digit_count = to_precision - to_scale; | 746 | | // may overflow. nullable result column. | 747 | 28 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 748 | | // only in non-strict mode and may overflow, we set nullable | 749 | 28 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 750 | | | 751 | 28 | constexpr UInt32 to_max_digits = | 752 | 28 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 753 | 28 | bool multiply_may_overflow = false; | 754 | 28 | if (to_scale > from_scale) { | 755 | 16 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 756 | 16 | } | 757 | 28 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 758 | 28 | sizeof(typename ToFieldType::NativeType)), | 759 | 28 | FromFieldType, typename ToFieldType::NativeType>; | 760 | 28 | MaxNativeType scale_multiplier = | 761 | 28 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 762 | 28 | typename ToFieldType::NativeType max_result = | 763 | 28 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 764 | 28 | typename ToFieldType::NativeType min_result = -max_result; | 765 | | | 766 | 28 | ColumnUInt8::MutablePtr col_null_map_to; | 767 | 28 | NullMap::value_type* null_map_data = nullptr; | 768 | 28 | if (narrow_integral) { | 769 | 28 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 770 | 28 | null_map_data = col_null_map_to->get_data().data(); | 771 | 28 | } | 772 | | | 773 | 28 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 774 | 28 | const auto& vec_from = col_from->get_data(); | 775 | 28 | const auto* vec_from_data = vec_from.data(); | 776 | 28 | auto& vec_to = col_to->get_data(); | 777 | 28 | auto* vec_to_data = vec_to.data(); | 778 | | | 779 | 28 | CastParameters params; | 780 | 28 | params.is_strict = (CastMode == CastModeType::StrictMode); | 781 | 28 | size_t size = vec_from.size(); | 782 | | | 783 | 28 | RETURN_IF_ERROR(std::visit( | 784 | 28 | [&](auto multiply_may_overflow, auto narrow_integral) { | 785 | 28 | for (size_t i = 0; i < size; i++) { | 786 | 28 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 787 | 28 | typename ToDataType::FieldType, | 788 | 28 | multiply_may_overflow, narrow_integral>( | 789 | 28 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 790 | 28 | scale_multiplier, min_result, max_result, params)) { | 791 | 28 | if (set_nullable) { | 792 | 28 | null_map_data[i] = 1; | 793 | 28 | } else { | 794 | 28 | return params.status; | 795 | 28 | } | 796 | 28 | } | 797 | 28 | } | 798 | 28 | return Status::OK(); | 799 | 28 | }, | 800 | 28 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 801 | | | 802 | 28 | if (narrow_integral) { | 803 | 28 | block.get_by_position(result).column = | 804 | 28 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 805 | 28 | } else { | 806 | 0 | block.get_by_position(result).column = std::move(col_to); | 807 | 0 | } | 808 | 28 | return Status::OK(); | 809 | 28 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE6EEENS_15DataTypeDecimalILS3_28EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 723 | 70 | const NullMap::value_type* null_map = nullptr) const override { | 724 | 70 | using FromFieldType = typename FromDataType::FieldType; | 725 | 70 | using ToFieldType = typename ToDataType::FieldType; | 726 | 70 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 727 | 70 | const auto* col_from = | 728 | 70 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 729 | 70 | if (!col_from) { | 730 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 731 | 0 | named_from.column->get_name()); | 732 | 0 | } | 733 | | | 734 | 70 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 735 | 70 | constexpr UInt32 from_scale = 0; | 736 | | | 737 | 70 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 738 | 70 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 739 | 70 | UInt32 to_precision = to_decimal_type.get_precision(); | 740 | 70 | ToDataType::check_type_precision(to_precision); | 741 | 70 | UInt32 to_scale = to_decimal_type.get_scale(); | 742 | 70 | ToDataType::check_type_scale(to_scale); | 743 | | | 744 | 70 | auto from_max_int_digit_count = from_precision - from_scale; | 745 | 70 | auto to_max_int_digit_count = to_precision - to_scale; | 746 | | // may overflow. nullable result column. | 747 | 70 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 748 | | // only in non-strict mode and may overflow, we set nullable | 749 | 70 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 750 | | | 751 | 70 | constexpr UInt32 to_max_digits = | 752 | 70 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 753 | 70 | bool multiply_may_overflow = false; | 754 | 70 | if (to_scale > from_scale) { | 755 | 40 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 756 | 40 | } | 757 | 70 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 758 | 70 | sizeof(typename ToFieldType::NativeType)), | 759 | 70 | FromFieldType, typename ToFieldType::NativeType>; | 760 | 70 | MaxNativeType scale_multiplier = | 761 | 70 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 762 | 70 | typename ToFieldType::NativeType max_result = | 763 | 70 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 764 | 70 | typename ToFieldType::NativeType min_result = -max_result; | 765 | | | 766 | 70 | ColumnUInt8::MutablePtr col_null_map_to; | 767 | 70 | NullMap::value_type* null_map_data = nullptr; | 768 | 70 | if (narrow_integral) { | 769 | 70 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 770 | 70 | null_map_data = col_null_map_to->get_data().data(); | 771 | 70 | } | 772 | | | 773 | 70 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 774 | 70 | const auto& vec_from = col_from->get_data(); | 775 | 70 | const auto* vec_from_data = vec_from.data(); | 776 | 70 | auto& vec_to = col_to->get_data(); | 777 | 70 | auto* vec_to_data = vec_to.data(); | 778 | | | 779 | 70 | CastParameters params; | 780 | 70 | params.is_strict = (CastMode == CastModeType::StrictMode); | 781 | 70 | size_t size = vec_from.size(); | 782 | | | 783 | 70 | RETURN_IF_ERROR(std::visit( | 784 | 70 | [&](auto multiply_may_overflow, auto narrow_integral) { | 785 | 70 | for (size_t i = 0; i < size; i++) { | 786 | 70 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 787 | 70 | typename ToDataType::FieldType, | 788 | 70 | multiply_may_overflow, narrow_integral>( | 789 | 70 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 790 | 70 | scale_multiplier, min_result, max_result, params)) { | 791 | 70 | if (set_nullable) { | 792 | 70 | null_map_data[i] = 1; | 793 | 70 | } else { | 794 | 70 | return params.status; | 795 | 70 | } | 796 | 70 | } | 797 | 70 | } | 798 | 70 | return Status::OK(); | 799 | 70 | }, | 800 | 70 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 801 | | | 802 | 14 | if (narrow_integral) { | 803 | 14 | block.get_by_position(result).column = | 804 | 14 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 805 | 14 | } else { | 806 | 0 | block.get_by_position(result).column = std::move(col_to); | 807 | 0 | } | 808 | 14 | return Status::OK(); | 809 | 70 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE6EEENS_15DataTypeDecimalILS3_28EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 723 | 28 | const NullMap::value_type* null_map = nullptr) const override { | 724 | 28 | using FromFieldType = typename FromDataType::FieldType; | 725 | 28 | using ToFieldType = typename ToDataType::FieldType; | 726 | 28 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 727 | 28 | const auto* col_from = | 728 | 28 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 729 | 28 | if (!col_from) { | 730 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 731 | 0 | named_from.column->get_name()); | 732 | 0 | } | 733 | | | 734 | 28 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 735 | 28 | constexpr UInt32 from_scale = 0; | 736 | | | 737 | 28 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 738 | 28 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 739 | 28 | UInt32 to_precision = to_decimal_type.get_precision(); | 740 | 28 | ToDataType::check_type_precision(to_precision); | 741 | 28 | UInt32 to_scale = to_decimal_type.get_scale(); | 742 | 28 | ToDataType::check_type_scale(to_scale); | 743 | | | 744 | 28 | auto from_max_int_digit_count = from_precision - from_scale; | 745 | 28 | auto to_max_int_digit_count = to_precision - to_scale; | 746 | | // may overflow. nullable result column. | 747 | 28 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 748 | | // only in non-strict mode and may overflow, we set nullable | 749 | 28 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 750 | | | 751 | 28 | constexpr UInt32 to_max_digits = | 752 | 28 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 753 | 28 | bool multiply_may_overflow = false; | 754 | 28 | if (to_scale > from_scale) { | 755 | 16 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 756 | 16 | } | 757 | 28 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 758 | 28 | sizeof(typename ToFieldType::NativeType)), | 759 | 28 | FromFieldType, typename ToFieldType::NativeType>; | 760 | 28 | MaxNativeType scale_multiplier = | 761 | 28 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 762 | 28 | typename ToFieldType::NativeType max_result = | 763 | 28 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 764 | 28 | typename ToFieldType::NativeType min_result = -max_result; | 765 | | | 766 | 28 | ColumnUInt8::MutablePtr col_null_map_to; | 767 | 28 | NullMap::value_type* null_map_data = nullptr; | 768 | 28 | if (narrow_integral) { | 769 | 28 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 770 | 28 | null_map_data = col_null_map_to->get_data().data(); | 771 | 28 | } | 772 | | | 773 | 28 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 774 | 28 | const auto& vec_from = col_from->get_data(); | 775 | 28 | const auto* vec_from_data = vec_from.data(); | 776 | 28 | auto& vec_to = col_to->get_data(); | 777 | 28 | auto* vec_to_data = vec_to.data(); | 778 | | | 779 | 28 | CastParameters params; | 780 | 28 | params.is_strict = (CastMode == CastModeType::StrictMode); | 781 | 28 | size_t size = vec_from.size(); | 782 | | | 783 | 28 | RETURN_IF_ERROR(std::visit( | 784 | 28 | [&](auto multiply_may_overflow, auto narrow_integral) { | 785 | 28 | for (size_t i = 0; i < size; i++) { | 786 | 28 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 787 | 28 | typename ToDataType::FieldType, | 788 | 28 | multiply_may_overflow, narrow_integral>( | 789 | 28 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 790 | 28 | scale_multiplier, min_result, max_result, params)) { | 791 | 28 | if (set_nullable) { | 792 | 28 | null_map_data[i] = 1; | 793 | 28 | } else { | 794 | 28 | return params.status; | 795 | 28 | } | 796 | 28 | } | 797 | 28 | } | 798 | 28 | return Status::OK(); | 799 | 28 | }, | 800 | 28 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 801 | | | 802 | 28 | if (narrow_integral) { | 803 | 28 | block.get_by_position(result).column = | 804 | 28 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 805 | 28 | } else { | 806 | 0 | block.get_by_position(result).column = std::move(col_to); | 807 | 0 | } | 808 | 28 | return Status::OK(); | 809 | 28 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE7EEENS_15DataTypeDecimalILS3_28EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 723 | 70 | const NullMap::value_type* null_map = nullptr) const override { | 724 | 70 | using FromFieldType = typename FromDataType::FieldType; | 725 | 70 | using ToFieldType = typename ToDataType::FieldType; | 726 | 70 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 727 | 70 | const auto* col_from = | 728 | 70 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 729 | 70 | if (!col_from) { | 730 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 731 | 0 | named_from.column->get_name()); | 732 | 0 | } | 733 | | | 734 | 70 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 735 | 70 | constexpr UInt32 from_scale = 0; | 736 | | | 737 | 70 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 738 | 70 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 739 | 70 | UInt32 to_precision = to_decimal_type.get_precision(); | 740 | 70 | ToDataType::check_type_precision(to_precision); | 741 | 70 | UInt32 to_scale = to_decimal_type.get_scale(); | 742 | 70 | ToDataType::check_type_scale(to_scale); | 743 | | | 744 | 70 | auto from_max_int_digit_count = from_precision - from_scale; | 745 | 70 | auto to_max_int_digit_count = to_precision - to_scale; | 746 | | // may overflow. nullable result column. | 747 | 70 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 748 | | // only in non-strict mode and may overflow, we set nullable | 749 | 70 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 750 | | | 751 | 70 | constexpr UInt32 to_max_digits = | 752 | 70 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 753 | 70 | bool multiply_may_overflow = false; | 754 | 70 | if (to_scale > from_scale) { | 755 | 40 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 756 | 40 | } | 757 | 70 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 758 | 70 | sizeof(typename ToFieldType::NativeType)), | 759 | 70 | FromFieldType, typename ToFieldType::NativeType>; | 760 | 70 | MaxNativeType scale_multiplier = | 761 | 70 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 762 | 70 | typename ToFieldType::NativeType max_result = | 763 | 70 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 764 | 70 | typename ToFieldType::NativeType min_result = -max_result; | 765 | | | 766 | 70 | ColumnUInt8::MutablePtr col_null_map_to; | 767 | 70 | NullMap::value_type* null_map_data = nullptr; | 768 | 70 | if (narrow_integral) { | 769 | 70 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 770 | 70 | null_map_data = col_null_map_to->get_data().data(); | 771 | 70 | } | 772 | | | 773 | 70 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 774 | 70 | const auto& vec_from = col_from->get_data(); | 775 | 70 | const auto* vec_from_data = vec_from.data(); | 776 | 70 | auto& vec_to = col_to->get_data(); | 777 | 70 | auto* vec_to_data = vec_to.data(); | 778 | | | 779 | 70 | CastParameters params; | 780 | 70 | params.is_strict = (CastMode == CastModeType::StrictMode); | 781 | 70 | size_t size = vec_from.size(); | 782 | | | 783 | 70 | RETURN_IF_ERROR(std::visit( | 784 | 70 | [&](auto multiply_may_overflow, auto narrow_integral) { | 785 | 70 | for (size_t i = 0; i < size; i++) { | 786 | 70 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 787 | 70 | typename ToDataType::FieldType, | 788 | 70 | multiply_may_overflow, narrow_integral>( | 789 | 70 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 790 | 70 | scale_multiplier, min_result, max_result, params)) { | 791 | 70 | if (set_nullable) { | 792 | 70 | null_map_data[i] = 1; | 793 | 70 | } else { | 794 | 70 | return params.status; | 795 | 70 | } | 796 | 70 | } | 797 | 70 | } | 798 | 70 | return Status::OK(); | 799 | 70 | }, | 800 | 70 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 801 | | | 802 | 14 | if (narrow_integral) { | 803 | 14 | block.get_by_position(result).column = | 804 | 14 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 805 | 14 | } else { | 806 | 0 | block.get_by_position(result).column = std::move(col_to); | 807 | 0 | } | 808 | 14 | return Status::OK(); | 809 | 70 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE7EEENS_15DataTypeDecimalILS3_28EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 723 | 28 | const NullMap::value_type* null_map = nullptr) const override { | 724 | 28 | using FromFieldType = typename FromDataType::FieldType; | 725 | 28 | using ToFieldType = typename ToDataType::FieldType; | 726 | 28 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 727 | 28 | const auto* col_from = | 728 | 28 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 729 | 28 | if (!col_from) { | 730 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 731 | 0 | named_from.column->get_name()); | 732 | 0 | } | 733 | | | 734 | 28 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 735 | 28 | constexpr UInt32 from_scale = 0; | 736 | | | 737 | 28 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 738 | 28 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 739 | 28 | UInt32 to_precision = to_decimal_type.get_precision(); | 740 | 28 | ToDataType::check_type_precision(to_precision); | 741 | 28 | UInt32 to_scale = to_decimal_type.get_scale(); | 742 | 28 | ToDataType::check_type_scale(to_scale); | 743 | | | 744 | 28 | auto from_max_int_digit_count = from_precision - from_scale; | 745 | 28 | auto to_max_int_digit_count = to_precision - to_scale; | 746 | | // may overflow. nullable result column. | 747 | 28 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 748 | | // only in non-strict mode and may overflow, we set nullable | 749 | 28 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 750 | | | 751 | 28 | constexpr UInt32 to_max_digits = | 752 | 28 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 753 | 28 | bool multiply_may_overflow = false; | 754 | 28 | if (to_scale > from_scale) { | 755 | 16 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 756 | 16 | } | 757 | 28 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 758 | 28 | sizeof(typename ToFieldType::NativeType)), | 759 | 28 | FromFieldType, typename ToFieldType::NativeType>; | 760 | 28 | MaxNativeType scale_multiplier = | 761 | 28 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 762 | 28 | typename ToFieldType::NativeType max_result = | 763 | 28 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 764 | 28 | typename ToFieldType::NativeType min_result = -max_result; | 765 | | | 766 | 28 | ColumnUInt8::MutablePtr col_null_map_to; | 767 | 28 | NullMap::value_type* null_map_data = nullptr; | 768 | 28 | if (narrow_integral) { | 769 | 28 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 770 | 28 | null_map_data = col_null_map_to->get_data().data(); | 771 | 28 | } | 772 | | | 773 | 28 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 774 | 28 | const auto& vec_from = col_from->get_data(); | 775 | 28 | const auto* vec_from_data = vec_from.data(); | 776 | 28 | auto& vec_to = col_to->get_data(); | 777 | 28 | auto* vec_to_data = vec_to.data(); | 778 | | | 779 | 28 | CastParameters params; | 780 | 28 | params.is_strict = (CastMode == CastModeType::StrictMode); | 781 | 28 | size_t size = vec_from.size(); | 782 | | | 783 | 28 | RETURN_IF_ERROR(std::visit( | 784 | 28 | [&](auto multiply_may_overflow, auto narrow_integral) { | 785 | 28 | for (size_t i = 0; i < size; i++) { | 786 | 28 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 787 | 28 | typename ToDataType::FieldType, | 788 | 28 | multiply_may_overflow, narrow_integral>( | 789 | 28 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 790 | 28 | scale_multiplier, min_result, max_result, params)) { | 791 | 28 | if (set_nullable) { | 792 | 28 | null_map_data[i] = 1; | 793 | 28 | } else { | 794 | 28 | return params.status; | 795 | 28 | } | 796 | 28 | } | 797 | 28 | } | 798 | 28 | return Status::OK(); | 799 | 28 | }, | 800 | 28 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 801 | | | 802 | 28 | if (narrow_integral) { | 803 | 28 | block.get_by_position(result).column = | 804 | 28 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 805 | 28 | } else { | 806 | 0 | block.get_by_position(result).column = std::move(col_to); | 807 | 0 | } | 808 | 28 | return Status::OK(); | 809 | 28 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE2EEENS_15DataTypeDecimalILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 723 | 4 | const NullMap::value_type* null_map = nullptr) const override { | 724 | 4 | using FromFieldType = typename FromDataType::FieldType; | 725 | 4 | using ToFieldType = typename ToDataType::FieldType; | 726 | 4 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 727 | 4 | const auto* col_from = | 728 | 4 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 729 | 4 | if (!col_from) { | 730 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 731 | 0 | named_from.column->get_name()); | 732 | 0 | } | 733 | | | 734 | 4 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 735 | 4 | constexpr UInt32 from_scale = 0; | 736 | | | 737 | 4 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 738 | 4 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 739 | 4 | UInt32 to_precision = to_decimal_type.get_precision(); | 740 | 4 | ToDataType::check_type_precision(to_precision); | 741 | 4 | UInt32 to_scale = to_decimal_type.get_scale(); | 742 | 4 | ToDataType::check_type_scale(to_scale); | 743 | | | 744 | 4 | auto from_max_int_digit_count = from_precision - from_scale; | 745 | 4 | auto to_max_int_digit_count = to_precision - to_scale; | 746 | | // may overflow. nullable result column. | 747 | 4 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 748 | | // only in non-strict mode and may overflow, we set nullable | 749 | 4 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 750 | | | 751 | 4 | constexpr UInt32 to_max_digits = | 752 | 4 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 753 | 4 | bool multiply_may_overflow = false; | 754 | 4 | if (to_scale > from_scale) { | 755 | 4 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 756 | 4 | } | 757 | 4 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 758 | 4 | sizeof(typename ToFieldType::NativeType)), | 759 | 4 | FromFieldType, typename ToFieldType::NativeType>; | 760 | 4 | MaxNativeType scale_multiplier = | 761 | 4 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 762 | 4 | typename ToFieldType::NativeType max_result = | 763 | 4 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 764 | 4 | typename ToFieldType::NativeType min_result = -max_result; | 765 | | | 766 | 4 | ColumnUInt8::MutablePtr col_null_map_to; | 767 | 4 | NullMap::value_type* null_map_data = nullptr; | 768 | 4 | if (narrow_integral) { | 769 | 4 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 770 | 4 | null_map_data = col_null_map_to->get_data().data(); | 771 | 4 | } | 772 | | | 773 | 4 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 774 | 4 | const auto& vec_from = col_from->get_data(); | 775 | 4 | const auto* vec_from_data = vec_from.data(); | 776 | 4 | auto& vec_to = col_to->get_data(); | 777 | 4 | auto* vec_to_data = vec_to.data(); | 778 | | | 779 | 4 | CastParameters params; | 780 | 4 | params.is_strict = (CastMode == CastModeType::StrictMode); | 781 | 4 | size_t size = vec_from.size(); | 782 | | | 783 | 4 | RETURN_IF_ERROR(std::visit( | 784 | 4 | [&](auto multiply_may_overflow, auto narrow_integral) { | 785 | 4 | for (size_t i = 0; i < size; i++) { | 786 | 4 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 787 | 4 | typename ToDataType::FieldType, | 788 | 4 | multiply_may_overflow, narrow_integral>( | 789 | 4 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 790 | 4 | scale_multiplier, min_result, max_result, params)) { | 791 | 4 | if (set_nullable) { | 792 | 4 | null_map_data[i] = 1; | 793 | 4 | } else { | 794 | 4 | return params.status; | 795 | 4 | } | 796 | 4 | } | 797 | 4 | } | 798 | 4 | return Status::OK(); | 799 | 4 | }, | 800 | 4 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 801 | | | 802 | 2 | if (narrow_integral) { | 803 | 2 | block.get_by_position(result).column = | 804 | 2 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 805 | 2 | } else { | 806 | 0 | block.get_by_position(result).column = std::move(col_to); | 807 | 0 | } | 808 | 2 | return Status::OK(); | 809 | 4 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE2EEENS_15DataTypeDecimalILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 723 | 10 | const NullMap::value_type* null_map = nullptr) const override { | 724 | 10 | using FromFieldType = typename FromDataType::FieldType; | 725 | 10 | using ToFieldType = typename ToDataType::FieldType; | 726 | 10 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 727 | 10 | const auto* col_from = | 728 | 10 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 729 | 10 | if (!col_from) { | 730 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 731 | 0 | named_from.column->get_name()); | 732 | 0 | } | 733 | | | 734 | 10 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 735 | 10 | constexpr UInt32 from_scale = 0; | 736 | | | 737 | 10 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 738 | 10 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 739 | 10 | UInt32 to_precision = to_decimal_type.get_precision(); | 740 | 10 | ToDataType::check_type_precision(to_precision); | 741 | 10 | UInt32 to_scale = to_decimal_type.get_scale(); | 742 | 10 | ToDataType::check_type_scale(to_scale); | 743 | | | 744 | 10 | auto from_max_int_digit_count = from_precision - from_scale; | 745 | 10 | auto to_max_int_digit_count = to_precision - to_scale; | 746 | | // may overflow. nullable result column. | 747 | 10 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 748 | | // only in non-strict mode and may overflow, we set nullable | 749 | 10 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 750 | | | 751 | 10 | constexpr UInt32 to_max_digits = | 752 | 10 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 753 | 10 | bool multiply_may_overflow = false; | 754 | 10 | if (to_scale > from_scale) { | 755 | 8 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 756 | 8 | } | 757 | 10 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 758 | 10 | sizeof(typename ToFieldType::NativeType)), | 759 | 10 | FromFieldType, typename ToFieldType::NativeType>; | 760 | 10 | MaxNativeType scale_multiplier = | 761 | 10 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 762 | 10 | typename ToFieldType::NativeType max_result = | 763 | 10 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 764 | 10 | typename ToFieldType::NativeType min_result = -max_result; | 765 | | | 766 | 10 | ColumnUInt8::MutablePtr col_null_map_to; | 767 | 10 | NullMap::value_type* null_map_data = nullptr; | 768 | 10 | if (narrow_integral) { | 769 | 2 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 770 | 2 | null_map_data = col_null_map_to->get_data().data(); | 771 | 2 | } | 772 | | | 773 | 10 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 774 | 10 | const auto& vec_from = col_from->get_data(); | 775 | 10 | const auto* vec_from_data = vec_from.data(); | 776 | 10 | auto& vec_to = col_to->get_data(); | 777 | 10 | auto* vec_to_data = vec_to.data(); | 778 | | | 779 | 10 | CastParameters params; | 780 | 10 | params.is_strict = (CastMode == CastModeType::StrictMode); | 781 | 10 | size_t size = vec_from.size(); | 782 | | | 783 | 10 | RETURN_IF_ERROR(std::visit( | 784 | 10 | [&](auto multiply_may_overflow, auto narrow_integral) { | 785 | 10 | for (size_t i = 0; i < size; i++) { | 786 | 10 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 787 | 10 | typename ToDataType::FieldType, | 788 | 10 | multiply_may_overflow, narrow_integral>( | 789 | 10 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 790 | 10 | scale_multiplier, min_result, max_result, params)) { | 791 | 10 | if (set_nullable) { | 792 | 10 | null_map_data[i] = 1; | 793 | 10 | } else { | 794 | 10 | return params.status; | 795 | 10 | } | 796 | 10 | } | 797 | 10 | } | 798 | 10 | return Status::OK(); | 799 | 10 | }, | 800 | 10 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 801 | | | 802 | 10 | if (narrow_integral) { | 803 | 2 | block.get_by_position(result).column = | 804 | 2 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 805 | 8 | } else { | 806 | 8 | block.get_by_position(result).column = std::move(col_to); | 807 | 8 | } | 808 | 10 | return Status::OK(); | 809 | 10 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE3EEENS_15DataTypeDecimalILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 723 | 38 | const NullMap::value_type* null_map = nullptr) const override { | 724 | 38 | using FromFieldType = typename FromDataType::FieldType; | 725 | 38 | using ToFieldType = typename ToDataType::FieldType; | 726 | 38 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 727 | 38 | const auto* col_from = | 728 | 38 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 729 | 38 | if (!col_from) { | 730 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 731 | 0 | named_from.column->get_name()); | 732 | 0 | } | 733 | | | 734 | 38 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 735 | 38 | constexpr UInt32 from_scale = 0; | 736 | | | 737 | 38 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 738 | 38 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 739 | 38 | UInt32 to_precision = to_decimal_type.get_precision(); | 740 | 38 | ToDataType::check_type_precision(to_precision); | 741 | 38 | UInt32 to_scale = to_decimal_type.get_scale(); | 742 | 38 | ToDataType::check_type_scale(to_scale); | 743 | | | 744 | 38 | auto from_max_int_digit_count = from_precision - from_scale; | 745 | 38 | auto to_max_int_digit_count = to_precision - to_scale; | 746 | | // may overflow. nullable result column. | 747 | 38 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 748 | | // only in non-strict mode and may overflow, we set nullable | 749 | 38 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 750 | | | 751 | 38 | constexpr UInt32 to_max_digits = | 752 | 38 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 753 | 38 | bool multiply_may_overflow = false; | 754 | 38 | if (to_scale > from_scale) { | 755 | 24 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 756 | 24 | } | 757 | 38 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 758 | 38 | sizeof(typename ToFieldType::NativeType)), | 759 | 38 | FromFieldType, typename ToFieldType::NativeType>; | 760 | 38 | MaxNativeType scale_multiplier = | 761 | 38 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 762 | 38 | typename ToFieldType::NativeType max_result = | 763 | 38 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 764 | 38 | typename ToFieldType::NativeType min_result = -max_result; | 765 | | | 766 | 38 | ColumnUInt8::MutablePtr col_null_map_to; | 767 | 38 | NullMap::value_type* null_map_data = nullptr; | 768 | 38 | if (narrow_integral) { | 769 | 30 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 770 | 30 | null_map_data = col_null_map_to->get_data().data(); | 771 | 30 | } | 772 | | | 773 | 38 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 774 | 38 | const auto& vec_from = col_from->get_data(); | 775 | 38 | const auto* vec_from_data = vec_from.data(); | 776 | 38 | auto& vec_to = col_to->get_data(); | 777 | 38 | auto* vec_to_data = vec_to.data(); | 778 | | | 779 | 38 | CastParameters params; | 780 | 38 | params.is_strict = (CastMode == CastModeType::StrictMode); | 781 | 38 | size_t size = vec_from.size(); | 782 | | | 783 | 38 | RETURN_IF_ERROR(std::visit( | 784 | 38 | [&](auto multiply_may_overflow, auto narrow_integral) { | 785 | 38 | for (size_t i = 0; i < size; i++) { | 786 | 38 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 787 | 38 | typename ToDataType::FieldType, | 788 | 38 | multiply_may_overflow, narrow_integral>( | 789 | 38 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 790 | 38 | scale_multiplier, min_result, max_result, params)) { | 791 | 38 | if (set_nullable) { | 792 | 38 | null_map_data[i] = 1; | 793 | 38 | } else { | 794 | 38 | return params.status; | 795 | 38 | } | 796 | 38 | } | 797 | 38 | } | 798 | 38 | return Status::OK(); | 799 | 38 | }, | 800 | 38 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 801 | | | 802 | 14 | if (narrow_integral) { | 803 | 6 | block.get_by_position(result).column = | 804 | 6 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 805 | 8 | } else { | 806 | 8 | block.get_by_position(result).column = std::move(col_to); | 807 | 8 | } | 808 | 14 | return Status::OK(); | 809 | 38 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE3EEENS_15DataTypeDecimalILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 723 | 20 | const NullMap::value_type* null_map = nullptr) const override { | 724 | 20 | using FromFieldType = typename FromDataType::FieldType; | 725 | 20 | using ToFieldType = typename ToDataType::FieldType; | 726 | 20 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 727 | 20 | const auto* col_from = | 728 | 20 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 729 | 20 | if (!col_from) { | 730 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 731 | 0 | named_from.column->get_name()); | 732 | 0 | } | 733 | | | 734 | 20 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 735 | 20 | constexpr UInt32 from_scale = 0; | 736 | | | 737 | 20 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 738 | 20 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 739 | 20 | UInt32 to_precision = to_decimal_type.get_precision(); | 740 | 20 | ToDataType::check_type_precision(to_precision); | 741 | 20 | UInt32 to_scale = to_decimal_type.get_scale(); | 742 | 20 | ToDataType::check_type_scale(to_scale); | 743 | | | 744 | 20 | auto from_max_int_digit_count = from_precision - from_scale; | 745 | 20 | auto to_max_int_digit_count = to_precision - to_scale; | 746 | | // may overflow. nullable result column. | 747 | 20 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 748 | | // only in non-strict mode and may overflow, we set nullable | 749 | 20 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 750 | | | 751 | 20 | constexpr UInt32 to_max_digits = | 752 | 20 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 753 | 20 | bool multiply_may_overflow = false; | 754 | 20 | if (to_scale > from_scale) { | 755 | 12 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 756 | 12 | } | 757 | 20 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 758 | 20 | sizeof(typename ToFieldType::NativeType)), | 759 | 20 | FromFieldType, typename ToFieldType::NativeType>; | 760 | 20 | MaxNativeType scale_multiplier = | 761 | 20 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 762 | 20 | typename ToFieldType::NativeType max_result = | 763 | 20 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 764 | 20 | typename ToFieldType::NativeType min_result = -max_result; | 765 | | | 766 | 20 | ColumnUInt8::MutablePtr col_null_map_to; | 767 | 20 | NullMap::value_type* null_map_data = nullptr; | 768 | 20 | if (narrow_integral) { | 769 | 12 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 770 | 12 | null_map_data = col_null_map_to->get_data().data(); | 771 | 12 | } | 772 | | | 773 | 20 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 774 | 20 | const auto& vec_from = col_from->get_data(); | 775 | 20 | const auto* vec_from_data = vec_from.data(); | 776 | 20 | auto& vec_to = col_to->get_data(); | 777 | 20 | auto* vec_to_data = vec_to.data(); | 778 | | | 779 | 20 | CastParameters params; | 780 | 20 | params.is_strict = (CastMode == CastModeType::StrictMode); | 781 | 20 | size_t size = vec_from.size(); | 782 | | | 783 | 20 | RETURN_IF_ERROR(std::visit( | 784 | 20 | [&](auto multiply_may_overflow, auto narrow_integral) { | 785 | 20 | for (size_t i = 0; i < size; i++) { | 786 | 20 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 787 | 20 | typename ToDataType::FieldType, | 788 | 20 | multiply_may_overflow, narrow_integral>( | 789 | 20 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 790 | 20 | scale_multiplier, min_result, max_result, params)) { | 791 | 20 | if (set_nullable) { | 792 | 20 | null_map_data[i] = 1; | 793 | 20 | } else { | 794 | 20 | return params.status; | 795 | 20 | } | 796 | 20 | } | 797 | 20 | } | 798 | 20 | return Status::OK(); | 799 | 20 | }, | 800 | 20 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 801 | | | 802 | 20 | if (narrow_integral) { | 803 | 12 | block.get_by_position(result).column = | 804 | 12 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 805 | 12 | } else { | 806 | 8 | block.get_by_position(result).column = std::move(col_to); | 807 | 8 | } | 808 | 20 | return Status::OK(); | 809 | 20 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE4EEENS_15DataTypeDecimalILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 723 | 38 | const NullMap::value_type* null_map = nullptr) const override { | 724 | 38 | using FromFieldType = typename FromDataType::FieldType; | 725 | 38 | using ToFieldType = typename ToDataType::FieldType; | 726 | 38 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 727 | 38 | const auto* col_from = | 728 | 38 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 729 | 38 | if (!col_from) { | 730 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 731 | 0 | named_from.column->get_name()); | 732 | 0 | } | 733 | | | 734 | 38 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 735 | 38 | constexpr UInt32 from_scale = 0; | 736 | | | 737 | 38 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 738 | 38 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 739 | 38 | UInt32 to_precision = to_decimal_type.get_precision(); | 740 | 38 | ToDataType::check_type_precision(to_precision); | 741 | 38 | UInt32 to_scale = to_decimal_type.get_scale(); | 742 | 38 | ToDataType::check_type_scale(to_scale); | 743 | | | 744 | 38 | auto from_max_int_digit_count = from_precision - from_scale; | 745 | 38 | auto to_max_int_digit_count = to_precision - to_scale; | 746 | | // may overflow. nullable result column. | 747 | 38 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 748 | | // only in non-strict mode and may overflow, we set nullable | 749 | 38 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 750 | | | 751 | 38 | constexpr UInt32 to_max_digits = | 752 | 38 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 753 | 38 | bool multiply_may_overflow = false; | 754 | 38 | if (to_scale > from_scale) { | 755 | 24 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 756 | 24 | } | 757 | 38 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 758 | 38 | sizeof(typename ToFieldType::NativeType)), | 759 | 38 | FromFieldType, typename ToFieldType::NativeType>; | 760 | 38 | MaxNativeType scale_multiplier = | 761 | 38 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 762 | 38 | typename ToFieldType::NativeType max_result = | 763 | 38 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 764 | 38 | typename ToFieldType::NativeType min_result = -max_result; | 765 | | | 766 | 38 | ColumnUInt8::MutablePtr col_null_map_to; | 767 | 38 | NullMap::value_type* null_map_data = nullptr; | 768 | 38 | if (narrow_integral) { | 769 | 30 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 770 | 30 | null_map_data = col_null_map_to->get_data().data(); | 771 | 30 | } | 772 | | | 773 | 38 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 774 | 38 | const auto& vec_from = col_from->get_data(); | 775 | 38 | const auto* vec_from_data = vec_from.data(); | 776 | 38 | auto& vec_to = col_to->get_data(); | 777 | 38 | auto* vec_to_data = vec_to.data(); | 778 | | | 779 | 38 | CastParameters params; | 780 | 38 | params.is_strict = (CastMode == CastModeType::StrictMode); | 781 | 38 | size_t size = vec_from.size(); | 782 | | | 783 | 38 | RETURN_IF_ERROR(std::visit( | 784 | 38 | [&](auto multiply_may_overflow, auto narrow_integral) { | 785 | 38 | for (size_t i = 0; i < size; i++) { | 786 | 38 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 787 | 38 | typename ToDataType::FieldType, | 788 | 38 | multiply_may_overflow, narrow_integral>( | 789 | 38 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 790 | 38 | scale_multiplier, min_result, max_result, params)) { | 791 | 38 | if (set_nullable) { | 792 | 38 | null_map_data[i] = 1; | 793 | 38 | } else { | 794 | 38 | return params.status; | 795 | 38 | } | 796 | 38 | } | 797 | 38 | } | 798 | 38 | return Status::OK(); | 799 | 38 | }, | 800 | 38 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 801 | | | 802 | 14 | if (narrow_integral) { | 803 | 6 | block.get_by_position(result).column = | 804 | 6 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 805 | 8 | } else { | 806 | 8 | block.get_by_position(result).column = std::move(col_to); | 807 | 8 | } | 808 | 14 | return Status::OK(); | 809 | 38 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE4EEENS_15DataTypeDecimalILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 723 | 20 | const NullMap::value_type* null_map = nullptr) const override { | 724 | 20 | using FromFieldType = typename FromDataType::FieldType; | 725 | 20 | using ToFieldType = typename ToDataType::FieldType; | 726 | 20 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 727 | 20 | const auto* col_from = | 728 | 20 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 729 | 20 | if (!col_from) { | 730 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 731 | 0 | named_from.column->get_name()); | 732 | 0 | } | 733 | | | 734 | 20 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 735 | 20 | constexpr UInt32 from_scale = 0; | 736 | | | 737 | 20 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 738 | 20 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 739 | 20 | UInt32 to_precision = to_decimal_type.get_precision(); | 740 | 20 | ToDataType::check_type_precision(to_precision); | 741 | 20 | UInt32 to_scale = to_decimal_type.get_scale(); | 742 | 20 | ToDataType::check_type_scale(to_scale); | 743 | | | 744 | 20 | auto from_max_int_digit_count = from_precision - from_scale; | 745 | 20 | auto to_max_int_digit_count = to_precision - to_scale; | 746 | | // may overflow. nullable result column. | 747 | 20 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 748 | | // only in non-strict mode and may overflow, we set nullable | 749 | 20 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 750 | | | 751 | 20 | constexpr UInt32 to_max_digits = | 752 | 20 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 753 | 20 | bool multiply_may_overflow = false; | 754 | 20 | if (to_scale > from_scale) { | 755 | 12 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 756 | 12 | } | 757 | 20 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 758 | 20 | sizeof(typename ToFieldType::NativeType)), | 759 | 20 | FromFieldType, typename ToFieldType::NativeType>; | 760 | 20 | MaxNativeType scale_multiplier = | 761 | 20 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 762 | 20 | typename ToFieldType::NativeType max_result = | 763 | 20 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 764 | 20 | typename ToFieldType::NativeType min_result = -max_result; | 765 | | | 766 | 20 | ColumnUInt8::MutablePtr col_null_map_to; | 767 | 20 | NullMap::value_type* null_map_data = nullptr; | 768 | 20 | if (narrow_integral) { | 769 | 12 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 770 | 12 | null_map_data = col_null_map_to->get_data().data(); | 771 | 12 | } | 772 | | | 773 | 20 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 774 | 20 | const auto& vec_from = col_from->get_data(); | 775 | 20 | const auto* vec_from_data = vec_from.data(); | 776 | 20 | auto& vec_to = col_to->get_data(); | 777 | 20 | auto* vec_to_data = vec_to.data(); | 778 | | | 779 | 20 | CastParameters params; | 780 | 20 | params.is_strict = (CastMode == CastModeType::StrictMode); | 781 | 20 | size_t size = vec_from.size(); | 782 | | | 783 | 20 | RETURN_IF_ERROR(std::visit( | 784 | 20 | [&](auto multiply_may_overflow, auto narrow_integral) { | 785 | 20 | for (size_t i = 0; i < size; i++) { | 786 | 20 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 787 | 20 | typename ToDataType::FieldType, | 788 | 20 | multiply_may_overflow, narrow_integral>( | 789 | 20 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 790 | 20 | scale_multiplier, min_result, max_result, params)) { | 791 | 20 | if (set_nullable) { | 792 | 20 | null_map_data[i] = 1; | 793 | 20 | } else { | 794 | 20 | return params.status; | 795 | 20 | } | 796 | 20 | } | 797 | 20 | } | 798 | 20 | return Status::OK(); | 799 | 20 | }, | 800 | 20 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 801 | | | 802 | 20 | if (narrow_integral) { | 803 | 12 | block.get_by_position(result).column = | 804 | 12 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 805 | 12 | } else { | 806 | 8 | block.get_by_position(result).column = std::move(col_to); | 807 | 8 | } | 808 | 20 | return Status::OK(); | 809 | 20 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE5EEENS_15DataTypeDecimalILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 723 | 62 | const NullMap::value_type* null_map = nullptr) const override { | 724 | 62 | using FromFieldType = typename FromDataType::FieldType; | 725 | 62 | using ToFieldType = typename ToDataType::FieldType; | 726 | 62 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 727 | 62 | const auto* col_from = | 728 | 62 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 729 | 62 | if (!col_from) { | 730 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 731 | 0 | named_from.column->get_name()); | 732 | 0 | } | 733 | | | 734 | 62 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 735 | 62 | constexpr UInt32 from_scale = 0; | 736 | | | 737 | 62 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 738 | 62 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 739 | 62 | UInt32 to_precision = to_decimal_type.get_precision(); | 740 | 62 | ToDataType::check_type_precision(to_precision); | 741 | 62 | UInt32 to_scale = to_decimal_type.get_scale(); | 742 | 62 | ToDataType::check_type_scale(to_scale); | 743 | | | 744 | 62 | auto from_max_int_digit_count = from_precision - from_scale; | 745 | 62 | auto to_max_int_digit_count = to_precision - to_scale; | 746 | | // may overflow. nullable result column. | 747 | 62 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 748 | | // only in non-strict mode and may overflow, we set nullable | 749 | 62 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 750 | | | 751 | 62 | constexpr UInt32 to_max_digits = | 752 | 62 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 753 | 62 | bool multiply_may_overflow = false; | 754 | 62 | if (to_scale > from_scale) { | 755 | 40 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 756 | 40 | } | 757 | 62 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 758 | 62 | sizeof(typename ToFieldType::NativeType)), | 759 | 62 | FromFieldType, typename ToFieldType::NativeType>; | 760 | 62 | MaxNativeType scale_multiplier = | 761 | 62 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 762 | 62 | typename ToFieldType::NativeType max_result = | 763 | 62 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 764 | 62 | typename ToFieldType::NativeType min_result = -max_result; | 765 | | | 766 | 62 | ColumnUInt8::MutablePtr col_null_map_to; | 767 | 62 | NullMap::value_type* null_map_data = nullptr; | 768 | 62 | if (narrow_integral) { | 769 | 60 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 770 | 60 | null_map_data = col_null_map_to->get_data().data(); | 771 | 60 | } | 772 | | | 773 | 62 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 774 | 62 | const auto& vec_from = col_from->get_data(); | 775 | 62 | const auto* vec_from_data = vec_from.data(); | 776 | 62 | auto& vec_to = col_to->get_data(); | 777 | 62 | auto* vec_to_data = vec_to.data(); | 778 | | | 779 | 62 | CastParameters params; | 780 | 62 | params.is_strict = (CastMode == CastModeType::StrictMode); | 781 | 62 | size_t size = vec_from.size(); | 782 | | | 783 | 62 | RETURN_IF_ERROR(std::visit( | 784 | 62 | [&](auto multiply_may_overflow, auto narrow_integral) { | 785 | 62 | for (size_t i = 0; i < size; i++) { | 786 | 62 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 787 | 62 | typename ToDataType::FieldType, | 788 | 62 | multiply_may_overflow, narrow_integral>( | 789 | 62 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 790 | 62 | scale_multiplier, min_result, max_result, params)) { | 791 | 62 | if (set_nullable) { | 792 | 62 | null_map_data[i] = 1; | 793 | 62 | } else { | 794 | 62 | return params.status; | 795 | 62 | } | 796 | 62 | } | 797 | 62 | } | 798 | 62 | return Status::OK(); | 799 | 62 | }, | 800 | 62 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 801 | | | 802 | 14 | if (narrow_integral) { | 803 | 12 | block.get_by_position(result).column = | 804 | 12 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 805 | 12 | } else { | 806 | 2 | block.get_by_position(result).column = std::move(col_to); | 807 | 2 | } | 808 | 14 | return Status::OK(); | 809 | 62 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE5EEENS_15DataTypeDecimalILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 723 | 26 | const NullMap::value_type* null_map = nullptr) const override { | 724 | 26 | using FromFieldType = typename FromDataType::FieldType; | 725 | 26 | using ToFieldType = typename ToDataType::FieldType; | 726 | 26 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 727 | 26 | const auto* col_from = | 728 | 26 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 729 | 26 | if (!col_from) { | 730 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 731 | 0 | named_from.column->get_name()); | 732 | 0 | } | 733 | | | 734 | 26 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 735 | 26 | constexpr UInt32 from_scale = 0; | 736 | | | 737 | 26 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 738 | 26 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 739 | 26 | UInt32 to_precision = to_decimal_type.get_precision(); | 740 | 26 | ToDataType::check_type_precision(to_precision); | 741 | 26 | UInt32 to_scale = to_decimal_type.get_scale(); | 742 | 26 | ToDataType::check_type_scale(to_scale); | 743 | | | 744 | 26 | auto from_max_int_digit_count = from_precision - from_scale; | 745 | 26 | auto to_max_int_digit_count = to_precision - to_scale; | 746 | | // may overflow. nullable result column. | 747 | 26 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 748 | | // only in non-strict mode and may overflow, we set nullable | 749 | 26 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 750 | | | 751 | 26 | constexpr UInt32 to_max_digits = | 752 | 26 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 753 | 26 | bool multiply_may_overflow = false; | 754 | 26 | if (to_scale > from_scale) { | 755 | 16 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 756 | 16 | } | 757 | 26 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 758 | 26 | sizeof(typename ToFieldType::NativeType)), | 759 | 26 | FromFieldType, typename ToFieldType::NativeType>; | 760 | 26 | MaxNativeType scale_multiplier = | 761 | 26 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 762 | 26 | typename ToFieldType::NativeType max_result = | 763 | 26 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 764 | 26 | typename ToFieldType::NativeType min_result = -max_result; | 765 | | | 766 | 26 | ColumnUInt8::MutablePtr col_null_map_to; | 767 | 26 | NullMap::value_type* null_map_data = nullptr; | 768 | 26 | if (narrow_integral) { | 769 | 24 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 770 | 24 | null_map_data = col_null_map_to->get_data().data(); | 771 | 24 | } | 772 | | | 773 | 26 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 774 | 26 | const auto& vec_from = col_from->get_data(); | 775 | 26 | const auto* vec_from_data = vec_from.data(); | 776 | 26 | auto& vec_to = col_to->get_data(); | 777 | 26 | auto* vec_to_data = vec_to.data(); | 778 | | | 779 | 26 | CastParameters params; | 780 | 26 | params.is_strict = (CastMode == CastModeType::StrictMode); | 781 | 26 | size_t size = vec_from.size(); | 782 | | | 783 | 26 | RETURN_IF_ERROR(std::visit( | 784 | 26 | [&](auto multiply_may_overflow, auto narrow_integral) { | 785 | 26 | for (size_t i = 0; i < size; i++) { | 786 | 26 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 787 | 26 | typename ToDataType::FieldType, | 788 | 26 | multiply_may_overflow, narrow_integral>( | 789 | 26 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 790 | 26 | scale_multiplier, min_result, max_result, params)) { | 791 | 26 | if (set_nullable) { | 792 | 26 | null_map_data[i] = 1; | 793 | 26 | } else { | 794 | 26 | return params.status; | 795 | 26 | } | 796 | 26 | } | 797 | 26 | } | 798 | 26 | return Status::OK(); | 799 | 26 | }, | 800 | 26 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 801 | | | 802 | 26 | if (narrow_integral) { | 803 | 24 | block.get_by_position(result).column = | 804 | 24 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 805 | 24 | } else { | 806 | 2 | block.get_by_position(result).column = std::move(col_to); | 807 | 2 | } | 808 | 26 | return Status::OK(); | 809 | 26 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE6EEENS_15DataTypeDecimalILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 723 | 70 | const NullMap::value_type* null_map = nullptr) const override { | 724 | 70 | using FromFieldType = typename FromDataType::FieldType; | 725 | 70 | using ToFieldType = typename ToDataType::FieldType; | 726 | 70 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 727 | 70 | const auto* col_from = | 728 | 70 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 729 | 70 | if (!col_from) { | 730 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 731 | 0 | named_from.column->get_name()); | 732 | 0 | } | 733 | | | 734 | 70 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 735 | 70 | constexpr UInt32 from_scale = 0; | 736 | | | 737 | 70 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 738 | 70 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 739 | 70 | UInt32 to_precision = to_decimal_type.get_precision(); | 740 | 70 | ToDataType::check_type_precision(to_precision); | 741 | 70 | UInt32 to_scale = to_decimal_type.get_scale(); | 742 | 70 | ToDataType::check_type_scale(to_scale); | 743 | | | 744 | 70 | auto from_max_int_digit_count = from_precision - from_scale; | 745 | 70 | auto to_max_int_digit_count = to_precision - to_scale; | 746 | | // may overflow. nullable result column. | 747 | 70 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 748 | | // only in non-strict mode and may overflow, we set nullable | 749 | 70 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 750 | | | 751 | 70 | constexpr UInt32 to_max_digits = | 752 | 70 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 753 | 70 | bool multiply_may_overflow = false; | 754 | 70 | if (to_scale > from_scale) { | 755 | 40 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 756 | 40 | } | 757 | 70 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 758 | 70 | sizeof(typename ToFieldType::NativeType)), | 759 | 70 | FromFieldType, typename ToFieldType::NativeType>; | 760 | 70 | MaxNativeType scale_multiplier = | 761 | 70 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 762 | 70 | typename ToFieldType::NativeType max_result = | 763 | 70 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 764 | 70 | typename ToFieldType::NativeType min_result = -max_result; | 765 | | | 766 | 70 | ColumnUInt8::MutablePtr col_null_map_to; | 767 | 70 | NullMap::value_type* null_map_data = nullptr; | 768 | 70 | if (narrow_integral) { | 769 | 70 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 770 | 70 | null_map_data = col_null_map_to->get_data().data(); | 771 | 70 | } | 772 | | | 773 | 70 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 774 | 70 | const auto& vec_from = col_from->get_data(); | 775 | 70 | const auto* vec_from_data = vec_from.data(); | 776 | 70 | auto& vec_to = col_to->get_data(); | 777 | 70 | auto* vec_to_data = vec_to.data(); | 778 | | | 779 | 70 | CastParameters params; | 780 | 70 | params.is_strict = (CastMode == CastModeType::StrictMode); | 781 | 70 | size_t size = vec_from.size(); | 782 | | | 783 | 70 | RETURN_IF_ERROR(std::visit( | 784 | 70 | [&](auto multiply_may_overflow, auto narrow_integral) { | 785 | 70 | for (size_t i = 0; i < size; i++) { | 786 | 70 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 787 | 70 | typename ToDataType::FieldType, | 788 | 70 | multiply_may_overflow, narrow_integral>( | 789 | 70 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 790 | 70 | scale_multiplier, min_result, max_result, params)) { | 791 | 70 | if (set_nullable) { | 792 | 70 | null_map_data[i] = 1; | 793 | 70 | } else { | 794 | 70 | return params.status; | 795 | 70 | } | 796 | 70 | } | 797 | 70 | } | 798 | 70 | return Status::OK(); | 799 | 70 | }, | 800 | 70 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 801 | | | 802 | 14 | if (narrow_integral) { | 803 | 14 | block.get_by_position(result).column = | 804 | 14 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 805 | 14 | } else { | 806 | 0 | block.get_by_position(result).column = std::move(col_to); | 807 | 0 | } | 808 | 14 | return Status::OK(); | 809 | 70 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE6EEENS_15DataTypeDecimalILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 723 | 28 | const NullMap::value_type* null_map = nullptr) const override { | 724 | 28 | using FromFieldType = typename FromDataType::FieldType; | 725 | 28 | using ToFieldType = typename ToDataType::FieldType; | 726 | 28 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 727 | 28 | const auto* col_from = | 728 | 28 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 729 | 28 | if (!col_from) { | 730 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 731 | 0 | named_from.column->get_name()); | 732 | 0 | } | 733 | | | 734 | 28 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 735 | 28 | constexpr UInt32 from_scale = 0; | 736 | | | 737 | 28 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 738 | 28 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 739 | 28 | UInt32 to_precision = to_decimal_type.get_precision(); | 740 | 28 | ToDataType::check_type_precision(to_precision); | 741 | 28 | UInt32 to_scale = to_decimal_type.get_scale(); | 742 | 28 | ToDataType::check_type_scale(to_scale); | 743 | | | 744 | 28 | auto from_max_int_digit_count = from_precision - from_scale; | 745 | 28 | auto to_max_int_digit_count = to_precision - to_scale; | 746 | | // may overflow. nullable result column. | 747 | 28 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 748 | | // only in non-strict mode and may overflow, we set nullable | 749 | 28 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 750 | | | 751 | 28 | constexpr UInt32 to_max_digits = | 752 | 28 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 753 | 28 | bool multiply_may_overflow = false; | 754 | 28 | if (to_scale > from_scale) { | 755 | 16 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 756 | 16 | } | 757 | 28 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 758 | 28 | sizeof(typename ToFieldType::NativeType)), | 759 | 28 | FromFieldType, typename ToFieldType::NativeType>; | 760 | 28 | MaxNativeType scale_multiplier = | 761 | 28 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 762 | 28 | typename ToFieldType::NativeType max_result = | 763 | 28 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 764 | 28 | typename ToFieldType::NativeType min_result = -max_result; | 765 | | | 766 | 28 | ColumnUInt8::MutablePtr col_null_map_to; | 767 | 28 | NullMap::value_type* null_map_data = nullptr; | 768 | 28 | if (narrow_integral) { | 769 | 28 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 770 | 28 | null_map_data = col_null_map_to->get_data().data(); | 771 | 28 | } | 772 | | | 773 | 28 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 774 | 28 | const auto& vec_from = col_from->get_data(); | 775 | 28 | const auto* vec_from_data = vec_from.data(); | 776 | 28 | auto& vec_to = col_to->get_data(); | 777 | 28 | auto* vec_to_data = vec_to.data(); | 778 | | | 779 | 28 | CastParameters params; | 780 | 28 | params.is_strict = (CastMode == CastModeType::StrictMode); | 781 | 28 | size_t size = vec_from.size(); | 782 | | | 783 | 28 | RETURN_IF_ERROR(std::visit( | 784 | 28 | [&](auto multiply_may_overflow, auto narrow_integral) { | 785 | 28 | for (size_t i = 0; i < size; i++) { | 786 | 28 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 787 | 28 | typename ToDataType::FieldType, | 788 | 28 | multiply_may_overflow, narrow_integral>( | 789 | 28 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 790 | 28 | scale_multiplier, min_result, max_result, params)) { | 791 | 28 | if (set_nullable) { | 792 | 28 | null_map_data[i] = 1; | 793 | 28 | } else { | 794 | 28 | return params.status; | 795 | 28 | } | 796 | 28 | } | 797 | 28 | } | 798 | 28 | return Status::OK(); | 799 | 28 | }, | 800 | 28 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 801 | | | 802 | 28 | if (narrow_integral) { | 803 | 28 | block.get_by_position(result).column = | 804 | 28 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 805 | 28 | } else { | 806 | 0 | block.get_by_position(result).column = std::move(col_to); | 807 | 0 | } | 808 | 28 | return Status::OK(); | 809 | 28 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE7EEENS_15DataTypeDecimalILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 723 | 70 | const NullMap::value_type* null_map = nullptr) const override { | 724 | 70 | using FromFieldType = typename FromDataType::FieldType; | 725 | 70 | using ToFieldType = typename ToDataType::FieldType; | 726 | 70 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 727 | 70 | const auto* col_from = | 728 | 70 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 729 | 70 | if (!col_from) { | 730 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 731 | 0 | named_from.column->get_name()); | 732 | 0 | } | 733 | | | 734 | 70 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 735 | 70 | constexpr UInt32 from_scale = 0; | 736 | | | 737 | 70 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 738 | 70 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 739 | 70 | UInt32 to_precision = to_decimal_type.get_precision(); | 740 | 70 | ToDataType::check_type_precision(to_precision); | 741 | 70 | UInt32 to_scale = to_decimal_type.get_scale(); | 742 | 70 | ToDataType::check_type_scale(to_scale); | 743 | | | 744 | 70 | auto from_max_int_digit_count = from_precision - from_scale; | 745 | 70 | auto to_max_int_digit_count = to_precision - to_scale; | 746 | | // may overflow. nullable result column. | 747 | 70 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 748 | | // only in non-strict mode and may overflow, we set nullable | 749 | 70 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 750 | | | 751 | 70 | constexpr UInt32 to_max_digits = | 752 | 70 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 753 | 70 | bool multiply_may_overflow = false; | 754 | 70 | if (to_scale > from_scale) { | 755 | 40 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 756 | 40 | } | 757 | 70 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 758 | 70 | sizeof(typename ToFieldType::NativeType)), | 759 | 70 | FromFieldType, typename ToFieldType::NativeType>; | 760 | 70 | MaxNativeType scale_multiplier = | 761 | 70 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 762 | 70 | typename ToFieldType::NativeType max_result = | 763 | 70 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 764 | 70 | typename ToFieldType::NativeType min_result = -max_result; | 765 | | | 766 | 70 | ColumnUInt8::MutablePtr col_null_map_to; | 767 | 70 | NullMap::value_type* null_map_data = nullptr; | 768 | 70 | if (narrow_integral) { | 769 | 70 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 770 | 70 | null_map_data = col_null_map_to->get_data().data(); | 771 | 70 | } | 772 | | | 773 | 70 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 774 | 70 | const auto& vec_from = col_from->get_data(); | 775 | 70 | const auto* vec_from_data = vec_from.data(); | 776 | 70 | auto& vec_to = col_to->get_data(); | 777 | 70 | auto* vec_to_data = vec_to.data(); | 778 | | | 779 | 70 | CastParameters params; | 780 | 70 | params.is_strict = (CastMode == CastModeType::StrictMode); | 781 | 70 | size_t size = vec_from.size(); | 782 | | | 783 | 70 | RETURN_IF_ERROR(std::visit( | 784 | 70 | [&](auto multiply_may_overflow, auto narrow_integral) { | 785 | 70 | for (size_t i = 0; i < size; i++) { | 786 | 70 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 787 | 70 | typename ToDataType::FieldType, | 788 | 70 | multiply_may_overflow, narrow_integral>( | 789 | 70 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 790 | 70 | scale_multiplier, min_result, max_result, params)) { | 791 | 70 | if (set_nullable) { | 792 | 70 | null_map_data[i] = 1; | 793 | 70 | } else { | 794 | 70 | return params.status; | 795 | 70 | } | 796 | 70 | } | 797 | 70 | } | 798 | 70 | return Status::OK(); | 799 | 70 | }, | 800 | 70 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 801 | | | 802 | 14 | if (narrow_integral) { | 803 | 14 | block.get_by_position(result).column = | 804 | 14 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 805 | 14 | } else { | 806 | 0 | block.get_by_position(result).column = std::move(col_to); | 807 | 0 | } | 808 | 14 | return Status::OK(); | 809 | 70 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE7EEENS_15DataTypeDecimalILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 723 | 28 | const NullMap::value_type* null_map = nullptr) const override { | 724 | 28 | using FromFieldType = typename FromDataType::FieldType; | 725 | 28 | using ToFieldType = typename ToDataType::FieldType; | 726 | 28 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 727 | 28 | const auto* col_from = | 728 | 28 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 729 | 28 | if (!col_from) { | 730 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 731 | 0 | named_from.column->get_name()); | 732 | 0 | } | 733 | | | 734 | 28 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 735 | 28 | constexpr UInt32 from_scale = 0; | 736 | | | 737 | 28 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 738 | 28 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 739 | 28 | UInt32 to_precision = to_decimal_type.get_precision(); | 740 | 28 | ToDataType::check_type_precision(to_precision); | 741 | 28 | UInt32 to_scale = to_decimal_type.get_scale(); | 742 | 28 | ToDataType::check_type_scale(to_scale); | 743 | | | 744 | 28 | auto from_max_int_digit_count = from_precision - from_scale; | 745 | 28 | auto to_max_int_digit_count = to_precision - to_scale; | 746 | | // may overflow. nullable result column. | 747 | 28 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 748 | | // only in non-strict mode and may overflow, we set nullable | 749 | 28 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 750 | | | 751 | 28 | constexpr UInt32 to_max_digits = | 752 | 28 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 753 | 28 | bool multiply_may_overflow = false; | 754 | 28 | if (to_scale > from_scale) { | 755 | 16 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 756 | 16 | } | 757 | 28 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 758 | 28 | sizeof(typename ToFieldType::NativeType)), | 759 | 28 | FromFieldType, typename ToFieldType::NativeType>; | 760 | 28 | MaxNativeType scale_multiplier = | 761 | 28 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 762 | 28 | typename ToFieldType::NativeType max_result = | 763 | 28 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 764 | 28 | typename ToFieldType::NativeType min_result = -max_result; | 765 | | | 766 | 28 | ColumnUInt8::MutablePtr col_null_map_to; | 767 | 28 | NullMap::value_type* null_map_data = nullptr; | 768 | 28 | if (narrow_integral) { | 769 | 28 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 770 | 28 | null_map_data = col_null_map_to->get_data().data(); | 771 | 28 | } | 772 | | | 773 | 28 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 774 | 28 | const auto& vec_from = col_from->get_data(); | 775 | 28 | const auto* vec_from_data = vec_from.data(); | 776 | 28 | auto& vec_to = col_to->get_data(); | 777 | 28 | auto* vec_to_data = vec_to.data(); | 778 | | | 779 | 28 | CastParameters params; | 780 | 28 | params.is_strict = (CastMode == CastModeType::StrictMode); | 781 | 28 | size_t size = vec_from.size(); | 782 | | | 783 | 28 | RETURN_IF_ERROR(std::visit( | 784 | 28 | [&](auto multiply_may_overflow, auto narrow_integral) { | 785 | 28 | for (size_t i = 0; i < size; i++) { | 786 | 28 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 787 | 28 | typename ToDataType::FieldType, | 788 | 28 | multiply_may_overflow, narrow_integral>( | 789 | 28 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 790 | 28 | scale_multiplier, min_result, max_result, params)) { | 791 | 28 | if (set_nullable) { | 792 | 28 | null_map_data[i] = 1; | 793 | 28 | } else { | 794 | 28 | return params.status; | 795 | 28 | } | 796 | 28 | } | 797 | 28 | } | 798 | 28 | return Status::OK(); | 799 | 28 | }, | 800 | 28 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 801 | | | 802 | 28 | if (narrow_integral) { | 803 | 28 | block.get_by_position(result).column = | 804 | 28 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 805 | 28 | } else { | 806 | 0 | block.get_by_position(result).column = std::move(col_to); | 807 | 0 | } | 808 | 28 | return Status::OK(); | 809 | 28 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE2EEENS_15DataTypeDecimalILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 723 | 4 | const NullMap::value_type* null_map = nullptr) const override { | 724 | 4 | using FromFieldType = typename FromDataType::FieldType; | 725 | 4 | using ToFieldType = typename ToDataType::FieldType; | 726 | 4 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 727 | 4 | const auto* col_from = | 728 | 4 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 729 | 4 | if (!col_from) { | 730 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 731 | 0 | named_from.column->get_name()); | 732 | 0 | } | 733 | | | 734 | 4 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 735 | 4 | constexpr UInt32 from_scale = 0; | 736 | | | 737 | 4 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 738 | 4 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 739 | 4 | UInt32 to_precision = to_decimal_type.get_precision(); | 740 | 4 | ToDataType::check_type_precision(to_precision); | 741 | 4 | UInt32 to_scale = to_decimal_type.get_scale(); | 742 | 4 | ToDataType::check_type_scale(to_scale); | 743 | | | 744 | 4 | auto from_max_int_digit_count = from_precision - from_scale; | 745 | 4 | auto to_max_int_digit_count = to_precision - to_scale; | 746 | | // may overflow. nullable result column. | 747 | 4 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 748 | | // only in non-strict mode and may overflow, we set nullable | 749 | 4 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 750 | | | 751 | 4 | constexpr UInt32 to_max_digits = | 752 | 4 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 753 | 4 | bool multiply_may_overflow = false; | 754 | 4 | if (to_scale > from_scale) { | 755 | 4 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 756 | 4 | } | 757 | 4 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 758 | 4 | sizeof(typename ToFieldType::NativeType)), | 759 | 4 | FromFieldType, typename ToFieldType::NativeType>; | 760 | 4 | MaxNativeType scale_multiplier = | 761 | 4 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 762 | 4 | typename ToFieldType::NativeType max_result = | 763 | 4 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 764 | 4 | typename ToFieldType::NativeType min_result = -max_result; | 765 | | | 766 | 4 | ColumnUInt8::MutablePtr col_null_map_to; | 767 | 4 | NullMap::value_type* null_map_data = nullptr; | 768 | 4 | if (narrow_integral) { | 769 | 4 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 770 | 4 | null_map_data = col_null_map_to->get_data().data(); | 771 | 4 | } | 772 | | | 773 | 4 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 774 | 4 | const auto& vec_from = col_from->get_data(); | 775 | 4 | const auto* vec_from_data = vec_from.data(); | 776 | 4 | auto& vec_to = col_to->get_data(); | 777 | 4 | auto* vec_to_data = vec_to.data(); | 778 | | | 779 | 4 | CastParameters params; | 780 | 4 | params.is_strict = (CastMode == CastModeType::StrictMode); | 781 | 4 | size_t size = vec_from.size(); | 782 | | | 783 | 4 | RETURN_IF_ERROR(std::visit( | 784 | 4 | [&](auto multiply_may_overflow, auto narrow_integral) { | 785 | 4 | for (size_t i = 0; i < size; i++) { | 786 | 4 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 787 | 4 | typename ToDataType::FieldType, | 788 | 4 | multiply_may_overflow, narrow_integral>( | 789 | 4 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 790 | 4 | scale_multiplier, min_result, max_result, params)) { | 791 | 4 | if (set_nullable) { | 792 | 4 | null_map_data[i] = 1; | 793 | 4 | } else { | 794 | 4 | return params.status; | 795 | 4 | } | 796 | 4 | } | 797 | 4 | } | 798 | 4 | return Status::OK(); | 799 | 4 | }, | 800 | 4 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 801 | | | 802 | 2 | if (narrow_integral) { | 803 | 2 | block.get_by_position(result).column = | 804 | 2 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 805 | 2 | } else { | 806 | 0 | block.get_by_position(result).column = std::move(col_to); | 807 | 0 | } | 808 | 2 | return Status::OK(); | 809 | 4 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE2EEENS_15DataTypeDecimalILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 723 | 10 | const NullMap::value_type* null_map = nullptr) const override { | 724 | 10 | using FromFieldType = typename FromDataType::FieldType; | 725 | 10 | using ToFieldType = typename ToDataType::FieldType; | 726 | 10 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 727 | 10 | const auto* col_from = | 728 | 10 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 729 | 10 | if (!col_from) { | 730 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 731 | 0 | named_from.column->get_name()); | 732 | 0 | } | 733 | | | 734 | 10 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 735 | 10 | constexpr UInt32 from_scale = 0; | 736 | | | 737 | 10 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 738 | 10 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 739 | 10 | UInt32 to_precision = to_decimal_type.get_precision(); | 740 | 10 | ToDataType::check_type_precision(to_precision); | 741 | 10 | UInt32 to_scale = to_decimal_type.get_scale(); | 742 | 10 | ToDataType::check_type_scale(to_scale); | 743 | | | 744 | 10 | auto from_max_int_digit_count = from_precision - from_scale; | 745 | 10 | auto to_max_int_digit_count = to_precision - to_scale; | 746 | | // may overflow. nullable result column. | 747 | 10 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 748 | | // only in non-strict mode and may overflow, we set nullable | 749 | 10 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 750 | | | 751 | 10 | constexpr UInt32 to_max_digits = | 752 | 10 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 753 | 10 | bool multiply_may_overflow = false; | 754 | 10 | if (to_scale > from_scale) { | 755 | 8 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 756 | 8 | } | 757 | 10 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 758 | 10 | sizeof(typename ToFieldType::NativeType)), | 759 | 10 | FromFieldType, typename ToFieldType::NativeType>; | 760 | 10 | MaxNativeType scale_multiplier = | 761 | 10 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 762 | 10 | typename ToFieldType::NativeType max_result = | 763 | 10 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 764 | 10 | typename ToFieldType::NativeType min_result = -max_result; | 765 | | | 766 | 10 | ColumnUInt8::MutablePtr col_null_map_to; | 767 | 10 | NullMap::value_type* null_map_data = nullptr; | 768 | 10 | if (narrow_integral) { | 769 | 2 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 770 | 2 | null_map_data = col_null_map_to->get_data().data(); | 771 | 2 | } | 772 | | | 773 | 10 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 774 | 10 | const auto& vec_from = col_from->get_data(); | 775 | 10 | const auto* vec_from_data = vec_from.data(); | 776 | 10 | auto& vec_to = col_to->get_data(); | 777 | 10 | auto* vec_to_data = vec_to.data(); | 778 | | | 779 | 10 | CastParameters params; | 780 | 10 | params.is_strict = (CastMode == CastModeType::StrictMode); | 781 | 10 | size_t size = vec_from.size(); | 782 | | | 783 | 10 | RETURN_IF_ERROR(std::visit( | 784 | 10 | [&](auto multiply_may_overflow, auto narrow_integral) { | 785 | 10 | for (size_t i = 0; i < size; i++) { | 786 | 10 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 787 | 10 | typename ToDataType::FieldType, | 788 | 10 | multiply_may_overflow, narrow_integral>( | 789 | 10 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 790 | 10 | scale_multiplier, min_result, max_result, params)) { | 791 | 10 | if (set_nullable) { | 792 | 10 | null_map_data[i] = 1; | 793 | 10 | } else { | 794 | 10 | return params.status; | 795 | 10 | } | 796 | 10 | } | 797 | 10 | } | 798 | 10 | return Status::OK(); | 799 | 10 | }, | 800 | 10 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 801 | | | 802 | 10 | if (narrow_integral) { | 803 | 2 | block.get_by_position(result).column = | 804 | 2 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 805 | 8 | } else { | 806 | 8 | block.get_by_position(result).column = std::move(col_to); | 807 | 8 | } | 808 | 10 | return Status::OK(); | 809 | 10 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE3EEENS_15DataTypeDecimalILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 723 | 38 | const NullMap::value_type* null_map = nullptr) const override { | 724 | 38 | using FromFieldType = typename FromDataType::FieldType; | 725 | 38 | using ToFieldType = typename ToDataType::FieldType; | 726 | 38 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 727 | 38 | const auto* col_from = | 728 | 38 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 729 | 38 | if (!col_from) { | 730 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 731 | 0 | named_from.column->get_name()); | 732 | 0 | } | 733 | | | 734 | 38 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 735 | 38 | constexpr UInt32 from_scale = 0; | 736 | | | 737 | 38 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 738 | 38 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 739 | 38 | UInt32 to_precision = to_decimal_type.get_precision(); | 740 | 38 | ToDataType::check_type_precision(to_precision); | 741 | 38 | UInt32 to_scale = to_decimal_type.get_scale(); | 742 | 38 | ToDataType::check_type_scale(to_scale); | 743 | | | 744 | 38 | auto from_max_int_digit_count = from_precision - from_scale; | 745 | 38 | auto to_max_int_digit_count = to_precision - to_scale; | 746 | | // may overflow. nullable result column. | 747 | 38 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 748 | | // only in non-strict mode and may overflow, we set nullable | 749 | 38 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 750 | | | 751 | 38 | constexpr UInt32 to_max_digits = | 752 | 38 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 753 | 38 | bool multiply_may_overflow = false; | 754 | 38 | if (to_scale > from_scale) { | 755 | 24 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 756 | 24 | } | 757 | 38 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 758 | 38 | sizeof(typename ToFieldType::NativeType)), | 759 | 38 | FromFieldType, typename ToFieldType::NativeType>; | 760 | 38 | MaxNativeType scale_multiplier = | 761 | 38 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 762 | 38 | typename ToFieldType::NativeType max_result = | 763 | 38 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 764 | 38 | typename ToFieldType::NativeType min_result = -max_result; | 765 | | | 766 | 38 | ColumnUInt8::MutablePtr col_null_map_to; | 767 | 38 | NullMap::value_type* null_map_data = nullptr; | 768 | 38 | if (narrow_integral) { | 769 | 30 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 770 | 30 | null_map_data = col_null_map_to->get_data().data(); | 771 | 30 | } | 772 | | | 773 | 38 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 774 | 38 | const auto& vec_from = col_from->get_data(); | 775 | 38 | const auto* vec_from_data = vec_from.data(); | 776 | 38 | auto& vec_to = col_to->get_data(); | 777 | 38 | auto* vec_to_data = vec_to.data(); | 778 | | | 779 | 38 | CastParameters params; | 780 | 38 | params.is_strict = (CastMode == CastModeType::StrictMode); | 781 | 38 | size_t size = vec_from.size(); | 782 | | | 783 | 38 | RETURN_IF_ERROR(std::visit( | 784 | 38 | [&](auto multiply_may_overflow, auto narrow_integral) { | 785 | 38 | for (size_t i = 0; i < size; i++) { | 786 | 38 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 787 | 38 | typename ToDataType::FieldType, | 788 | 38 | multiply_may_overflow, narrow_integral>( | 789 | 38 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 790 | 38 | scale_multiplier, min_result, max_result, params)) { | 791 | 38 | if (set_nullable) { | 792 | 38 | null_map_data[i] = 1; | 793 | 38 | } else { | 794 | 38 | return params.status; | 795 | 38 | } | 796 | 38 | } | 797 | 38 | } | 798 | 38 | return Status::OK(); | 799 | 38 | }, | 800 | 38 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 801 | | | 802 | 14 | if (narrow_integral) { | 803 | 6 | block.get_by_position(result).column = | 804 | 6 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 805 | 8 | } else { | 806 | 8 | block.get_by_position(result).column = std::move(col_to); | 807 | 8 | } | 808 | 14 | return Status::OK(); | 809 | 38 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE3EEENS_15DataTypeDecimalILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 723 | 20 | const NullMap::value_type* null_map = nullptr) const override { | 724 | 20 | using FromFieldType = typename FromDataType::FieldType; | 725 | 20 | using ToFieldType = typename ToDataType::FieldType; | 726 | 20 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 727 | 20 | const auto* col_from = | 728 | 20 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 729 | 20 | if (!col_from) { | 730 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 731 | 0 | named_from.column->get_name()); | 732 | 0 | } | 733 | | | 734 | 20 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 735 | 20 | constexpr UInt32 from_scale = 0; | 736 | | | 737 | 20 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 738 | 20 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 739 | 20 | UInt32 to_precision = to_decimal_type.get_precision(); | 740 | 20 | ToDataType::check_type_precision(to_precision); | 741 | 20 | UInt32 to_scale = to_decimal_type.get_scale(); | 742 | 20 | ToDataType::check_type_scale(to_scale); | 743 | | | 744 | 20 | auto from_max_int_digit_count = from_precision - from_scale; | 745 | 20 | auto to_max_int_digit_count = to_precision - to_scale; | 746 | | // may overflow. nullable result column. | 747 | 20 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 748 | | // only in non-strict mode and may overflow, we set nullable | 749 | 20 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 750 | | | 751 | 20 | constexpr UInt32 to_max_digits = | 752 | 20 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 753 | 20 | bool multiply_may_overflow = false; | 754 | 20 | if (to_scale > from_scale) { | 755 | 12 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 756 | 12 | } | 757 | 20 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 758 | 20 | sizeof(typename ToFieldType::NativeType)), | 759 | 20 | FromFieldType, typename ToFieldType::NativeType>; | 760 | 20 | MaxNativeType scale_multiplier = | 761 | 20 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 762 | 20 | typename ToFieldType::NativeType max_result = | 763 | 20 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 764 | 20 | typename ToFieldType::NativeType min_result = -max_result; | 765 | | | 766 | 20 | ColumnUInt8::MutablePtr col_null_map_to; | 767 | 20 | NullMap::value_type* null_map_data = nullptr; | 768 | 20 | if (narrow_integral) { | 769 | 12 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 770 | 12 | null_map_data = col_null_map_to->get_data().data(); | 771 | 12 | } | 772 | | | 773 | 20 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 774 | 20 | const auto& vec_from = col_from->get_data(); | 775 | 20 | const auto* vec_from_data = vec_from.data(); | 776 | 20 | auto& vec_to = col_to->get_data(); | 777 | 20 | auto* vec_to_data = vec_to.data(); | 778 | | | 779 | 20 | CastParameters params; | 780 | 20 | params.is_strict = (CastMode == CastModeType::StrictMode); | 781 | 20 | size_t size = vec_from.size(); | 782 | | | 783 | 20 | RETURN_IF_ERROR(std::visit( | 784 | 20 | [&](auto multiply_may_overflow, auto narrow_integral) { | 785 | 20 | for (size_t i = 0; i < size; i++) { | 786 | 20 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 787 | 20 | typename ToDataType::FieldType, | 788 | 20 | multiply_may_overflow, narrow_integral>( | 789 | 20 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 790 | 20 | scale_multiplier, min_result, max_result, params)) { | 791 | 20 | if (set_nullable) { | 792 | 20 | null_map_data[i] = 1; | 793 | 20 | } else { | 794 | 20 | return params.status; | 795 | 20 | } | 796 | 20 | } | 797 | 20 | } | 798 | 20 | return Status::OK(); | 799 | 20 | }, | 800 | 20 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 801 | | | 802 | 20 | if (narrow_integral) { | 803 | 12 | block.get_by_position(result).column = | 804 | 12 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 805 | 12 | } else { | 806 | 8 | block.get_by_position(result).column = std::move(col_to); | 807 | 8 | } | 808 | 20 | return Status::OK(); | 809 | 20 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE4EEENS_15DataTypeDecimalILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 723 | 38 | const NullMap::value_type* null_map = nullptr) const override { | 724 | 38 | using FromFieldType = typename FromDataType::FieldType; | 725 | 38 | using ToFieldType = typename ToDataType::FieldType; | 726 | 38 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 727 | 38 | const auto* col_from = | 728 | 38 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 729 | 38 | if (!col_from) { | 730 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 731 | 0 | named_from.column->get_name()); | 732 | 0 | } | 733 | | | 734 | 38 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 735 | 38 | constexpr UInt32 from_scale = 0; | 736 | | | 737 | 38 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 738 | 38 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 739 | 38 | UInt32 to_precision = to_decimal_type.get_precision(); | 740 | 38 | ToDataType::check_type_precision(to_precision); | 741 | 38 | UInt32 to_scale = to_decimal_type.get_scale(); | 742 | 38 | ToDataType::check_type_scale(to_scale); | 743 | | | 744 | 38 | auto from_max_int_digit_count = from_precision - from_scale; | 745 | 38 | auto to_max_int_digit_count = to_precision - to_scale; | 746 | | // may overflow. nullable result column. | 747 | 38 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 748 | | // only in non-strict mode and may overflow, we set nullable | 749 | 38 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 750 | | | 751 | 38 | constexpr UInt32 to_max_digits = | 752 | 38 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 753 | 38 | bool multiply_may_overflow = false; | 754 | 38 | if (to_scale > from_scale) { | 755 | 24 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 756 | 24 | } | 757 | 38 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 758 | 38 | sizeof(typename ToFieldType::NativeType)), | 759 | 38 | FromFieldType, typename ToFieldType::NativeType>; | 760 | 38 | MaxNativeType scale_multiplier = | 761 | 38 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 762 | 38 | typename ToFieldType::NativeType max_result = | 763 | 38 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 764 | 38 | typename ToFieldType::NativeType min_result = -max_result; | 765 | | | 766 | 38 | ColumnUInt8::MutablePtr col_null_map_to; | 767 | 38 | NullMap::value_type* null_map_data = nullptr; | 768 | 38 | if (narrow_integral) { | 769 | 30 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 770 | 30 | null_map_data = col_null_map_to->get_data().data(); | 771 | 30 | } | 772 | | | 773 | 38 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 774 | 38 | const auto& vec_from = col_from->get_data(); | 775 | 38 | const auto* vec_from_data = vec_from.data(); | 776 | 38 | auto& vec_to = col_to->get_data(); | 777 | 38 | auto* vec_to_data = vec_to.data(); | 778 | | | 779 | 38 | CastParameters params; | 780 | 38 | params.is_strict = (CastMode == CastModeType::StrictMode); | 781 | 38 | size_t size = vec_from.size(); | 782 | | | 783 | 38 | RETURN_IF_ERROR(std::visit( | 784 | 38 | [&](auto multiply_may_overflow, auto narrow_integral) { | 785 | 38 | for (size_t i = 0; i < size; i++) { | 786 | 38 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 787 | 38 | typename ToDataType::FieldType, | 788 | 38 | multiply_may_overflow, narrow_integral>( | 789 | 38 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 790 | 38 | scale_multiplier, min_result, max_result, params)) { | 791 | 38 | if (set_nullable) { | 792 | 38 | null_map_data[i] = 1; | 793 | 38 | } else { | 794 | 38 | return params.status; | 795 | 38 | } | 796 | 38 | } | 797 | 38 | } | 798 | 38 | return Status::OK(); | 799 | 38 | }, | 800 | 38 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 801 | | | 802 | 14 | if (narrow_integral) { | 803 | 6 | block.get_by_position(result).column = | 804 | 6 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 805 | 8 | } else { | 806 | 8 | block.get_by_position(result).column = std::move(col_to); | 807 | 8 | } | 808 | 14 | return Status::OK(); | 809 | 38 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE4EEENS_15DataTypeDecimalILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 723 | 20 | const NullMap::value_type* null_map = nullptr) const override { | 724 | 20 | using FromFieldType = typename FromDataType::FieldType; | 725 | 20 | using ToFieldType = typename ToDataType::FieldType; | 726 | 20 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 727 | 20 | const auto* col_from = | 728 | 20 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 729 | 20 | if (!col_from) { | 730 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 731 | 0 | named_from.column->get_name()); | 732 | 0 | } | 733 | | | 734 | 20 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 735 | 20 | constexpr UInt32 from_scale = 0; | 736 | | | 737 | 20 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 738 | 20 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 739 | 20 | UInt32 to_precision = to_decimal_type.get_precision(); | 740 | 20 | ToDataType::check_type_precision(to_precision); | 741 | 20 | UInt32 to_scale = to_decimal_type.get_scale(); | 742 | 20 | ToDataType::check_type_scale(to_scale); | 743 | | | 744 | 20 | auto from_max_int_digit_count = from_precision - from_scale; | 745 | 20 | auto to_max_int_digit_count = to_precision - to_scale; | 746 | | // may overflow. nullable result column. | 747 | 20 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 748 | | // only in non-strict mode and may overflow, we set nullable | 749 | 20 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 750 | | | 751 | 20 | constexpr UInt32 to_max_digits = | 752 | 20 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 753 | 20 | bool multiply_may_overflow = false; | 754 | 20 | if (to_scale > from_scale) { | 755 | 12 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 756 | 12 | } | 757 | 20 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 758 | 20 | sizeof(typename ToFieldType::NativeType)), | 759 | 20 | FromFieldType, typename ToFieldType::NativeType>; | 760 | 20 | MaxNativeType scale_multiplier = | 761 | 20 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 762 | 20 | typename ToFieldType::NativeType max_result = | 763 | 20 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 764 | 20 | typename ToFieldType::NativeType min_result = -max_result; | 765 | | | 766 | 20 | ColumnUInt8::MutablePtr col_null_map_to; | 767 | 20 | NullMap::value_type* null_map_data = nullptr; | 768 | 20 | if (narrow_integral) { | 769 | 12 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 770 | 12 | null_map_data = col_null_map_to->get_data().data(); | 771 | 12 | } | 772 | | | 773 | 20 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 774 | 20 | const auto& vec_from = col_from->get_data(); | 775 | 20 | const auto* vec_from_data = vec_from.data(); | 776 | 20 | auto& vec_to = col_to->get_data(); | 777 | 20 | auto* vec_to_data = vec_to.data(); | 778 | | | 779 | 20 | CastParameters params; | 780 | 20 | params.is_strict = (CastMode == CastModeType::StrictMode); | 781 | 20 | size_t size = vec_from.size(); | 782 | | | 783 | 20 | RETURN_IF_ERROR(std::visit( | 784 | 20 | [&](auto multiply_may_overflow, auto narrow_integral) { | 785 | 20 | for (size_t i = 0; i < size; i++) { | 786 | 20 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 787 | 20 | typename ToDataType::FieldType, | 788 | 20 | multiply_may_overflow, narrow_integral>( | 789 | 20 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 790 | 20 | scale_multiplier, min_result, max_result, params)) { | 791 | 20 | if (set_nullable) { | 792 | 20 | null_map_data[i] = 1; | 793 | 20 | } else { | 794 | 20 | return params.status; | 795 | 20 | } | 796 | 20 | } | 797 | 20 | } | 798 | 20 | return Status::OK(); | 799 | 20 | }, | 800 | 20 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 801 | | | 802 | 20 | if (narrow_integral) { | 803 | 12 | block.get_by_position(result).column = | 804 | 12 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 805 | 12 | } else { | 806 | 8 | block.get_by_position(result).column = std::move(col_to); | 807 | 8 | } | 808 | 20 | return Status::OK(); | 809 | 20 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE5EEENS_15DataTypeDecimalILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 723 | 38 | const NullMap::value_type* null_map = nullptr) const override { | 724 | 38 | using FromFieldType = typename FromDataType::FieldType; | 725 | 38 | using ToFieldType = typename ToDataType::FieldType; | 726 | 38 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 727 | 38 | const auto* col_from = | 728 | 38 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 729 | 38 | if (!col_from) { | 730 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 731 | 0 | named_from.column->get_name()); | 732 | 0 | } | 733 | | | 734 | 38 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 735 | 38 | constexpr UInt32 from_scale = 0; | 736 | | | 737 | 38 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 738 | 38 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 739 | 38 | UInt32 to_precision = to_decimal_type.get_precision(); | 740 | 38 | ToDataType::check_type_precision(to_precision); | 741 | 38 | UInt32 to_scale = to_decimal_type.get_scale(); | 742 | 38 | ToDataType::check_type_scale(to_scale); | 743 | | | 744 | 38 | auto from_max_int_digit_count = from_precision - from_scale; | 745 | 38 | auto to_max_int_digit_count = to_precision - to_scale; | 746 | | // may overflow. nullable result column. | 747 | 38 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 748 | | // only in non-strict mode and may overflow, we set nullable | 749 | 38 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 750 | | | 751 | 38 | constexpr UInt32 to_max_digits = | 752 | 38 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 753 | 38 | bool multiply_may_overflow = false; | 754 | 38 | if (to_scale > from_scale) { | 755 | 24 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 756 | 24 | } | 757 | 38 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 758 | 38 | sizeof(typename ToFieldType::NativeType)), | 759 | 38 | FromFieldType, typename ToFieldType::NativeType>; | 760 | 38 | MaxNativeType scale_multiplier = | 761 | 38 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 762 | 38 | typename ToFieldType::NativeType max_result = | 763 | 38 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 764 | 38 | typename ToFieldType::NativeType min_result = -max_result; | 765 | | | 766 | 38 | ColumnUInt8::MutablePtr col_null_map_to; | 767 | 38 | NullMap::value_type* null_map_data = nullptr; | 768 | 38 | if (narrow_integral) { | 769 | 30 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 770 | 30 | null_map_data = col_null_map_to->get_data().data(); | 771 | 30 | } | 772 | | | 773 | 38 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 774 | 38 | const auto& vec_from = col_from->get_data(); | 775 | 38 | const auto* vec_from_data = vec_from.data(); | 776 | 38 | auto& vec_to = col_to->get_data(); | 777 | 38 | auto* vec_to_data = vec_to.data(); | 778 | | | 779 | 38 | CastParameters params; | 780 | 38 | params.is_strict = (CastMode == CastModeType::StrictMode); | 781 | 38 | size_t size = vec_from.size(); | 782 | | | 783 | 38 | RETURN_IF_ERROR(std::visit( | 784 | 38 | [&](auto multiply_may_overflow, auto narrow_integral) { | 785 | 38 | for (size_t i = 0; i < size; i++) { | 786 | 38 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 787 | 38 | typename ToDataType::FieldType, | 788 | 38 | multiply_may_overflow, narrow_integral>( | 789 | 38 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 790 | 38 | scale_multiplier, min_result, max_result, params)) { | 791 | 38 | if (set_nullable) { | 792 | 38 | null_map_data[i] = 1; | 793 | 38 | } else { | 794 | 38 | return params.status; | 795 | 38 | } | 796 | 38 | } | 797 | 38 | } | 798 | 38 | return Status::OK(); | 799 | 38 | }, | 800 | 38 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 801 | | | 802 | 14 | if (narrow_integral) { | 803 | 6 | block.get_by_position(result).column = | 804 | 6 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 805 | 8 | } else { | 806 | 8 | block.get_by_position(result).column = std::move(col_to); | 807 | 8 | } | 808 | 14 | return Status::OK(); | 809 | 38 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE5EEENS_15DataTypeDecimalILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 723 | 20 | const NullMap::value_type* null_map = nullptr) const override { | 724 | 20 | using FromFieldType = typename FromDataType::FieldType; | 725 | 20 | using ToFieldType = typename ToDataType::FieldType; | 726 | 20 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 727 | 20 | const auto* col_from = | 728 | 20 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 729 | 20 | if (!col_from) { | 730 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 731 | 0 | named_from.column->get_name()); | 732 | 0 | } | 733 | | | 734 | 20 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 735 | 20 | constexpr UInt32 from_scale = 0; | 736 | | | 737 | 20 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 738 | 20 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 739 | 20 | UInt32 to_precision = to_decimal_type.get_precision(); | 740 | 20 | ToDataType::check_type_precision(to_precision); | 741 | 20 | UInt32 to_scale = to_decimal_type.get_scale(); | 742 | 20 | ToDataType::check_type_scale(to_scale); | 743 | | | 744 | 20 | auto from_max_int_digit_count = from_precision - from_scale; | 745 | 20 | auto to_max_int_digit_count = to_precision - to_scale; | 746 | | // may overflow. nullable result column. | 747 | 20 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 748 | | // only in non-strict mode and may overflow, we set nullable | 749 | 20 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 750 | | | 751 | 20 | constexpr UInt32 to_max_digits = | 752 | 20 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 753 | 20 | bool multiply_may_overflow = false; | 754 | 20 | if (to_scale > from_scale) { | 755 | 12 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 756 | 12 | } | 757 | 20 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 758 | 20 | sizeof(typename ToFieldType::NativeType)), | 759 | 20 | FromFieldType, typename ToFieldType::NativeType>; | 760 | 20 | MaxNativeType scale_multiplier = | 761 | 20 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 762 | 20 | typename ToFieldType::NativeType max_result = | 763 | 20 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 764 | 20 | typename ToFieldType::NativeType min_result = -max_result; | 765 | | | 766 | 20 | ColumnUInt8::MutablePtr col_null_map_to; | 767 | 20 | NullMap::value_type* null_map_data = nullptr; | 768 | 20 | if (narrow_integral) { | 769 | 12 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 770 | 12 | null_map_data = col_null_map_to->get_data().data(); | 771 | 12 | } | 772 | | | 773 | 20 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 774 | 20 | const auto& vec_from = col_from->get_data(); | 775 | 20 | const auto* vec_from_data = vec_from.data(); | 776 | 20 | auto& vec_to = col_to->get_data(); | 777 | 20 | auto* vec_to_data = vec_to.data(); | 778 | | | 779 | 20 | CastParameters params; | 780 | 20 | params.is_strict = (CastMode == CastModeType::StrictMode); | 781 | 20 | size_t size = vec_from.size(); | 782 | | | 783 | 20 | RETURN_IF_ERROR(std::visit( | 784 | 20 | [&](auto multiply_may_overflow, auto narrow_integral) { | 785 | 20 | for (size_t i = 0; i < size; i++) { | 786 | 20 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 787 | 20 | typename ToDataType::FieldType, | 788 | 20 | multiply_may_overflow, narrow_integral>( | 789 | 20 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 790 | 20 | scale_multiplier, min_result, max_result, params)) { | 791 | 20 | if (set_nullable) { | 792 | 20 | null_map_data[i] = 1; | 793 | 20 | } else { | 794 | 20 | return params.status; | 795 | 20 | } | 796 | 20 | } | 797 | 20 | } | 798 | 20 | return Status::OK(); | 799 | 20 | }, | 800 | 20 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 801 | | | 802 | 20 | if (narrow_integral) { | 803 | 12 | block.get_by_position(result).column = | 804 | 12 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 805 | 12 | } else { | 806 | 8 | block.get_by_position(result).column = std::move(col_to); | 807 | 8 | } | 808 | 20 | return Status::OK(); | 809 | 20 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE6EEENS_15DataTypeDecimalILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 723 | 46 | const NullMap::value_type* null_map = nullptr) const override { | 724 | 46 | using FromFieldType = typename FromDataType::FieldType; | 725 | 46 | using ToFieldType = typename ToDataType::FieldType; | 726 | 46 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 727 | 46 | const auto* col_from = | 728 | 46 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 729 | 46 | if (!col_from) { | 730 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 731 | 0 | named_from.column->get_name()); | 732 | 0 | } | 733 | | | 734 | 46 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 735 | 46 | constexpr UInt32 from_scale = 0; | 736 | | | 737 | 46 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 738 | 46 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 739 | 46 | UInt32 to_precision = to_decimal_type.get_precision(); | 740 | 46 | ToDataType::check_type_precision(to_precision); | 741 | 46 | UInt32 to_scale = to_decimal_type.get_scale(); | 742 | 46 | ToDataType::check_type_scale(to_scale); | 743 | | | 744 | 46 | auto from_max_int_digit_count = from_precision - from_scale; | 745 | 46 | auto to_max_int_digit_count = to_precision - to_scale; | 746 | | // may overflow. nullable result column. | 747 | 46 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 748 | | // only in non-strict mode and may overflow, we set nullable | 749 | 46 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 750 | | | 751 | 46 | constexpr UInt32 to_max_digits = | 752 | 46 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 753 | 46 | bool multiply_may_overflow = false; | 754 | 46 | if (to_scale > from_scale) { | 755 | 32 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 756 | 32 | } | 757 | 46 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 758 | 46 | sizeof(typename ToFieldType::NativeType)), | 759 | 46 | FromFieldType, typename ToFieldType::NativeType>; | 760 | 46 | MaxNativeType scale_multiplier = | 761 | 46 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 762 | 46 | typename ToFieldType::NativeType max_result = | 763 | 46 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 764 | 46 | typename ToFieldType::NativeType min_result = -max_result; | 765 | | | 766 | 46 | ColumnUInt8::MutablePtr col_null_map_to; | 767 | 46 | NullMap::value_type* null_map_data = nullptr; | 768 | 46 | if (narrow_integral) { | 769 | 40 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 770 | 40 | null_map_data = col_null_map_to->get_data().data(); | 771 | 40 | } | 772 | | | 773 | 46 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 774 | 46 | const auto& vec_from = col_from->get_data(); | 775 | 46 | const auto* vec_from_data = vec_from.data(); | 776 | 46 | auto& vec_to = col_to->get_data(); | 777 | 46 | auto* vec_to_data = vec_to.data(); | 778 | | | 779 | 46 | CastParameters params; | 780 | 46 | params.is_strict = (CastMode == CastModeType::StrictMode); | 781 | 46 | size_t size = vec_from.size(); | 782 | | | 783 | 46 | RETURN_IF_ERROR(std::visit( | 784 | 46 | [&](auto multiply_may_overflow, auto narrow_integral) { | 785 | 46 | for (size_t i = 0; i < size; i++) { | 786 | 46 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 787 | 46 | typename ToDataType::FieldType, | 788 | 46 | multiply_may_overflow, narrow_integral>( | 789 | 46 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 790 | 46 | scale_multiplier, min_result, max_result, params)) { | 791 | 46 | if (set_nullable) { | 792 | 46 | null_map_data[i] = 1; | 793 | 46 | } else { | 794 | 46 | return params.status; | 795 | 46 | } | 796 | 46 | } | 797 | 46 | } | 798 | 46 | return Status::OK(); | 799 | 46 | }, | 800 | 46 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 801 | | | 802 | 14 | if (narrow_integral) { | 803 | 8 | block.get_by_position(result).column = | 804 | 8 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 805 | 8 | } else { | 806 | 6 | block.get_by_position(result).column = std::move(col_to); | 807 | 6 | } | 808 | 14 | return Status::OK(); | 809 | 46 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE6EEENS_15DataTypeDecimalILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 723 | 22 | const NullMap::value_type* null_map = nullptr) const override { | 724 | 22 | using FromFieldType = typename FromDataType::FieldType; | 725 | 22 | using ToFieldType = typename ToDataType::FieldType; | 726 | 22 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 727 | 22 | const auto* col_from = | 728 | 22 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 729 | 22 | if (!col_from) { | 730 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 731 | 0 | named_from.column->get_name()); | 732 | 0 | } | 733 | | | 734 | 22 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 735 | 22 | constexpr UInt32 from_scale = 0; | 736 | | | 737 | 22 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 738 | 22 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 739 | 22 | UInt32 to_precision = to_decimal_type.get_precision(); | 740 | 22 | ToDataType::check_type_precision(to_precision); | 741 | 22 | UInt32 to_scale = to_decimal_type.get_scale(); | 742 | 22 | ToDataType::check_type_scale(to_scale); | 743 | | | 744 | 22 | auto from_max_int_digit_count = from_precision - from_scale; | 745 | 22 | auto to_max_int_digit_count = to_precision - to_scale; | 746 | | // may overflow. nullable result column. | 747 | 22 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 748 | | // only in non-strict mode and may overflow, we set nullable | 749 | 22 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 750 | | | 751 | 22 | constexpr UInt32 to_max_digits = | 752 | 22 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 753 | 22 | bool multiply_may_overflow = false; | 754 | 22 | if (to_scale > from_scale) { | 755 | 14 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 756 | 14 | } | 757 | 22 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 758 | 22 | sizeof(typename ToFieldType::NativeType)), | 759 | 22 | FromFieldType, typename ToFieldType::NativeType>; | 760 | 22 | MaxNativeType scale_multiplier = | 761 | 22 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 762 | 22 | typename ToFieldType::NativeType max_result = | 763 | 22 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 764 | 22 | typename ToFieldType::NativeType min_result = -max_result; | 765 | | | 766 | 22 | ColumnUInt8::MutablePtr col_null_map_to; | 767 | 22 | NullMap::value_type* null_map_data = nullptr; | 768 | 22 | if (narrow_integral) { | 769 | 16 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 770 | 16 | null_map_data = col_null_map_to->get_data().data(); | 771 | 16 | } | 772 | | | 773 | 22 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 774 | 22 | const auto& vec_from = col_from->get_data(); | 775 | 22 | const auto* vec_from_data = vec_from.data(); | 776 | 22 | auto& vec_to = col_to->get_data(); | 777 | 22 | auto* vec_to_data = vec_to.data(); | 778 | | | 779 | 22 | CastParameters params; | 780 | 22 | params.is_strict = (CastMode == CastModeType::StrictMode); | 781 | 22 | size_t size = vec_from.size(); | 782 | | | 783 | 22 | RETURN_IF_ERROR(std::visit( | 784 | 22 | [&](auto multiply_may_overflow, auto narrow_integral) { | 785 | 22 | for (size_t i = 0; i < size; i++) { | 786 | 22 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 787 | 22 | typename ToDataType::FieldType, | 788 | 22 | multiply_may_overflow, narrow_integral>( | 789 | 22 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 790 | 22 | scale_multiplier, min_result, max_result, params)) { | 791 | 22 | if (set_nullable) { | 792 | 22 | null_map_data[i] = 1; | 793 | 22 | } else { | 794 | 22 | return params.status; | 795 | 22 | } | 796 | 22 | } | 797 | 22 | } | 798 | 22 | return Status::OK(); | 799 | 22 | }, | 800 | 22 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 801 | | | 802 | 22 | if (narrow_integral) { | 803 | 16 | block.get_by_position(result).column = | 804 | 16 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 805 | 16 | } else { | 806 | 6 | block.get_by_position(result).column = std::move(col_to); | 807 | 6 | } | 808 | 22 | return Status::OK(); | 809 | 22 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE7EEENS_15DataTypeDecimalILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 723 | 70 | const NullMap::value_type* null_map = nullptr) const override { | 724 | 70 | using FromFieldType = typename FromDataType::FieldType; | 725 | 70 | using ToFieldType = typename ToDataType::FieldType; | 726 | 70 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 727 | 70 | const auto* col_from = | 728 | 70 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 729 | 70 | if (!col_from) { | 730 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 731 | 0 | named_from.column->get_name()); | 732 | 0 | } | 733 | | | 734 | 70 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 735 | 70 | constexpr UInt32 from_scale = 0; | 736 | | | 737 | 70 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 738 | 70 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 739 | 70 | UInt32 to_precision = to_decimal_type.get_precision(); | 740 | 70 | ToDataType::check_type_precision(to_precision); | 741 | 70 | UInt32 to_scale = to_decimal_type.get_scale(); | 742 | 70 | ToDataType::check_type_scale(to_scale); | 743 | | | 744 | 70 | auto from_max_int_digit_count = from_precision - from_scale; | 745 | 70 | auto to_max_int_digit_count = to_precision - to_scale; | 746 | | // may overflow. nullable result column. | 747 | 70 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 748 | | // only in non-strict mode and may overflow, we set nullable | 749 | 70 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 750 | | | 751 | 70 | constexpr UInt32 to_max_digits = | 752 | 70 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 753 | 70 | bool multiply_may_overflow = false; | 754 | 70 | if (to_scale > from_scale) { | 755 | 40 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 756 | 40 | } | 757 | 70 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 758 | 70 | sizeof(typename ToFieldType::NativeType)), | 759 | 70 | FromFieldType, typename ToFieldType::NativeType>; | 760 | 70 | MaxNativeType scale_multiplier = | 761 | 70 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 762 | 70 | typename ToFieldType::NativeType max_result = | 763 | 70 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 764 | 70 | typename ToFieldType::NativeType min_result = -max_result; | 765 | | | 766 | 70 | ColumnUInt8::MutablePtr col_null_map_to; | 767 | 70 | NullMap::value_type* null_map_data = nullptr; | 768 | 70 | if (narrow_integral) { | 769 | 70 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 770 | 70 | null_map_data = col_null_map_to->get_data().data(); | 771 | 70 | } | 772 | | | 773 | 70 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 774 | 70 | const auto& vec_from = col_from->get_data(); | 775 | 70 | const auto* vec_from_data = vec_from.data(); | 776 | 70 | auto& vec_to = col_to->get_data(); | 777 | 70 | auto* vec_to_data = vec_to.data(); | 778 | | | 779 | 70 | CastParameters params; | 780 | 70 | params.is_strict = (CastMode == CastModeType::StrictMode); | 781 | 70 | size_t size = vec_from.size(); | 782 | | | 783 | 70 | RETURN_IF_ERROR(std::visit( | 784 | 70 | [&](auto multiply_may_overflow, auto narrow_integral) { | 785 | 70 | for (size_t i = 0; i < size; i++) { | 786 | 70 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 787 | 70 | typename ToDataType::FieldType, | 788 | 70 | multiply_may_overflow, narrow_integral>( | 789 | 70 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 790 | 70 | scale_multiplier, min_result, max_result, params)) { | 791 | 70 | if (set_nullable) { | 792 | 70 | null_map_data[i] = 1; | 793 | 70 | } else { | 794 | 70 | return params.status; | 795 | 70 | } | 796 | 70 | } | 797 | 70 | } | 798 | 70 | return Status::OK(); | 799 | 70 | }, | 800 | 70 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 801 | | | 802 | 14 | if (narrow_integral) { | 803 | 14 | block.get_by_position(result).column = | 804 | 14 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 805 | 14 | } else { | 806 | 0 | block.get_by_position(result).column = std::move(col_to); | 807 | 0 | } | 808 | 14 | return Status::OK(); | 809 | 70 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE7EEENS_15DataTypeDecimalILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 723 | 28 | const NullMap::value_type* null_map = nullptr) const override { | 724 | 28 | using FromFieldType = typename FromDataType::FieldType; | 725 | 28 | using ToFieldType = typename ToDataType::FieldType; | 726 | 28 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 727 | 28 | const auto* col_from = | 728 | 28 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 729 | 28 | if (!col_from) { | 730 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 731 | 0 | named_from.column->get_name()); | 732 | 0 | } | 733 | | | 734 | 28 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 735 | 28 | constexpr UInt32 from_scale = 0; | 736 | | | 737 | 28 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 738 | 28 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 739 | 28 | UInt32 to_precision = to_decimal_type.get_precision(); | 740 | 28 | ToDataType::check_type_precision(to_precision); | 741 | 28 | UInt32 to_scale = to_decimal_type.get_scale(); | 742 | 28 | ToDataType::check_type_scale(to_scale); | 743 | | | 744 | 28 | auto from_max_int_digit_count = from_precision - from_scale; | 745 | 28 | auto to_max_int_digit_count = to_precision - to_scale; | 746 | | // may overflow. nullable result column. | 747 | 28 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 748 | | // only in non-strict mode and may overflow, we set nullable | 749 | 28 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 750 | | | 751 | 28 | constexpr UInt32 to_max_digits = | 752 | 28 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 753 | 28 | bool multiply_may_overflow = false; | 754 | 28 | if (to_scale > from_scale) { | 755 | 16 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 756 | 16 | } | 757 | 28 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 758 | 28 | sizeof(typename ToFieldType::NativeType)), | 759 | 28 | FromFieldType, typename ToFieldType::NativeType>; | 760 | 28 | MaxNativeType scale_multiplier = | 761 | 28 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 762 | 28 | typename ToFieldType::NativeType max_result = | 763 | 28 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 764 | 28 | typename ToFieldType::NativeType min_result = -max_result; | 765 | | | 766 | 28 | ColumnUInt8::MutablePtr col_null_map_to; | 767 | 28 | NullMap::value_type* null_map_data = nullptr; | 768 | 28 | if (narrow_integral) { | 769 | 28 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 770 | 28 | null_map_data = col_null_map_to->get_data().data(); | 771 | 28 | } | 772 | | | 773 | 28 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 774 | 28 | const auto& vec_from = col_from->get_data(); | 775 | 28 | const auto* vec_from_data = vec_from.data(); | 776 | 28 | auto& vec_to = col_to->get_data(); | 777 | 28 | auto* vec_to_data = vec_to.data(); | 778 | | | 779 | 28 | CastParameters params; | 780 | 28 | params.is_strict = (CastMode == CastModeType::StrictMode); | 781 | 28 | size_t size = vec_from.size(); | 782 | | | 783 | 28 | RETURN_IF_ERROR(std::visit( | 784 | 28 | [&](auto multiply_may_overflow, auto narrow_integral) { | 785 | 28 | for (size_t i = 0; i < size; i++) { | 786 | 28 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 787 | 28 | typename ToDataType::FieldType, | 788 | 28 | multiply_may_overflow, narrow_integral>( | 789 | 28 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 790 | 28 | scale_multiplier, min_result, max_result, params)) { | 791 | 28 | if (set_nullable) { | 792 | 28 | null_map_data[i] = 1; | 793 | 28 | } else { | 794 | 28 | return params.status; | 795 | 28 | } | 796 | 28 | } | 797 | 28 | } | 798 | 28 | return Status::OK(); | 799 | 28 | }, | 800 | 28 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 801 | | | 802 | 28 | if (narrow_integral) { | 803 | 28 | block.get_by_position(result).column = | 804 | 28 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 805 | 28 | } else { | 806 | 0 | block.get_by_position(result).column = std::move(col_to); | 807 | 0 | } | 808 | 28 | return Status::OK(); | 809 | 28 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE2EEENS_15DataTypeDecimalILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 723 | 4 | const NullMap::value_type* null_map = nullptr) const override { | 724 | 4 | using FromFieldType = typename FromDataType::FieldType; | 725 | 4 | using ToFieldType = typename ToDataType::FieldType; | 726 | 4 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 727 | 4 | const auto* col_from = | 728 | 4 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 729 | 4 | if (!col_from) { | 730 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 731 | 0 | named_from.column->get_name()); | 732 | 0 | } | 733 | | | 734 | 4 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 735 | 4 | constexpr UInt32 from_scale = 0; | 736 | | | 737 | 4 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 738 | 4 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 739 | 4 | UInt32 to_precision = to_decimal_type.get_precision(); | 740 | 4 | ToDataType::check_type_precision(to_precision); | 741 | 4 | UInt32 to_scale = to_decimal_type.get_scale(); | 742 | 4 | ToDataType::check_type_scale(to_scale); | 743 | | | 744 | 4 | auto from_max_int_digit_count = from_precision - from_scale; | 745 | 4 | auto to_max_int_digit_count = to_precision - to_scale; | 746 | | // may overflow. nullable result column. | 747 | 4 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 748 | | // only in non-strict mode and may overflow, we set nullable | 749 | 4 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 750 | | | 751 | 4 | constexpr UInt32 to_max_digits = | 752 | 4 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 753 | 4 | bool multiply_may_overflow = false; | 754 | 4 | if (to_scale > from_scale) { | 755 | 4 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 756 | 4 | } | 757 | 4 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 758 | 4 | sizeof(typename ToFieldType::NativeType)), | 759 | 4 | FromFieldType, typename ToFieldType::NativeType>; | 760 | 4 | MaxNativeType scale_multiplier = | 761 | 4 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 762 | 4 | typename ToFieldType::NativeType max_result = | 763 | 4 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 764 | 4 | typename ToFieldType::NativeType min_result = -max_result; | 765 | | | 766 | 4 | ColumnUInt8::MutablePtr col_null_map_to; | 767 | 4 | NullMap::value_type* null_map_data = nullptr; | 768 | 4 | if (narrow_integral) { | 769 | 4 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 770 | 4 | null_map_data = col_null_map_to->get_data().data(); | 771 | 4 | } | 772 | | | 773 | 4 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 774 | 4 | const auto& vec_from = col_from->get_data(); | 775 | 4 | const auto* vec_from_data = vec_from.data(); | 776 | 4 | auto& vec_to = col_to->get_data(); | 777 | 4 | auto* vec_to_data = vec_to.data(); | 778 | | | 779 | 4 | CastParameters params; | 780 | 4 | params.is_strict = (CastMode == CastModeType::StrictMode); | 781 | 4 | size_t size = vec_from.size(); | 782 | | | 783 | 4 | RETURN_IF_ERROR(std::visit( | 784 | 4 | [&](auto multiply_may_overflow, auto narrow_integral) { | 785 | 4 | for (size_t i = 0; i < size; i++) { | 786 | 4 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 787 | 4 | typename ToDataType::FieldType, | 788 | 4 | multiply_may_overflow, narrow_integral>( | 789 | 4 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 790 | 4 | scale_multiplier, min_result, max_result, params)) { | 791 | 4 | if (set_nullable) { | 792 | 4 | null_map_data[i] = 1; | 793 | 4 | } else { | 794 | 4 | return params.status; | 795 | 4 | } | 796 | 4 | } | 797 | 4 | } | 798 | 4 | return Status::OK(); | 799 | 4 | }, | 800 | 4 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 801 | | | 802 | 2 | if (narrow_integral) { | 803 | 2 | block.get_by_position(result).column = | 804 | 2 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 805 | 2 | } else { | 806 | 0 | block.get_by_position(result).column = std::move(col_to); | 807 | 0 | } | 808 | 2 | return Status::OK(); | 809 | 4 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE2EEENS_15DataTypeDecimalILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 723 | 10 | const NullMap::value_type* null_map = nullptr) const override { | 724 | 10 | using FromFieldType = typename FromDataType::FieldType; | 725 | 10 | using ToFieldType = typename ToDataType::FieldType; | 726 | 10 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 727 | 10 | const auto* col_from = | 728 | 10 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 729 | 10 | if (!col_from) { | 730 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 731 | 0 | named_from.column->get_name()); | 732 | 0 | } | 733 | | | 734 | 10 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 735 | 10 | constexpr UInt32 from_scale = 0; | 736 | | | 737 | 10 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 738 | 10 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 739 | 10 | UInt32 to_precision = to_decimal_type.get_precision(); | 740 | 10 | ToDataType::check_type_precision(to_precision); | 741 | 10 | UInt32 to_scale = to_decimal_type.get_scale(); | 742 | 10 | ToDataType::check_type_scale(to_scale); | 743 | | | 744 | 10 | auto from_max_int_digit_count = from_precision - from_scale; | 745 | 10 | auto to_max_int_digit_count = to_precision - to_scale; | 746 | | // may overflow. nullable result column. | 747 | 10 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 748 | | // only in non-strict mode and may overflow, we set nullable | 749 | 10 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 750 | | | 751 | 10 | constexpr UInt32 to_max_digits = | 752 | 10 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 753 | 10 | bool multiply_may_overflow = false; | 754 | 10 | if (to_scale > from_scale) { | 755 | 8 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 756 | 8 | } | 757 | 10 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 758 | 10 | sizeof(typename ToFieldType::NativeType)), | 759 | 10 | FromFieldType, typename ToFieldType::NativeType>; | 760 | 10 | MaxNativeType scale_multiplier = | 761 | 10 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 762 | 10 | typename ToFieldType::NativeType max_result = | 763 | 10 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 764 | 10 | typename ToFieldType::NativeType min_result = -max_result; | 765 | | | 766 | 10 | ColumnUInt8::MutablePtr col_null_map_to; | 767 | 10 | NullMap::value_type* null_map_data = nullptr; | 768 | 10 | if (narrow_integral) { | 769 | 2 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 770 | 2 | null_map_data = col_null_map_to->get_data().data(); | 771 | 2 | } | 772 | | | 773 | 10 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 774 | 10 | const auto& vec_from = col_from->get_data(); | 775 | 10 | const auto* vec_from_data = vec_from.data(); | 776 | 10 | auto& vec_to = col_to->get_data(); | 777 | 10 | auto* vec_to_data = vec_to.data(); | 778 | | | 779 | 10 | CastParameters params; | 780 | 10 | params.is_strict = (CastMode == CastModeType::StrictMode); | 781 | 10 | size_t size = vec_from.size(); | 782 | | | 783 | 10 | RETURN_IF_ERROR(std::visit( | 784 | 10 | [&](auto multiply_may_overflow, auto narrow_integral) { | 785 | 10 | for (size_t i = 0; i < size; i++) { | 786 | 10 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 787 | 10 | typename ToDataType::FieldType, | 788 | 10 | multiply_may_overflow, narrow_integral>( | 789 | 10 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 790 | 10 | scale_multiplier, min_result, max_result, params)) { | 791 | 10 | if (set_nullable) { | 792 | 10 | null_map_data[i] = 1; | 793 | 10 | } else { | 794 | 10 | return params.status; | 795 | 10 | } | 796 | 10 | } | 797 | 10 | } | 798 | 10 | return Status::OK(); | 799 | 10 | }, | 800 | 10 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 801 | | | 802 | 10 | if (narrow_integral) { | 803 | 2 | block.get_by_position(result).column = | 804 | 2 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 805 | 8 | } else { | 806 | 8 | block.get_by_position(result).column = std::move(col_to); | 807 | 8 | } | 808 | 10 | return Status::OK(); | 809 | 10 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE3EEENS_15DataTypeDecimalILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 723 | 38 | const NullMap::value_type* null_map = nullptr) const override { | 724 | 38 | using FromFieldType = typename FromDataType::FieldType; | 725 | 38 | using ToFieldType = typename ToDataType::FieldType; | 726 | 38 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 727 | 38 | const auto* col_from = | 728 | 38 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 729 | 38 | if (!col_from) { | 730 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 731 | 0 | named_from.column->get_name()); | 732 | 0 | } | 733 | | | 734 | 38 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 735 | 38 | constexpr UInt32 from_scale = 0; | 736 | | | 737 | 38 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 738 | 38 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 739 | 38 | UInt32 to_precision = to_decimal_type.get_precision(); | 740 | 38 | ToDataType::check_type_precision(to_precision); | 741 | 38 | UInt32 to_scale = to_decimal_type.get_scale(); | 742 | 38 | ToDataType::check_type_scale(to_scale); | 743 | | | 744 | 38 | auto from_max_int_digit_count = from_precision - from_scale; | 745 | 38 | auto to_max_int_digit_count = to_precision - to_scale; | 746 | | // may overflow. nullable result column. | 747 | 38 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 748 | | // only in non-strict mode and may overflow, we set nullable | 749 | 38 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 750 | | | 751 | 38 | constexpr UInt32 to_max_digits = | 752 | 38 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 753 | 38 | bool multiply_may_overflow = false; | 754 | 38 | if (to_scale > from_scale) { | 755 | 24 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 756 | 24 | } | 757 | 38 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 758 | 38 | sizeof(typename ToFieldType::NativeType)), | 759 | 38 | FromFieldType, typename ToFieldType::NativeType>; | 760 | 38 | MaxNativeType scale_multiplier = | 761 | 38 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 762 | 38 | typename ToFieldType::NativeType max_result = | 763 | 38 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 764 | 38 | typename ToFieldType::NativeType min_result = -max_result; | 765 | | | 766 | 38 | ColumnUInt8::MutablePtr col_null_map_to; | 767 | 38 | NullMap::value_type* null_map_data = nullptr; | 768 | 38 | if (narrow_integral) { | 769 | 30 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 770 | 30 | null_map_data = col_null_map_to->get_data().data(); | 771 | 30 | } | 772 | | | 773 | 38 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 774 | 38 | const auto& vec_from = col_from->get_data(); | 775 | 38 | const auto* vec_from_data = vec_from.data(); | 776 | 38 | auto& vec_to = col_to->get_data(); | 777 | 38 | auto* vec_to_data = vec_to.data(); | 778 | | | 779 | 38 | CastParameters params; | 780 | 38 | params.is_strict = (CastMode == CastModeType::StrictMode); | 781 | 38 | size_t size = vec_from.size(); | 782 | | | 783 | 38 | RETURN_IF_ERROR(std::visit( | 784 | 38 | [&](auto multiply_may_overflow, auto narrow_integral) { | 785 | 38 | for (size_t i = 0; i < size; i++) { | 786 | 38 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 787 | 38 | typename ToDataType::FieldType, | 788 | 38 | multiply_may_overflow, narrow_integral>( | 789 | 38 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 790 | 38 | scale_multiplier, min_result, max_result, params)) { | 791 | 38 | if (set_nullable) { | 792 | 38 | null_map_data[i] = 1; | 793 | 38 | } else { | 794 | 38 | return params.status; | 795 | 38 | } | 796 | 38 | } | 797 | 38 | } | 798 | 38 | return Status::OK(); | 799 | 38 | }, | 800 | 38 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 801 | | | 802 | 14 | if (narrow_integral) { | 803 | 6 | block.get_by_position(result).column = | 804 | 6 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 805 | 8 | } else { | 806 | 8 | block.get_by_position(result).column = std::move(col_to); | 807 | 8 | } | 808 | 14 | return Status::OK(); | 809 | 38 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE3EEENS_15DataTypeDecimalILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 723 | 20 | const NullMap::value_type* null_map = nullptr) const override { | 724 | 20 | using FromFieldType = typename FromDataType::FieldType; | 725 | 20 | using ToFieldType = typename ToDataType::FieldType; | 726 | 20 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 727 | 20 | const auto* col_from = | 728 | 20 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 729 | 20 | if (!col_from) { | 730 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 731 | 0 | named_from.column->get_name()); | 732 | 0 | } | 733 | | | 734 | 20 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 735 | 20 | constexpr UInt32 from_scale = 0; | 736 | | | 737 | 20 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 738 | 20 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 739 | 20 | UInt32 to_precision = to_decimal_type.get_precision(); | 740 | 20 | ToDataType::check_type_precision(to_precision); | 741 | 20 | UInt32 to_scale = to_decimal_type.get_scale(); | 742 | 20 | ToDataType::check_type_scale(to_scale); | 743 | | | 744 | 20 | auto from_max_int_digit_count = from_precision - from_scale; | 745 | 20 | auto to_max_int_digit_count = to_precision - to_scale; | 746 | | // may overflow. nullable result column. | 747 | 20 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 748 | | // only in non-strict mode and may overflow, we set nullable | 749 | 20 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 750 | | | 751 | 20 | constexpr UInt32 to_max_digits = | 752 | 20 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 753 | 20 | bool multiply_may_overflow = false; | 754 | 20 | if (to_scale > from_scale) { | 755 | 12 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 756 | 12 | } | 757 | 20 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 758 | 20 | sizeof(typename ToFieldType::NativeType)), | 759 | 20 | FromFieldType, typename ToFieldType::NativeType>; | 760 | 20 | MaxNativeType scale_multiplier = | 761 | 20 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 762 | 20 | typename ToFieldType::NativeType max_result = | 763 | 20 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 764 | 20 | typename ToFieldType::NativeType min_result = -max_result; | 765 | | | 766 | 20 | ColumnUInt8::MutablePtr col_null_map_to; | 767 | 20 | NullMap::value_type* null_map_data = nullptr; | 768 | 20 | if (narrow_integral) { | 769 | 12 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 770 | 12 | null_map_data = col_null_map_to->get_data().data(); | 771 | 12 | } | 772 | | | 773 | 20 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 774 | 20 | const auto& vec_from = col_from->get_data(); | 775 | 20 | const auto* vec_from_data = vec_from.data(); | 776 | 20 | auto& vec_to = col_to->get_data(); | 777 | 20 | auto* vec_to_data = vec_to.data(); | 778 | | | 779 | 20 | CastParameters params; | 780 | 20 | params.is_strict = (CastMode == CastModeType::StrictMode); | 781 | 20 | size_t size = vec_from.size(); | 782 | | | 783 | 20 | RETURN_IF_ERROR(std::visit( | 784 | 20 | [&](auto multiply_may_overflow, auto narrow_integral) { | 785 | 20 | for (size_t i = 0; i < size; i++) { | 786 | 20 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 787 | 20 | typename ToDataType::FieldType, | 788 | 20 | multiply_may_overflow, narrow_integral>( | 789 | 20 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 790 | 20 | scale_multiplier, min_result, max_result, params)) { | 791 | 20 | if (set_nullable) { | 792 | 20 | null_map_data[i] = 1; | 793 | 20 | } else { | 794 | 20 | return params.status; | 795 | 20 | } | 796 | 20 | } | 797 | 20 | } | 798 | 20 | return Status::OK(); | 799 | 20 | }, | 800 | 20 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 801 | | | 802 | 20 | if (narrow_integral) { | 803 | 12 | block.get_by_position(result).column = | 804 | 12 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 805 | 12 | } else { | 806 | 8 | block.get_by_position(result).column = std::move(col_to); | 807 | 8 | } | 808 | 20 | return Status::OK(); | 809 | 20 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE4EEENS_15DataTypeDecimalILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 723 | 38 | const NullMap::value_type* null_map = nullptr) const override { | 724 | 38 | using FromFieldType = typename FromDataType::FieldType; | 725 | 38 | using ToFieldType = typename ToDataType::FieldType; | 726 | 38 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 727 | 38 | const auto* col_from = | 728 | 38 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 729 | 38 | if (!col_from) { | 730 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 731 | 0 | named_from.column->get_name()); | 732 | 0 | } | 733 | | | 734 | 38 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 735 | 38 | constexpr UInt32 from_scale = 0; | 736 | | | 737 | 38 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 738 | 38 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 739 | 38 | UInt32 to_precision = to_decimal_type.get_precision(); | 740 | 38 | ToDataType::check_type_precision(to_precision); | 741 | 38 | UInt32 to_scale = to_decimal_type.get_scale(); | 742 | 38 | ToDataType::check_type_scale(to_scale); | 743 | | | 744 | 38 | auto from_max_int_digit_count = from_precision - from_scale; | 745 | 38 | auto to_max_int_digit_count = to_precision - to_scale; | 746 | | // may overflow. nullable result column. | 747 | 38 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 748 | | // only in non-strict mode and may overflow, we set nullable | 749 | 38 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 750 | | | 751 | 38 | constexpr UInt32 to_max_digits = | 752 | 38 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 753 | 38 | bool multiply_may_overflow = false; | 754 | 38 | if (to_scale > from_scale) { | 755 | 24 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 756 | 24 | } | 757 | 38 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 758 | 38 | sizeof(typename ToFieldType::NativeType)), | 759 | 38 | FromFieldType, typename ToFieldType::NativeType>; | 760 | 38 | MaxNativeType scale_multiplier = | 761 | 38 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 762 | 38 | typename ToFieldType::NativeType max_result = | 763 | 38 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 764 | 38 | typename ToFieldType::NativeType min_result = -max_result; | 765 | | | 766 | 38 | ColumnUInt8::MutablePtr col_null_map_to; | 767 | 38 | NullMap::value_type* null_map_data = nullptr; | 768 | 38 | if (narrow_integral) { | 769 | 30 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 770 | 30 | null_map_data = col_null_map_to->get_data().data(); | 771 | 30 | } | 772 | | | 773 | 38 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 774 | 38 | const auto& vec_from = col_from->get_data(); | 775 | 38 | const auto* vec_from_data = vec_from.data(); | 776 | 38 | auto& vec_to = col_to->get_data(); | 777 | 38 | auto* vec_to_data = vec_to.data(); | 778 | | | 779 | 38 | CastParameters params; | 780 | 38 | params.is_strict = (CastMode == CastModeType::StrictMode); | 781 | 38 | size_t size = vec_from.size(); | 782 | | | 783 | 38 | RETURN_IF_ERROR(std::visit( | 784 | 38 | [&](auto multiply_may_overflow, auto narrow_integral) { | 785 | 38 | for (size_t i = 0; i < size; i++) { | 786 | 38 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 787 | 38 | typename ToDataType::FieldType, | 788 | 38 | multiply_may_overflow, narrow_integral>( | 789 | 38 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 790 | 38 | scale_multiplier, min_result, max_result, params)) { | 791 | 38 | if (set_nullable) { | 792 | 38 | null_map_data[i] = 1; | 793 | 38 | } else { | 794 | 38 | return params.status; | 795 | 38 | } | 796 | 38 | } | 797 | 38 | } | 798 | 38 | return Status::OK(); | 799 | 38 | }, | 800 | 38 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 801 | | | 802 | 14 | if (narrow_integral) { | 803 | 6 | block.get_by_position(result).column = | 804 | 6 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 805 | 8 | } else { | 806 | 8 | block.get_by_position(result).column = std::move(col_to); | 807 | 8 | } | 808 | 14 | return Status::OK(); | 809 | 38 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE4EEENS_15DataTypeDecimalILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 723 | 20 | const NullMap::value_type* null_map = nullptr) const override { | 724 | 20 | using FromFieldType = typename FromDataType::FieldType; | 725 | 20 | using ToFieldType = typename ToDataType::FieldType; | 726 | 20 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 727 | 20 | const auto* col_from = | 728 | 20 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 729 | 20 | if (!col_from) { | 730 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 731 | 0 | named_from.column->get_name()); | 732 | 0 | } | 733 | | | 734 | 20 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 735 | 20 | constexpr UInt32 from_scale = 0; | 736 | | | 737 | 20 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 738 | 20 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 739 | 20 | UInt32 to_precision = to_decimal_type.get_precision(); | 740 | 20 | ToDataType::check_type_precision(to_precision); | 741 | 20 | UInt32 to_scale = to_decimal_type.get_scale(); | 742 | 20 | ToDataType::check_type_scale(to_scale); | 743 | | | 744 | 20 | auto from_max_int_digit_count = from_precision - from_scale; | 745 | 20 | auto to_max_int_digit_count = to_precision - to_scale; | 746 | | // may overflow. nullable result column. | 747 | 20 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 748 | | // only in non-strict mode and may overflow, we set nullable | 749 | 20 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 750 | | | 751 | 20 | constexpr UInt32 to_max_digits = | 752 | 20 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 753 | 20 | bool multiply_may_overflow = false; | 754 | 20 | if (to_scale > from_scale) { | 755 | 12 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 756 | 12 | } | 757 | 20 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 758 | 20 | sizeof(typename ToFieldType::NativeType)), | 759 | 20 | FromFieldType, typename ToFieldType::NativeType>; | 760 | 20 | MaxNativeType scale_multiplier = | 761 | 20 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 762 | 20 | typename ToFieldType::NativeType max_result = | 763 | 20 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 764 | 20 | typename ToFieldType::NativeType min_result = -max_result; | 765 | | | 766 | 20 | ColumnUInt8::MutablePtr col_null_map_to; | 767 | 20 | NullMap::value_type* null_map_data = nullptr; | 768 | 20 | if (narrow_integral) { | 769 | 12 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 770 | 12 | null_map_data = col_null_map_to->get_data().data(); | 771 | 12 | } | 772 | | | 773 | 20 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 774 | 20 | const auto& vec_from = col_from->get_data(); | 775 | 20 | const auto* vec_from_data = vec_from.data(); | 776 | 20 | auto& vec_to = col_to->get_data(); | 777 | 20 | auto* vec_to_data = vec_to.data(); | 778 | | | 779 | 20 | CastParameters params; | 780 | 20 | params.is_strict = (CastMode == CastModeType::StrictMode); | 781 | 20 | size_t size = vec_from.size(); | 782 | | | 783 | 20 | RETURN_IF_ERROR(std::visit( | 784 | 20 | [&](auto multiply_may_overflow, auto narrow_integral) { | 785 | 20 | for (size_t i = 0; i < size; i++) { | 786 | 20 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 787 | 20 | typename ToDataType::FieldType, | 788 | 20 | multiply_may_overflow, narrow_integral>( | 789 | 20 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 790 | 20 | scale_multiplier, min_result, max_result, params)) { | 791 | 20 | if (set_nullable) { | 792 | 20 | null_map_data[i] = 1; | 793 | 20 | } else { | 794 | 20 | return params.status; | 795 | 20 | } | 796 | 20 | } | 797 | 20 | } | 798 | 20 | return Status::OK(); | 799 | 20 | }, | 800 | 20 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 801 | | | 802 | 20 | if (narrow_integral) { | 803 | 12 | block.get_by_position(result).column = | 804 | 12 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 805 | 12 | } else { | 806 | 8 | block.get_by_position(result).column = std::move(col_to); | 807 | 8 | } | 808 | 20 | return Status::OK(); | 809 | 20 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE5EEENS_15DataTypeDecimalILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 723 | 38 | const NullMap::value_type* null_map = nullptr) const override { | 724 | 38 | using FromFieldType = typename FromDataType::FieldType; | 725 | 38 | using ToFieldType = typename ToDataType::FieldType; | 726 | 38 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 727 | 38 | const auto* col_from = | 728 | 38 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 729 | 38 | if (!col_from) { | 730 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 731 | 0 | named_from.column->get_name()); | 732 | 0 | } | 733 | | | 734 | 38 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 735 | 38 | constexpr UInt32 from_scale = 0; | 736 | | | 737 | 38 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 738 | 38 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 739 | 38 | UInt32 to_precision = to_decimal_type.get_precision(); | 740 | 38 | ToDataType::check_type_precision(to_precision); | 741 | 38 | UInt32 to_scale = to_decimal_type.get_scale(); | 742 | 38 | ToDataType::check_type_scale(to_scale); | 743 | | | 744 | 38 | auto from_max_int_digit_count = from_precision - from_scale; | 745 | 38 | auto to_max_int_digit_count = to_precision - to_scale; | 746 | | // may overflow. nullable result column. | 747 | 38 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 748 | | // only in non-strict mode and may overflow, we set nullable | 749 | 38 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 750 | | | 751 | 38 | constexpr UInt32 to_max_digits = | 752 | 38 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 753 | 38 | bool multiply_may_overflow = false; | 754 | 38 | if (to_scale > from_scale) { | 755 | 24 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 756 | 24 | } | 757 | 38 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 758 | 38 | sizeof(typename ToFieldType::NativeType)), | 759 | 38 | FromFieldType, typename ToFieldType::NativeType>; | 760 | 38 | MaxNativeType scale_multiplier = | 761 | 38 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 762 | 38 | typename ToFieldType::NativeType max_result = | 763 | 38 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 764 | 38 | typename ToFieldType::NativeType min_result = -max_result; | 765 | | | 766 | 38 | ColumnUInt8::MutablePtr col_null_map_to; | 767 | 38 | NullMap::value_type* null_map_data = nullptr; | 768 | 38 | if (narrow_integral) { | 769 | 30 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 770 | 30 | null_map_data = col_null_map_to->get_data().data(); | 771 | 30 | } | 772 | | | 773 | 38 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 774 | 38 | const auto& vec_from = col_from->get_data(); | 775 | 38 | const auto* vec_from_data = vec_from.data(); | 776 | 38 | auto& vec_to = col_to->get_data(); | 777 | 38 | auto* vec_to_data = vec_to.data(); | 778 | | | 779 | 38 | CastParameters params; | 780 | 38 | params.is_strict = (CastMode == CastModeType::StrictMode); | 781 | 38 | size_t size = vec_from.size(); | 782 | | | 783 | 38 | RETURN_IF_ERROR(std::visit( | 784 | 38 | [&](auto multiply_may_overflow, auto narrow_integral) { | 785 | 38 | for (size_t i = 0; i < size; i++) { | 786 | 38 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 787 | 38 | typename ToDataType::FieldType, | 788 | 38 | multiply_may_overflow, narrow_integral>( | 789 | 38 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 790 | 38 | scale_multiplier, min_result, max_result, params)) { | 791 | 38 | if (set_nullable) { | 792 | 38 | null_map_data[i] = 1; | 793 | 38 | } else { | 794 | 38 | return params.status; | 795 | 38 | } | 796 | 38 | } | 797 | 38 | } | 798 | 38 | return Status::OK(); | 799 | 38 | }, | 800 | 38 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 801 | | | 802 | 14 | if (narrow_integral) { | 803 | 6 | block.get_by_position(result).column = | 804 | 6 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 805 | 8 | } else { | 806 | 8 | block.get_by_position(result).column = std::move(col_to); | 807 | 8 | } | 808 | 14 | return Status::OK(); | 809 | 38 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE5EEENS_15DataTypeDecimalILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 723 | 20 | const NullMap::value_type* null_map = nullptr) const override { | 724 | 20 | using FromFieldType = typename FromDataType::FieldType; | 725 | 20 | using ToFieldType = typename ToDataType::FieldType; | 726 | 20 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 727 | 20 | const auto* col_from = | 728 | 20 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 729 | 20 | if (!col_from) { | 730 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 731 | 0 | named_from.column->get_name()); | 732 | 0 | } | 733 | | | 734 | 20 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 735 | 20 | constexpr UInt32 from_scale = 0; | 736 | | | 737 | 20 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 738 | 20 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 739 | 20 | UInt32 to_precision = to_decimal_type.get_precision(); | 740 | 20 | ToDataType::check_type_precision(to_precision); | 741 | 20 | UInt32 to_scale = to_decimal_type.get_scale(); | 742 | 20 | ToDataType::check_type_scale(to_scale); | 743 | | | 744 | 20 | auto from_max_int_digit_count = from_precision - from_scale; | 745 | 20 | auto to_max_int_digit_count = to_precision - to_scale; | 746 | | // may overflow. nullable result column. | 747 | 20 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 748 | | // only in non-strict mode and may overflow, we set nullable | 749 | 20 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 750 | | | 751 | 20 | constexpr UInt32 to_max_digits = | 752 | 20 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 753 | 20 | bool multiply_may_overflow = false; | 754 | 20 | if (to_scale > from_scale) { | 755 | 12 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 756 | 12 | } | 757 | 20 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 758 | 20 | sizeof(typename ToFieldType::NativeType)), | 759 | 20 | FromFieldType, typename ToFieldType::NativeType>; | 760 | 20 | MaxNativeType scale_multiplier = | 761 | 20 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 762 | 20 | typename ToFieldType::NativeType max_result = | 763 | 20 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 764 | 20 | typename ToFieldType::NativeType min_result = -max_result; | 765 | | | 766 | 20 | ColumnUInt8::MutablePtr col_null_map_to; | 767 | 20 | NullMap::value_type* null_map_data = nullptr; | 768 | 20 | if (narrow_integral) { | 769 | 12 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 770 | 12 | null_map_data = col_null_map_to->get_data().data(); | 771 | 12 | } | 772 | | | 773 | 20 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 774 | 20 | const auto& vec_from = col_from->get_data(); | 775 | 20 | const auto* vec_from_data = vec_from.data(); | 776 | 20 | auto& vec_to = col_to->get_data(); | 777 | 20 | auto* vec_to_data = vec_to.data(); | 778 | | | 779 | 20 | CastParameters params; | 780 | 20 | params.is_strict = (CastMode == CastModeType::StrictMode); | 781 | 20 | size_t size = vec_from.size(); | 782 | | | 783 | 20 | RETURN_IF_ERROR(std::visit( | 784 | 20 | [&](auto multiply_may_overflow, auto narrow_integral) { | 785 | 20 | for (size_t i = 0; i < size; i++) { | 786 | 20 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 787 | 20 | typename ToDataType::FieldType, | 788 | 20 | multiply_may_overflow, narrow_integral>( | 789 | 20 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 790 | 20 | scale_multiplier, min_result, max_result, params)) { | 791 | 20 | if (set_nullable) { | 792 | 20 | null_map_data[i] = 1; | 793 | 20 | } else { | 794 | 20 | return params.status; | 795 | 20 | } | 796 | 20 | } | 797 | 20 | } | 798 | 20 | return Status::OK(); | 799 | 20 | }, | 800 | 20 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 801 | | | 802 | 20 | if (narrow_integral) { | 803 | 12 | block.get_by_position(result).column = | 804 | 12 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 805 | 12 | } else { | 806 | 8 | block.get_by_position(result).column = std::move(col_to); | 807 | 8 | } | 808 | 20 | return Status::OK(); | 809 | 20 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE6EEENS_15DataTypeDecimalILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 723 | 38 | const NullMap::value_type* null_map = nullptr) const override { | 724 | 38 | using FromFieldType = typename FromDataType::FieldType; | 725 | 38 | using ToFieldType = typename ToDataType::FieldType; | 726 | 38 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 727 | 38 | const auto* col_from = | 728 | 38 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 729 | 38 | if (!col_from) { | 730 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 731 | 0 | named_from.column->get_name()); | 732 | 0 | } | 733 | | | 734 | 38 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 735 | 38 | constexpr UInt32 from_scale = 0; | 736 | | | 737 | 38 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 738 | 38 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 739 | 38 | UInt32 to_precision = to_decimal_type.get_precision(); | 740 | 38 | ToDataType::check_type_precision(to_precision); | 741 | 38 | UInt32 to_scale = to_decimal_type.get_scale(); | 742 | 38 | ToDataType::check_type_scale(to_scale); | 743 | | | 744 | 38 | auto from_max_int_digit_count = from_precision - from_scale; | 745 | 38 | auto to_max_int_digit_count = to_precision - to_scale; | 746 | | // may overflow. nullable result column. | 747 | 38 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 748 | | // only in non-strict mode and may overflow, we set nullable | 749 | 38 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 750 | | | 751 | 38 | constexpr UInt32 to_max_digits = | 752 | 38 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 753 | 38 | bool multiply_may_overflow = false; | 754 | 38 | if (to_scale > from_scale) { | 755 | 24 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 756 | 24 | } | 757 | 38 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 758 | 38 | sizeof(typename ToFieldType::NativeType)), | 759 | 38 | FromFieldType, typename ToFieldType::NativeType>; | 760 | 38 | MaxNativeType scale_multiplier = | 761 | 38 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 762 | 38 | typename ToFieldType::NativeType max_result = | 763 | 38 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 764 | 38 | typename ToFieldType::NativeType min_result = -max_result; | 765 | | | 766 | 38 | ColumnUInt8::MutablePtr col_null_map_to; | 767 | 38 | NullMap::value_type* null_map_data = nullptr; | 768 | 38 | if (narrow_integral) { | 769 | 30 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 770 | 30 | null_map_data = col_null_map_to->get_data().data(); | 771 | 30 | } | 772 | | | 773 | 38 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 774 | 38 | const auto& vec_from = col_from->get_data(); | 775 | 38 | const auto* vec_from_data = vec_from.data(); | 776 | 38 | auto& vec_to = col_to->get_data(); | 777 | 38 | auto* vec_to_data = vec_to.data(); | 778 | | | 779 | 38 | CastParameters params; | 780 | 38 | params.is_strict = (CastMode == CastModeType::StrictMode); | 781 | 38 | size_t size = vec_from.size(); | 782 | | | 783 | 38 | RETURN_IF_ERROR(std::visit( | 784 | 38 | [&](auto multiply_may_overflow, auto narrow_integral) { | 785 | 38 | for (size_t i = 0; i < size; i++) { | 786 | 38 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 787 | 38 | typename ToDataType::FieldType, | 788 | 38 | multiply_may_overflow, narrow_integral>( | 789 | 38 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 790 | 38 | scale_multiplier, min_result, max_result, params)) { | 791 | 38 | if (set_nullable) { | 792 | 38 | null_map_data[i] = 1; | 793 | 38 | } else { | 794 | 38 | return params.status; | 795 | 38 | } | 796 | 38 | } | 797 | 38 | } | 798 | 38 | return Status::OK(); | 799 | 38 | }, | 800 | 38 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 801 | | | 802 | 14 | if (narrow_integral) { | 803 | 6 | block.get_by_position(result).column = | 804 | 6 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 805 | 8 | } else { | 806 | 8 | block.get_by_position(result).column = std::move(col_to); | 807 | 8 | } | 808 | 14 | return Status::OK(); | 809 | 38 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE6EEENS_15DataTypeDecimalILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 723 | 20 | const NullMap::value_type* null_map = nullptr) const override { | 724 | 20 | using FromFieldType = typename FromDataType::FieldType; | 725 | 20 | using ToFieldType = typename ToDataType::FieldType; | 726 | 20 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 727 | 20 | const auto* col_from = | 728 | 20 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 729 | 20 | if (!col_from) { | 730 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 731 | 0 | named_from.column->get_name()); | 732 | 0 | } | 733 | | | 734 | 20 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 735 | 20 | constexpr UInt32 from_scale = 0; | 736 | | | 737 | 20 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 738 | 20 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 739 | 20 | UInt32 to_precision = to_decimal_type.get_precision(); | 740 | 20 | ToDataType::check_type_precision(to_precision); | 741 | 20 | UInt32 to_scale = to_decimal_type.get_scale(); | 742 | 20 | ToDataType::check_type_scale(to_scale); | 743 | | | 744 | 20 | auto from_max_int_digit_count = from_precision - from_scale; | 745 | 20 | auto to_max_int_digit_count = to_precision - to_scale; | 746 | | // may overflow. nullable result column. | 747 | 20 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 748 | | // only in non-strict mode and may overflow, we set nullable | 749 | 20 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 750 | | | 751 | 20 | constexpr UInt32 to_max_digits = | 752 | 20 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 753 | 20 | bool multiply_may_overflow = false; | 754 | 20 | if (to_scale > from_scale) { | 755 | 12 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 756 | 12 | } | 757 | 20 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 758 | 20 | sizeof(typename ToFieldType::NativeType)), | 759 | 20 | FromFieldType, typename ToFieldType::NativeType>; | 760 | 20 | MaxNativeType scale_multiplier = | 761 | 20 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 762 | 20 | typename ToFieldType::NativeType max_result = | 763 | 20 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 764 | 20 | typename ToFieldType::NativeType min_result = -max_result; | 765 | | | 766 | 20 | ColumnUInt8::MutablePtr col_null_map_to; | 767 | 20 | NullMap::value_type* null_map_data = nullptr; | 768 | 20 | if (narrow_integral) { | 769 | 12 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 770 | 12 | null_map_data = col_null_map_to->get_data().data(); | 771 | 12 | } | 772 | | | 773 | 20 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 774 | 20 | const auto& vec_from = col_from->get_data(); | 775 | 20 | const auto* vec_from_data = vec_from.data(); | 776 | 20 | auto& vec_to = col_to->get_data(); | 777 | 20 | auto* vec_to_data = vec_to.data(); | 778 | | | 779 | 20 | CastParameters params; | 780 | 20 | params.is_strict = (CastMode == CastModeType::StrictMode); | 781 | 20 | size_t size = vec_from.size(); | 782 | | | 783 | 20 | RETURN_IF_ERROR(std::visit( | 784 | 20 | [&](auto multiply_may_overflow, auto narrow_integral) { | 785 | 20 | for (size_t i = 0; i < size; i++) { | 786 | 20 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 787 | 20 | typename ToDataType::FieldType, | 788 | 20 | multiply_may_overflow, narrow_integral>( | 789 | 20 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 790 | 20 | scale_multiplier, min_result, max_result, params)) { | 791 | 20 | if (set_nullable) { | 792 | 20 | null_map_data[i] = 1; | 793 | 20 | } else { | 794 | 20 | return params.status; | 795 | 20 | } | 796 | 20 | } | 797 | 20 | } | 798 | 20 | return Status::OK(); | 799 | 20 | }, | 800 | 20 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 801 | | | 802 | 20 | if (narrow_integral) { | 803 | 12 | block.get_by_position(result).column = | 804 | 12 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 805 | 12 | } else { | 806 | 8 | block.get_by_position(result).column = std::move(col_to); | 807 | 8 | } | 808 | 20 | return Status::OK(); | 809 | 20 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE7EEENS_15DataTypeDecimalILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 723 | 62 | const NullMap::value_type* null_map = nullptr) const override { | 724 | 62 | using FromFieldType = typename FromDataType::FieldType; | 725 | 62 | using ToFieldType = typename ToDataType::FieldType; | 726 | 62 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 727 | 62 | const auto* col_from = | 728 | 62 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 729 | 62 | if (!col_from) { | 730 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 731 | 0 | named_from.column->get_name()); | 732 | 0 | } | 733 | | | 734 | 62 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 735 | 62 | constexpr UInt32 from_scale = 0; | 736 | | | 737 | 62 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 738 | 62 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 739 | 62 | UInt32 to_precision = to_decimal_type.get_precision(); | 740 | 62 | ToDataType::check_type_precision(to_precision); | 741 | 62 | UInt32 to_scale = to_decimal_type.get_scale(); | 742 | 62 | ToDataType::check_type_scale(to_scale); | 743 | | | 744 | 62 | auto from_max_int_digit_count = from_precision - from_scale; | 745 | 62 | auto to_max_int_digit_count = to_precision - to_scale; | 746 | | // may overflow. nullable result column. | 747 | 62 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 748 | | // only in non-strict mode and may overflow, we set nullable | 749 | 62 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 750 | | | 751 | 62 | constexpr UInt32 to_max_digits = | 752 | 62 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 753 | 62 | bool multiply_may_overflow = false; | 754 | 62 | if (to_scale > from_scale) { | 755 | 40 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 756 | 40 | } | 757 | 62 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 758 | 62 | sizeof(typename ToFieldType::NativeType)), | 759 | 62 | FromFieldType, typename ToFieldType::NativeType>; | 760 | 62 | MaxNativeType scale_multiplier = | 761 | 62 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 762 | 62 | typename ToFieldType::NativeType max_result = | 763 | 62 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 764 | 62 | typename ToFieldType::NativeType min_result = -max_result; | 765 | | | 766 | 62 | ColumnUInt8::MutablePtr col_null_map_to; | 767 | 62 | NullMap::value_type* null_map_data = nullptr; | 768 | 62 | if (narrow_integral) { | 769 | 60 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 770 | 60 | null_map_data = col_null_map_to->get_data().data(); | 771 | 60 | } | 772 | | | 773 | 62 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 774 | 62 | const auto& vec_from = col_from->get_data(); | 775 | 62 | const auto* vec_from_data = vec_from.data(); | 776 | 62 | auto& vec_to = col_to->get_data(); | 777 | 62 | auto* vec_to_data = vec_to.data(); | 778 | | | 779 | 62 | CastParameters params; | 780 | 62 | params.is_strict = (CastMode == CastModeType::StrictMode); | 781 | 62 | size_t size = vec_from.size(); | 782 | | | 783 | 62 | RETURN_IF_ERROR(std::visit( | 784 | 62 | [&](auto multiply_may_overflow, auto narrow_integral) { | 785 | 62 | for (size_t i = 0; i < size; i++) { | 786 | 62 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 787 | 62 | typename ToDataType::FieldType, | 788 | 62 | multiply_may_overflow, narrow_integral>( | 789 | 62 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 790 | 62 | scale_multiplier, min_result, max_result, params)) { | 791 | 62 | if (set_nullable) { | 792 | 62 | null_map_data[i] = 1; | 793 | 62 | } else { | 794 | 62 | return params.status; | 795 | 62 | } | 796 | 62 | } | 797 | 62 | } | 798 | 62 | return Status::OK(); | 799 | 62 | }, | 800 | 62 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 801 | | | 802 | 14 | if (narrow_integral) { | 803 | 12 | block.get_by_position(result).column = | 804 | 12 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 805 | 12 | } else { | 806 | 2 | block.get_by_position(result).column = std::move(col_to); | 807 | 2 | } | 808 | 14 | return Status::OK(); | 809 | 62 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE7EEENS_15DataTypeDecimalILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 723 | 26 | const NullMap::value_type* null_map = nullptr) const override { | 724 | 26 | using FromFieldType = typename FromDataType::FieldType; | 725 | 26 | using ToFieldType = typename ToDataType::FieldType; | 726 | 26 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 727 | 26 | const auto* col_from = | 728 | 26 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 729 | 26 | if (!col_from) { | 730 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 731 | 0 | named_from.column->get_name()); | 732 | 0 | } | 733 | | | 734 | 26 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 735 | 26 | constexpr UInt32 from_scale = 0; | 736 | | | 737 | 26 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 738 | 26 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 739 | 26 | UInt32 to_precision = to_decimal_type.get_precision(); | 740 | 26 | ToDataType::check_type_precision(to_precision); | 741 | 26 | UInt32 to_scale = to_decimal_type.get_scale(); | 742 | 26 | ToDataType::check_type_scale(to_scale); | 743 | | | 744 | 26 | auto from_max_int_digit_count = from_precision - from_scale; | 745 | 26 | auto to_max_int_digit_count = to_precision - to_scale; | 746 | | // may overflow. nullable result column. | 747 | 26 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 748 | | // only in non-strict mode and may overflow, we set nullable | 749 | 26 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 750 | | | 751 | 26 | constexpr UInt32 to_max_digits = | 752 | 26 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 753 | 26 | bool multiply_may_overflow = false; | 754 | 26 | if (to_scale > from_scale) { | 755 | 16 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 756 | 16 | } | 757 | 26 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 758 | 26 | sizeof(typename ToFieldType::NativeType)), | 759 | 26 | FromFieldType, typename ToFieldType::NativeType>; | 760 | 26 | MaxNativeType scale_multiplier = | 761 | 26 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 762 | 26 | typename ToFieldType::NativeType max_result = | 763 | 26 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 764 | 26 | typename ToFieldType::NativeType min_result = -max_result; | 765 | | | 766 | 26 | ColumnUInt8::MutablePtr col_null_map_to; | 767 | 26 | NullMap::value_type* null_map_data = nullptr; | 768 | 26 | if (narrow_integral) { | 769 | 24 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 770 | 24 | null_map_data = col_null_map_to->get_data().data(); | 771 | 24 | } | 772 | | | 773 | 26 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 774 | 26 | const auto& vec_from = col_from->get_data(); | 775 | 26 | const auto* vec_from_data = vec_from.data(); | 776 | 26 | auto& vec_to = col_to->get_data(); | 777 | 26 | auto* vec_to_data = vec_to.data(); | 778 | | | 779 | 26 | CastParameters params; | 780 | 26 | params.is_strict = (CastMode == CastModeType::StrictMode); | 781 | 26 | size_t size = vec_from.size(); | 782 | | | 783 | 26 | RETURN_IF_ERROR(std::visit( | 784 | 26 | [&](auto multiply_may_overflow, auto narrow_integral) { | 785 | 26 | for (size_t i = 0; i < size; i++) { | 786 | 26 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 787 | 26 | typename ToDataType::FieldType, | 788 | 26 | multiply_may_overflow, narrow_integral>( | 789 | 26 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 790 | 26 | scale_multiplier, min_result, max_result, params)) { | 791 | 26 | if (set_nullable) { | 792 | 26 | null_map_data[i] = 1; | 793 | 26 | } else { | 794 | 26 | return params.status; | 795 | 26 | } | 796 | 26 | } | 797 | 26 | } | 798 | 26 | return Status::OK(); | 799 | 26 | }, | 800 | 26 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 801 | | | 802 | 26 | if (narrow_integral) { | 803 | 24 | block.get_by_position(result).column = | 804 | 24 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 805 | 24 | } else { | 806 | 2 | block.get_by_position(result).column = std::move(col_to); | 807 | 2 | } | 808 | 26 | return Status::OK(); | 809 | 26 | } |
|
810 | | }; |
811 | | |
812 | | // cast float and double to decimal. ALWAYS nullable result column. |
813 | | template <CastModeType CastMode, typename FromDataType, typename ToDataType> |
814 | | requires(IsDataTypeDecimal<ToDataType> && IsDataTypeFloat<FromDataType>) |
815 | | class CastToImpl<CastMode, FromDataType, ToDataType> : public CastToBase { |
816 | | public: |
817 | | Status execute_impl(FunctionContext* context, Block& block, const ColumnNumbers& arguments, |
818 | | uint32_t result, size_t input_rows_count, |
819 | 1.56k | const NullMap::value_type* null_map = nullptr) const override { |
820 | 1.56k | using FromFieldType = typename FromDataType::FieldType; |
821 | 1.56k | using ToFieldType = typename ToDataType::FieldType; |
822 | 1.56k | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); |
823 | 1.56k | const auto* col_from = |
824 | 1.56k | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); |
825 | 1.56k | if (!col_from) { |
826 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", |
827 | 0 | named_from.column->get_name()); |
828 | 0 | } |
829 | | |
830 | 1.56k | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); |
831 | 1.56k | UInt32 from_scale = 0; |
832 | | |
833 | 1.56k | const ColumnWithTypeAndName& named_to = block.get_by_position(result); |
834 | 1.56k | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); |
835 | 1.56k | UInt32 to_precision = to_decimal_type.get_precision(); |
836 | 1.56k | ToDataType::check_type_precision(to_precision); |
837 | 1.56k | UInt32 to_scale = to_decimal_type.get_scale(); |
838 | 1.56k | ToDataType::check_type_scale(to_scale); |
839 | | |
840 | 1.56k | auto from_max_int_digit_count = from_precision - from_scale; |
841 | 1.56k | auto to_max_int_digit_count = to_precision - to_scale; |
842 | 1.56k | bool narrow_integral = |
843 | 1.56k | (to_max_int_digit_count < from_max_int_digit_count) || |
844 | 1.56k | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); |
845 | | // only in non-strict mode and may overflow, we set nullable |
846 | 1.56k | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; |
847 | | |
848 | 1.56k | ColumnUInt8::MutablePtr col_null_map_to = ColumnUInt8::create(input_rows_count, 0); |
849 | 1.56k | NullMap::value_type* null_map_data = col_null_map_to->get_data().data(); |
850 | | |
851 | 1.56k | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); |
852 | 1.56k | const auto& vec_from = col_from->get_data(); |
853 | 1.56k | const auto* vec_from_data = vec_from.data(); |
854 | 1.56k | auto& vec_to = col_to->get_data(); |
855 | 1.56k | auto* vec_to_data = vec_to.data(); |
856 | | |
857 | 1.56k | CastParameters params; |
858 | 1.56k | params.is_strict = (CastMode == CastModeType::StrictMode); |
859 | 1.56k | size_t size = vec_from.size(); |
860 | | |
861 | 1.56k | typename ToFieldType::NativeType scale_multiplier = |
862 | 1.56k | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); |
863 | 1.56k | typename ToFieldType::NativeType max_result = |
864 | 1.56k | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); |
865 | 1.56k | typename ToFieldType::NativeType min_result = -max_result; |
866 | 7.98k | for (size_t i = 0; i < size; i++) { |
867 | 6.70k | if (!CastToDecimal::_from_float<typename FromDataType::FieldType, |
868 | 6.70k | typename ToDataType::FieldType>( |
869 | 6.70k | vec_from_data[i], vec_to_data[i], to_precision, to_scale, scale_multiplier, |
870 | 6.70k | min_result, max_result, params)) { |
871 | 576 | if (set_nullable) { |
872 | 288 | null_map_data[i] = 1; |
873 | 288 | } else { |
874 | 288 | return params.status; |
875 | 288 | } |
876 | 576 | } |
877 | 6.70k | } |
878 | | |
879 | 1.28k | block.get_by_position(result).column = |
880 | 1.28k | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); |
881 | 1.28k | return Status::OK(); |
882 | 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 | 819 | 36 | const NullMap::value_type* null_map = nullptr) const override { | 820 | 36 | using FromFieldType = typename FromDataType::FieldType; | 821 | 36 | using ToFieldType = typename ToDataType::FieldType; | 822 | 36 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 823 | 36 | const auto* col_from = | 824 | 36 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 825 | 36 | if (!col_from) { | 826 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 827 | 0 | named_from.column->get_name()); | 828 | 0 | } | 829 | | | 830 | 36 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 831 | 36 | UInt32 from_scale = 0; | 832 | | | 833 | 36 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 834 | 36 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 835 | 36 | UInt32 to_precision = to_decimal_type.get_precision(); | 836 | 36 | ToDataType::check_type_precision(to_precision); | 837 | 36 | UInt32 to_scale = to_decimal_type.get_scale(); | 838 | 36 | ToDataType::check_type_scale(to_scale); | 839 | | | 840 | 36 | auto from_max_int_digit_count = from_precision - from_scale; | 841 | 36 | auto to_max_int_digit_count = to_precision - to_scale; | 842 | 36 | bool narrow_integral = | 843 | 36 | (to_max_int_digit_count < from_max_int_digit_count) || | 844 | 36 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 845 | | // only in non-strict mode and may overflow, we set nullable | 846 | 36 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 847 | | | 848 | 36 | ColumnUInt8::MutablePtr col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 849 | 36 | NullMap::value_type* null_map_data = col_null_map_to->get_data().data(); | 850 | | | 851 | 36 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 852 | 36 | const auto& vec_from = col_from->get_data(); | 853 | 36 | const auto* vec_from_data = vec_from.data(); | 854 | 36 | auto& vec_to = col_to->get_data(); | 855 | 36 | auto* vec_to_data = vec_to.data(); | 856 | | | 857 | 36 | CastParameters params; | 858 | 36 | params.is_strict = (CastMode == CastModeType::StrictMode); | 859 | 36 | size_t size = vec_from.size(); | 860 | | | 861 | 36 | typename ToFieldType::NativeType scale_multiplier = | 862 | 36 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 863 | 36 | typename ToFieldType::NativeType max_result = | 864 | 36 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 865 | 36 | typename ToFieldType::NativeType min_result = -max_result; | 866 | 36 | for (size_t i = 0; i < size; i++) { | 867 | 36 | if (!CastToDecimal::_from_float<typename FromDataType::FieldType, | 868 | 36 | typename ToDataType::FieldType>( | 869 | 36 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, scale_multiplier, | 870 | 36 | min_result, max_result, params)) { | 871 | 36 | if (set_nullable) { | 872 | 0 | null_map_data[i] = 1; | 873 | 36 | } else { | 874 | 36 | return params.status; | 875 | 36 | } | 876 | 36 | } | 877 | 36 | } | 878 | | | 879 | 0 | block.get_by_position(result).column = | 880 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 881 | 0 | return Status::OK(); | 882 | 36 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE8EEENS_15DataTypeDecimalILS3_28EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 819 | 162 | const NullMap::value_type* null_map = nullptr) const override { | 820 | 162 | using FromFieldType = typename FromDataType::FieldType; | 821 | 162 | using ToFieldType = typename ToDataType::FieldType; | 822 | 162 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 823 | 162 | const auto* col_from = | 824 | 162 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 825 | 162 | if (!col_from) { | 826 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 827 | 0 | named_from.column->get_name()); | 828 | 0 | } | 829 | | | 830 | 162 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 831 | 162 | UInt32 from_scale = 0; | 832 | | | 833 | 162 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 834 | 162 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 835 | 162 | UInt32 to_precision = to_decimal_type.get_precision(); | 836 | 162 | ToDataType::check_type_precision(to_precision); | 837 | 162 | UInt32 to_scale = to_decimal_type.get_scale(); | 838 | 162 | ToDataType::check_type_scale(to_scale); | 839 | | | 840 | 162 | auto from_max_int_digit_count = from_precision - from_scale; | 841 | 162 | auto to_max_int_digit_count = to_precision - to_scale; | 842 | 162 | bool narrow_integral = | 843 | 162 | (to_max_int_digit_count < from_max_int_digit_count) || | 844 | 162 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 845 | | // only in non-strict mode and may overflow, we set nullable | 846 | 162 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 847 | | | 848 | 162 | ColumnUInt8::MutablePtr col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 849 | 162 | NullMap::value_type* null_map_data = col_null_map_to->get_data().data(); | 850 | | | 851 | 162 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 852 | 162 | const auto& vec_from = col_from->get_data(); | 853 | 162 | const auto* vec_from_data = vec_from.data(); | 854 | 162 | auto& vec_to = col_to->get_data(); | 855 | 162 | auto* vec_to_data = vec_to.data(); | 856 | | | 857 | 162 | CastParameters params; | 858 | 162 | params.is_strict = (CastMode == CastModeType::StrictMode); | 859 | 162 | size_t size = vec_from.size(); | 860 | | | 861 | 162 | typename ToFieldType::NativeType scale_multiplier = | 862 | 162 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 863 | 162 | typename ToFieldType::NativeType max_result = | 864 | 162 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 865 | 162 | typename ToFieldType::NativeType min_result = -max_result; | 866 | 982 | for (size_t i = 0; i < size; i++) { | 867 | 820 | if (!CastToDecimal::_from_float<typename FromDataType::FieldType, | 868 | 820 | typename ToDataType::FieldType>( | 869 | 820 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, scale_multiplier, | 870 | 820 | min_result, max_result, params)) { | 871 | 36 | if (set_nullable) { | 872 | 36 | null_map_data[i] = 1; | 873 | 36 | } else { | 874 | 0 | return params.status; | 875 | 0 | } | 876 | 36 | } | 877 | 820 | } | 878 | | | 879 | 162 | block.get_by_position(result).column = | 880 | 162 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 881 | 162 | return Status::OK(); | 882 | 162 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE9EEENS_15DataTypeDecimalILS3_28EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 819 | 36 | const NullMap::value_type* null_map = nullptr) const override { | 820 | 36 | using FromFieldType = typename FromDataType::FieldType; | 821 | 36 | using ToFieldType = typename ToDataType::FieldType; | 822 | 36 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 823 | 36 | const auto* col_from = | 824 | 36 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 825 | 36 | if (!col_from) { | 826 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 827 | 0 | named_from.column->get_name()); | 828 | 0 | } | 829 | | | 830 | 36 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 831 | 36 | UInt32 from_scale = 0; | 832 | | | 833 | 36 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 834 | 36 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 835 | 36 | UInt32 to_precision = to_decimal_type.get_precision(); | 836 | 36 | ToDataType::check_type_precision(to_precision); | 837 | 36 | UInt32 to_scale = to_decimal_type.get_scale(); | 838 | 36 | ToDataType::check_type_scale(to_scale); | 839 | | | 840 | 36 | auto from_max_int_digit_count = from_precision - from_scale; | 841 | 36 | auto to_max_int_digit_count = to_precision - to_scale; | 842 | 36 | bool narrow_integral = | 843 | 36 | (to_max_int_digit_count < from_max_int_digit_count) || | 844 | 36 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 845 | | // only in non-strict mode and may overflow, we set nullable | 846 | 36 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 847 | | | 848 | 36 | ColumnUInt8::MutablePtr col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 849 | 36 | NullMap::value_type* null_map_data = col_null_map_to->get_data().data(); | 850 | | | 851 | 36 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 852 | 36 | const auto& vec_from = col_from->get_data(); | 853 | 36 | const auto* vec_from_data = vec_from.data(); | 854 | 36 | auto& vec_to = col_to->get_data(); | 855 | 36 | auto* vec_to_data = vec_to.data(); | 856 | | | 857 | 36 | CastParameters params; | 858 | 36 | params.is_strict = (CastMode == CastModeType::StrictMode); | 859 | 36 | size_t size = vec_from.size(); | 860 | | | 861 | 36 | typename ToFieldType::NativeType scale_multiplier = | 862 | 36 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 863 | 36 | typename ToFieldType::NativeType max_result = | 864 | 36 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 865 | 36 | typename ToFieldType::NativeType min_result = -max_result; | 866 | 36 | for (size_t i = 0; i < size; i++) { | 867 | 36 | if (!CastToDecimal::_from_float<typename FromDataType::FieldType, | 868 | 36 | typename ToDataType::FieldType>( | 869 | 36 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, scale_multiplier, | 870 | 36 | min_result, max_result, params)) { | 871 | 36 | if (set_nullable) { | 872 | 0 | null_map_data[i] = 1; | 873 | 36 | } else { | 874 | 36 | return params.status; | 875 | 36 | } | 876 | 36 | } | 877 | 36 | } | 878 | | | 879 | 0 | block.get_by_position(result).column = | 880 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 881 | 0 | return Status::OK(); | 882 | 36 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE9EEENS_15DataTypeDecimalILS3_28EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 819 | 170 | const NullMap::value_type* null_map = nullptr) const override { | 820 | 170 | using FromFieldType = typename FromDataType::FieldType; | 821 | 170 | using ToFieldType = typename ToDataType::FieldType; | 822 | 170 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 823 | 170 | const auto* col_from = | 824 | 170 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 825 | 170 | if (!col_from) { | 826 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 827 | 0 | named_from.column->get_name()); | 828 | 0 | } | 829 | | | 830 | 170 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 831 | 170 | UInt32 from_scale = 0; | 832 | | | 833 | 170 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 834 | 170 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 835 | 170 | UInt32 to_precision = to_decimal_type.get_precision(); | 836 | 170 | ToDataType::check_type_precision(to_precision); | 837 | 170 | UInt32 to_scale = to_decimal_type.get_scale(); | 838 | 170 | ToDataType::check_type_scale(to_scale); | 839 | | | 840 | 170 | auto from_max_int_digit_count = from_precision - from_scale; | 841 | 170 | auto to_max_int_digit_count = to_precision - to_scale; | 842 | 170 | bool narrow_integral = | 843 | 170 | (to_max_int_digit_count < from_max_int_digit_count) || | 844 | 170 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 845 | | // only in non-strict mode and may overflow, we set nullable | 846 | 170 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 847 | | | 848 | 170 | ColumnUInt8::MutablePtr col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 849 | 170 | NullMap::value_type* null_map_data = col_null_map_to->get_data().data(); | 850 | | | 851 | 170 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 852 | 170 | const auto& vec_from = col_from->get_data(); | 853 | 170 | const auto* vec_from_data = vec_from.data(); | 854 | 170 | auto& vec_to = col_to->get_data(); | 855 | 170 | auto* vec_to_data = vec_to.data(); | 856 | | | 857 | 170 | CastParameters params; | 858 | 170 | params.is_strict = (CastMode == CastModeType::StrictMode); | 859 | 170 | size_t size = vec_from.size(); | 860 | | | 861 | 170 | typename ToFieldType::NativeType scale_multiplier = | 862 | 170 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 863 | 170 | typename ToFieldType::NativeType max_result = | 864 | 170 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 865 | 170 | typename ToFieldType::NativeType min_result = -max_result; | 866 | 1.01k | for (size_t i = 0; i < size; i++) { | 867 | 844 | if (!CastToDecimal::_from_float<typename FromDataType::FieldType, | 868 | 844 | typename ToDataType::FieldType>( | 869 | 844 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, scale_multiplier, | 870 | 844 | min_result, max_result, params)) { | 871 | 36 | if (set_nullable) { | 872 | 36 | null_map_data[i] = 1; | 873 | 36 | } else { | 874 | 0 | return params.status; | 875 | 0 | } | 876 | 36 | } | 877 | 844 | } | 878 | | | 879 | 170 | block.get_by_position(result).column = | 880 | 170 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 881 | 170 | return Status::OK(); | 882 | 170 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE8EEENS_15DataTypeDecimalILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 819 | 36 | const NullMap::value_type* null_map = nullptr) const override { | 820 | 36 | using FromFieldType = typename FromDataType::FieldType; | 821 | 36 | using ToFieldType = typename ToDataType::FieldType; | 822 | 36 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 823 | 36 | const auto* col_from = | 824 | 36 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 825 | 36 | if (!col_from) { | 826 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 827 | 0 | named_from.column->get_name()); | 828 | 0 | } | 829 | | | 830 | 36 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 831 | 36 | UInt32 from_scale = 0; | 832 | | | 833 | 36 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 834 | 36 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 835 | 36 | UInt32 to_precision = to_decimal_type.get_precision(); | 836 | 36 | ToDataType::check_type_precision(to_precision); | 837 | 36 | UInt32 to_scale = to_decimal_type.get_scale(); | 838 | 36 | ToDataType::check_type_scale(to_scale); | 839 | | | 840 | 36 | auto from_max_int_digit_count = from_precision - from_scale; | 841 | 36 | auto to_max_int_digit_count = to_precision - to_scale; | 842 | 36 | bool narrow_integral = | 843 | 36 | (to_max_int_digit_count < from_max_int_digit_count) || | 844 | 36 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 845 | | // only in non-strict mode and may overflow, we set nullable | 846 | 36 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 847 | | | 848 | 36 | ColumnUInt8::MutablePtr col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 849 | 36 | NullMap::value_type* null_map_data = col_null_map_to->get_data().data(); | 850 | | | 851 | 36 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 852 | 36 | const auto& vec_from = col_from->get_data(); | 853 | 36 | const auto* vec_from_data = vec_from.data(); | 854 | 36 | auto& vec_to = col_to->get_data(); | 855 | 36 | auto* vec_to_data = vec_to.data(); | 856 | | | 857 | 36 | CastParameters params; | 858 | 36 | params.is_strict = (CastMode == CastModeType::StrictMode); | 859 | 36 | size_t size = vec_from.size(); | 860 | | | 861 | 36 | typename ToFieldType::NativeType scale_multiplier = | 862 | 36 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 863 | 36 | typename ToFieldType::NativeType max_result = | 864 | 36 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 865 | 36 | typename ToFieldType::NativeType min_result = -max_result; | 866 | 36 | for (size_t i = 0; i < size; i++) { | 867 | 36 | if (!CastToDecimal::_from_float<typename FromDataType::FieldType, | 868 | 36 | typename ToDataType::FieldType>( | 869 | 36 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, scale_multiplier, | 870 | 36 | min_result, max_result, params)) { | 871 | 36 | if (set_nullable) { | 872 | 0 | null_map_data[i] = 1; | 873 | 36 | } else { | 874 | 36 | return params.status; | 875 | 36 | } | 876 | 36 | } | 877 | 36 | } | 878 | | | 879 | 0 | block.get_by_position(result).column = | 880 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 881 | 0 | return Status::OK(); | 882 | 36 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE8EEENS_15DataTypeDecimalILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 819 | 162 | const NullMap::value_type* null_map = nullptr) const override { | 820 | 162 | using FromFieldType = typename FromDataType::FieldType; | 821 | 162 | using ToFieldType = typename ToDataType::FieldType; | 822 | 162 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 823 | 162 | const auto* col_from = | 824 | 162 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 825 | 162 | if (!col_from) { | 826 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 827 | 0 | named_from.column->get_name()); | 828 | 0 | } | 829 | | | 830 | 162 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 831 | 162 | UInt32 from_scale = 0; | 832 | | | 833 | 162 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 834 | 162 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 835 | 162 | UInt32 to_precision = to_decimal_type.get_precision(); | 836 | 162 | ToDataType::check_type_precision(to_precision); | 837 | 162 | UInt32 to_scale = to_decimal_type.get_scale(); | 838 | 162 | ToDataType::check_type_scale(to_scale); | 839 | | | 840 | 162 | auto from_max_int_digit_count = from_precision - from_scale; | 841 | 162 | auto to_max_int_digit_count = to_precision - to_scale; | 842 | 162 | bool narrow_integral = | 843 | 162 | (to_max_int_digit_count < from_max_int_digit_count) || | 844 | 162 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 845 | | // only in non-strict mode and may overflow, we set nullable | 846 | 162 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 847 | | | 848 | 162 | ColumnUInt8::MutablePtr col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 849 | 162 | NullMap::value_type* null_map_data = col_null_map_to->get_data().data(); | 850 | | | 851 | 162 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 852 | 162 | const auto& vec_from = col_from->get_data(); | 853 | 162 | const auto* vec_from_data = vec_from.data(); | 854 | 162 | auto& vec_to = col_to->get_data(); | 855 | 162 | auto* vec_to_data = vec_to.data(); | 856 | | | 857 | 162 | CastParameters params; | 858 | 162 | params.is_strict = (CastMode == CastModeType::StrictMode); | 859 | 162 | size_t size = vec_from.size(); | 860 | | | 861 | 162 | typename ToFieldType::NativeType scale_multiplier = | 862 | 162 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 863 | 162 | typename ToFieldType::NativeType max_result = | 864 | 162 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 865 | 162 | typename ToFieldType::NativeType min_result = -max_result; | 866 | 886 | for (size_t i = 0; i < size; i++) { | 867 | 724 | if (!CastToDecimal::_from_float<typename FromDataType::FieldType, | 868 | 724 | typename ToDataType::FieldType>( | 869 | 724 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, scale_multiplier, | 870 | 724 | min_result, max_result, params)) { | 871 | 36 | if (set_nullable) { | 872 | 36 | null_map_data[i] = 1; | 873 | 36 | } else { | 874 | 0 | return params.status; | 875 | 0 | } | 876 | 36 | } | 877 | 724 | } | 878 | | | 879 | 162 | block.get_by_position(result).column = | 880 | 162 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 881 | 162 | return Status::OK(); | 882 | 162 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE9EEENS_15DataTypeDecimalILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 819 | 36 | const NullMap::value_type* null_map = nullptr) const override { | 820 | 36 | using FromFieldType = typename FromDataType::FieldType; | 821 | 36 | using ToFieldType = typename ToDataType::FieldType; | 822 | 36 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 823 | 36 | const auto* col_from = | 824 | 36 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 825 | 36 | if (!col_from) { | 826 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 827 | 0 | named_from.column->get_name()); | 828 | 0 | } | 829 | | | 830 | 36 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 831 | 36 | UInt32 from_scale = 0; | 832 | | | 833 | 36 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 834 | 36 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 835 | 36 | UInt32 to_precision = to_decimal_type.get_precision(); | 836 | 36 | ToDataType::check_type_precision(to_precision); | 837 | 36 | UInt32 to_scale = to_decimal_type.get_scale(); | 838 | 36 | ToDataType::check_type_scale(to_scale); | 839 | | | 840 | 36 | auto from_max_int_digit_count = from_precision - from_scale; | 841 | 36 | auto to_max_int_digit_count = to_precision - to_scale; | 842 | 36 | bool narrow_integral = | 843 | 36 | (to_max_int_digit_count < from_max_int_digit_count) || | 844 | 36 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 845 | | // only in non-strict mode and may overflow, we set nullable | 846 | 36 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 847 | | | 848 | 36 | ColumnUInt8::MutablePtr col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 849 | 36 | NullMap::value_type* null_map_data = col_null_map_to->get_data().data(); | 850 | | | 851 | 36 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 852 | 36 | const auto& vec_from = col_from->get_data(); | 853 | 36 | const auto* vec_from_data = vec_from.data(); | 854 | 36 | auto& vec_to = col_to->get_data(); | 855 | 36 | auto* vec_to_data = vec_to.data(); | 856 | | | 857 | 36 | CastParameters params; | 858 | 36 | params.is_strict = (CastMode == CastModeType::StrictMode); | 859 | 36 | size_t size = vec_from.size(); | 860 | | | 861 | 36 | typename ToFieldType::NativeType scale_multiplier = | 862 | 36 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 863 | 36 | typename ToFieldType::NativeType max_result = | 864 | 36 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 865 | 36 | typename ToFieldType::NativeType min_result = -max_result; | 866 | 36 | for (size_t i = 0; i < size; i++) { | 867 | 36 | if (!CastToDecimal::_from_float<typename FromDataType::FieldType, | 868 | 36 | typename ToDataType::FieldType>( | 869 | 36 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, scale_multiplier, | 870 | 36 | min_result, max_result, params)) { | 871 | 36 | if (set_nullable) { | 872 | 0 | null_map_data[i] = 1; | 873 | 36 | } else { | 874 | 36 | return params.status; | 875 | 36 | } | 876 | 36 | } | 877 | 36 | } | 878 | | | 879 | 0 | block.get_by_position(result).column = | 880 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 881 | 0 | return Status::OK(); | 882 | 36 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE9EEENS_15DataTypeDecimalILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 819 | 162 | const NullMap::value_type* null_map = nullptr) const override { | 820 | 162 | using FromFieldType = typename FromDataType::FieldType; | 821 | 162 | using ToFieldType = typename ToDataType::FieldType; | 822 | 162 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 823 | 162 | const auto* col_from = | 824 | 162 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 825 | 162 | if (!col_from) { | 826 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 827 | 0 | named_from.column->get_name()); | 828 | 0 | } | 829 | | | 830 | 162 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 831 | 162 | UInt32 from_scale = 0; | 832 | | | 833 | 162 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 834 | 162 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 835 | 162 | UInt32 to_precision = to_decimal_type.get_precision(); | 836 | 162 | ToDataType::check_type_precision(to_precision); | 837 | 162 | UInt32 to_scale = to_decimal_type.get_scale(); | 838 | 162 | ToDataType::check_type_scale(to_scale); | 839 | | | 840 | 162 | auto from_max_int_digit_count = from_precision - from_scale; | 841 | 162 | auto to_max_int_digit_count = to_precision - to_scale; | 842 | 162 | bool narrow_integral = | 843 | 162 | (to_max_int_digit_count < from_max_int_digit_count) || | 844 | 162 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 845 | | // only in non-strict mode and may overflow, we set nullable | 846 | 162 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 847 | | | 848 | 162 | ColumnUInt8::MutablePtr col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 849 | 162 | NullMap::value_type* null_map_data = col_null_map_to->get_data().data(); | 850 | | | 851 | 162 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 852 | 162 | const auto& vec_from = col_from->get_data(); | 853 | 162 | const auto* vec_from_data = vec_from.data(); | 854 | 162 | auto& vec_to = col_to->get_data(); | 855 | 162 | auto* vec_to_data = vec_to.data(); | 856 | | | 857 | 162 | CastParameters params; | 858 | 162 | params.is_strict = (CastMode == CastModeType::StrictMode); | 859 | 162 | size_t size = vec_from.size(); | 860 | | | 861 | 162 | typename ToFieldType::NativeType scale_multiplier = | 862 | 162 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 863 | 162 | typename ToFieldType::NativeType max_result = | 864 | 162 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 865 | 162 | typename ToFieldType::NativeType min_result = -max_result; | 866 | 982 | for (size_t i = 0; i < size; i++) { | 867 | 820 | if (!CastToDecimal::_from_float<typename FromDataType::FieldType, | 868 | 820 | typename ToDataType::FieldType>( | 869 | 820 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, scale_multiplier, | 870 | 820 | min_result, max_result, params)) { | 871 | 36 | if (set_nullable) { | 872 | 36 | null_map_data[i] = 1; | 873 | 36 | } else { | 874 | 0 | return params.status; | 875 | 0 | } | 876 | 36 | } | 877 | 820 | } | 878 | | | 879 | 162 | block.get_by_position(result).column = | 880 | 162 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 881 | 162 | return Status::OK(); | 882 | 162 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE8EEENS_15DataTypeDecimalILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 819 | 36 | const NullMap::value_type* null_map = nullptr) const override { | 820 | 36 | using FromFieldType = typename FromDataType::FieldType; | 821 | 36 | using ToFieldType = typename ToDataType::FieldType; | 822 | 36 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 823 | 36 | const auto* col_from = | 824 | 36 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 825 | 36 | if (!col_from) { | 826 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 827 | 0 | named_from.column->get_name()); | 828 | 0 | } | 829 | | | 830 | 36 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 831 | 36 | UInt32 from_scale = 0; | 832 | | | 833 | 36 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 834 | 36 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 835 | 36 | UInt32 to_precision = to_decimal_type.get_precision(); | 836 | 36 | ToDataType::check_type_precision(to_precision); | 837 | 36 | UInt32 to_scale = to_decimal_type.get_scale(); | 838 | 36 | ToDataType::check_type_scale(to_scale); | 839 | | | 840 | 36 | auto from_max_int_digit_count = from_precision - from_scale; | 841 | 36 | auto to_max_int_digit_count = to_precision - to_scale; | 842 | 36 | bool narrow_integral = | 843 | 36 | (to_max_int_digit_count < from_max_int_digit_count) || | 844 | 36 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 845 | | // only in non-strict mode and may overflow, we set nullable | 846 | 36 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 847 | | | 848 | 36 | ColumnUInt8::MutablePtr col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 849 | 36 | NullMap::value_type* null_map_data = col_null_map_to->get_data().data(); | 850 | | | 851 | 36 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 852 | 36 | const auto& vec_from = col_from->get_data(); | 853 | 36 | const auto* vec_from_data = vec_from.data(); | 854 | 36 | auto& vec_to = col_to->get_data(); | 855 | 36 | auto* vec_to_data = vec_to.data(); | 856 | | | 857 | 36 | CastParameters params; | 858 | 36 | params.is_strict = (CastMode == CastModeType::StrictMode); | 859 | 36 | size_t size = vec_from.size(); | 860 | | | 861 | 36 | typename ToFieldType::NativeType scale_multiplier = | 862 | 36 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 863 | 36 | typename ToFieldType::NativeType max_result = | 864 | 36 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 865 | 36 | typename ToFieldType::NativeType min_result = -max_result; | 866 | 36 | for (size_t i = 0; i < size; i++) { | 867 | 36 | if (!CastToDecimal::_from_float<typename FromDataType::FieldType, | 868 | 36 | typename ToDataType::FieldType>( | 869 | 36 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, scale_multiplier, | 870 | 36 | min_result, max_result, params)) { | 871 | 36 | if (set_nullable) { | 872 | 0 | null_map_data[i] = 1; | 873 | 36 | } else { | 874 | 36 | return params.status; | 875 | 36 | } | 876 | 36 | } | 877 | 36 | } | 878 | | | 879 | 0 | block.get_by_position(result).column = | 880 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 881 | 0 | return Status::OK(); | 882 | 36 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE8EEENS_15DataTypeDecimalILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 819 | 178 | const NullMap::value_type* null_map = nullptr) const override { | 820 | 178 | using FromFieldType = typename FromDataType::FieldType; | 821 | 178 | using ToFieldType = typename ToDataType::FieldType; | 822 | 178 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 823 | 178 | const auto* col_from = | 824 | 178 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 825 | 178 | if (!col_from) { | 826 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 827 | 0 | named_from.column->get_name()); | 828 | 0 | } | 829 | | | 830 | 178 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 831 | 178 | UInt32 from_scale = 0; | 832 | | | 833 | 178 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 834 | 178 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 835 | 178 | UInt32 to_precision = to_decimal_type.get_precision(); | 836 | 178 | ToDataType::check_type_precision(to_precision); | 837 | 178 | UInt32 to_scale = to_decimal_type.get_scale(); | 838 | 178 | ToDataType::check_type_scale(to_scale); | 839 | | | 840 | 178 | auto from_max_int_digit_count = from_precision - from_scale; | 841 | 178 | auto to_max_int_digit_count = to_precision - to_scale; | 842 | 178 | bool narrow_integral = | 843 | 178 | (to_max_int_digit_count < from_max_int_digit_count) || | 844 | 178 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 845 | | // only in non-strict mode and may overflow, we set nullable | 846 | 178 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 847 | | | 848 | 178 | ColumnUInt8::MutablePtr col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 849 | 178 | NullMap::value_type* null_map_data = col_null_map_to->get_data().data(); | 850 | | | 851 | 178 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 852 | 178 | const auto& vec_from = col_from->get_data(); | 853 | 178 | const auto* vec_from_data = vec_from.data(); | 854 | 178 | auto& vec_to = col_to->get_data(); | 855 | 178 | auto* vec_to_data = vec_to.data(); | 856 | | | 857 | 178 | CastParameters params; | 858 | 178 | params.is_strict = (CastMode == CastModeType::StrictMode); | 859 | 178 | size_t size = vec_from.size(); | 860 | | | 861 | 178 | typename ToFieldType::NativeType scale_multiplier = | 862 | 178 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 863 | 178 | typename ToFieldType::NativeType max_result = | 864 | 178 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 865 | 178 | typename ToFieldType::NativeType min_result = -max_result; | 866 | 1.03k | for (size_t i = 0; i < size; i++) { | 867 | 852 | if (!CastToDecimal::_from_float<typename FromDataType::FieldType, | 868 | 852 | typename ToDataType::FieldType>( | 869 | 852 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, scale_multiplier, | 870 | 852 | min_result, max_result, params)) { | 871 | 36 | if (set_nullable) { | 872 | 36 | null_map_data[i] = 1; | 873 | 36 | } else { | 874 | 0 | return params.status; | 875 | 0 | } | 876 | 36 | } | 877 | 852 | } | 878 | | | 879 | 178 | block.get_by_position(result).column = | 880 | 178 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 881 | 178 | return Status::OK(); | 882 | 178 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE9EEENS_15DataTypeDecimalILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 819 | 36 | const NullMap::value_type* null_map = nullptr) const override { | 820 | 36 | using FromFieldType = typename FromDataType::FieldType; | 821 | 36 | using ToFieldType = typename ToDataType::FieldType; | 822 | 36 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 823 | 36 | const auto* col_from = | 824 | 36 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 825 | 36 | if (!col_from) { | 826 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 827 | 0 | named_from.column->get_name()); | 828 | 0 | } | 829 | | | 830 | 36 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 831 | 36 | UInt32 from_scale = 0; | 832 | | | 833 | 36 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 834 | 36 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 835 | 36 | UInt32 to_precision = to_decimal_type.get_precision(); | 836 | 36 | ToDataType::check_type_precision(to_precision); | 837 | 36 | UInt32 to_scale = to_decimal_type.get_scale(); | 838 | 36 | ToDataType::check_type_scale(to_scale); | 839 | | | 840 | 36 | auto from_max_int_digit_count = from_precision - from_scale; | 841 | 36 | auto to_max_int_digit_count = to_precision - to_scale; | 842 | 36 | bool narrow_integral = | 843 | 36 | (to_max_int_digit_count < from_max_int_digit_count) || | 844 | 36 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 845 | | // only in non-strict mode and may overflow, we set nullable | 846 | 36 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 847 | | | 848 | 36 | ColumnUInt8::MutablePtr col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 849 | 36 | NullMap::value_type* null_map_data = col_null_map_to->get_data().data(); | 850 | | | 851 | 36 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 852 | 36 | const auto& vec_from = col_from->get_data(); | 853 | 36 | const auto* vec_from_data = vec_from.data(); | 854 | 36 | auto& vec_to = col_to->get_data(); | 855 | 36 | auto* vec_to_data = vec_to.data(); | 856 | | | 857 | 36 | CastParameters params; | 858 | 36 | params.is_strict = (CastMode == CastModeType::StrictMode); | 859 | 36 | size_t size = vec_from.size(); | 860 | | | 861 | 36 | typename ToFieldType::NativeType scale_multiplier = | 862 | 36 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 863 | 36 | typename ToFieldType::NativeType max_result = | 864 | 36 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 865 | 36 | typename ToFieldType::NativeType min_result = -max_result; | 866 | 36 | for (size_t i = 0; i < size; i++) { | 867 | 36 | if (!CastToDecimal::_from_float<typename FromDataType::FieldType, | 868 | 36 | typename ToDataType::FieldType>( | 869 | 36 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, scale_multiplier, | 870 | 36 | min_result, max_result, params)) { | 871 | 36 | if (set_nullable) { | 872 | 0 | null_map_data[i] = 1; | 873 | 36 | } else { | 874 | 36 | return params.status; | 875 | 36 | } | 876 | 36 | } | 877 | 36 | } | 878 | | | 879 | 0 | block.get_by_position(result).column = | 880 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 881 | 0 | return Status::OK(); | 882 | 36 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE9EEENS_15DataTypeDecimalILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 819 | 146 | const NullMap::value_type* null_map = nullptr) const override { | 820 | 146 | using FromFieldType = typename FromDataType::FieldType; | 821 | 146 | using ToFieldType = typename ToDataType::FieldType; | 822 | 146 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 823 | 146 | const auto* col_from = | 824 | 146 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 825 | 146 | if (!col_from) { | 826 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 827 | 0 | named_from.column->get_name()); | 828 | 0 | } | 829 | | | 830 | 146 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 831 | 146 | UInt32 from_scale = 0; | 832 | | | 833 | 146 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 834 | 146 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 835 | 146 | UInt32 to_precision = to_decimal_type.get_precision(); | 836 | 146 | ToDataType::check_type_precision(to_precision); | 837 | 146 | UInt32 to_scale = to_decimal_type.get_scale(); | 838 | 146 | ToDataType::check_type_scale(to_scale); | 839 | | | 840 | 146 | auto from_max_int_digit_count = from_precision - from_scale; | 841 | 146 | auto to_max_int_digit_count = to_precision - to_scale; | 842 | 146 | bool narrow_integral = | 843 | 146 | (to_max_int_digit_count < from_max_int_digit_count) || | 844 | 146 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 845 | | // only in non-strict mode and may overflow, we set nullable | 846 | 146 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 847 | | | 848 | 146 | ColumnUInt8::MutablePtr col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 849 | 146 | NullMap::value_type* null_map_data = col_null_map_to->get_data().data(); | 850 | | | 851 | 146 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 852 | 146 | const auto& vec_from = col_from->get_data(); | 853 | 146 | const auto* vec_from_data = vec_from.data(); | 854 | 146 | auto& vec_to = col_to->get_data(); | 855 | 146 | auto* vec_to_data = vec_to.data(); | 856 | | | 857 | 146 | CastParameters params; | 858 | 146 | params.is_strict = (CastMode == CastModeType::StrictMode); | 859 | 146 | size_t size = vec_from.size(); | 860 | | | 861 | 146 | typename ToFieldType::NativeType scale_multiplier = | 862 | 146 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 863 | 146 | typename ToFieldType::NativeType max_result = | 864 | 146 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 865 | 146 | typename ToFieldType::NativeType min_result = -max_result; | 866 | 854 | for (size_t i = 0; i < size; i++) { | 867 | 708 | if (!CastToDecimal::_from_float<typename FromDataType::FieldType, | 868 | 708 | typename ToDataType::FieldType>( | 869 | 708 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, scale_multiplier, | 870 | 708 | min_result, max_result, params)) { | 871 | 36 | if (set_nullable) { | 872 | 36 | null_map_data[i] = 1; | 873 | 36 | } else { | 874 | 0 | return params.status; | 875 | 0 | } | 876 | 36 | } | 877 | 708 | } | 878 | | | 879 | 146 | block.get_by_position(result).column = | 880 | 146 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 881 | 146 | return Status::OK(); | 882 | 146 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE8EEENS_15DataTypeDecimalILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 819 | 36 | const NullMap::value_type* null_map = nullptr) const override { | 820 | 36 | using FromFieldType = typename FromDataType::FieldType; | 821 | 36 | using ToFieldType = typename ToDataType::FieldType; | 822 | 36 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 823 | 36 | const auto* col_from = | 824 | 36 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 825 | 36 | if (!col_from) { | 826 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 827 | 0 | named_from.column->get_name()); | 828 | 0 | } | 829 | | | 830 | 36 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 831 | 36 | UInt32 from_scale = 0; | 832 | | | 833 | 36 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 834 | 36 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 835 | 36 | UInt32 to_precision = to_decimal_type.get_precision(); | 836 | 36 | ToDataType::check_type_precision(to_precision); | 837 | 36 | UInt32 to_scale = to_decimal_type.get_scale(); | 838 | 36 | ToDataType::check_type_scale(to_scale); | 839 | | | 840 | 36 | auto from_max_int_digit_count = from_precision - from_scale; | 841 | 36 | auto to_max_int_digit_count = to_precision - to_scale; | 842 | 36 | bool narrow_integral = | 843 | 36 | (to_max_int_digit_count < from_max_int_digit_count) || | 844 | 36 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 845 | | // only in non-strict mode and may overflow, we set nullable | 846 | 36 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 847 | | | 848 | 36 | ColumnUInt8::MutablePtr col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 849 | 36 | NullMap::value_type* null_map_data = col_null_map_to->get_data().data(); | 850 | | | 851 | 36 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 852 | 36 | const auto& vec_from = col_from->get_data(); | 853 | 36 | const auto* vec_from_data = vec_from.data(); | 854 | 36 | auto& vec_to = col_to->get_data(); | 855 | 36 | auto* vec_to_data = vec_to.data(); | 856 | | | 857 | 36 | CastParameters params; | 858 | 36 | params.is_strict = (CastMode == CastModeType::StrictMode); | 859 | 36 | size_t size = vec_from.size(); | 860 | | | 861 | 36 | typename ToFieldType::NativeType scale_multiplier = | 862 | 36 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 863 | 36 | typename ToFieldType::NativeType max_result = | 864 | 36 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 865 | 36 | typename ToFieldType::NativeType min_result = -max_result; | 866 | 36 | for (size_t i = 0; i < size; i++) { | 867 | 36 | if (!CastToDecimal::_from_float<typename FromDataType::FieldType, | 868 | 36 | typename ToDataType::FieldType>( | 869 | 36 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, scale_multiplier, | 870 | 36 | min_result, max_result, params)) { | 871 | 36 | if (set_nullable) { | 872 | 0 | null_map_data[i] = 1; | 873 | 36 | } else { | 874 | 36 | return params.status; | 875 | 36 | } | 876 | 36 | } | 877 | 36 | } | 878 | | | 879 | 0 | block.get_by_position(result).column = | 880 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 881 | 0 | return Status::OK(); | 882 | 36 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE8EEENS_15DataTypeDecimalILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 819 | 138 | const NullMap::value_type* null_map = nullptr) const override { | 820 | 138 | using FromFieldType = typename FromDataType::FieldType; | 821 | 138 | using ToFieldType = typename ToDataType::FieldType; | 822 | 138 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 823 | 138 | const auto* col_from = | 824 | 138 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 825 | 138 | if (!col_from) { | 826 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 827 | 0 | named_from.column->get_name()); | 828 | 0 | } | 829 | | | 830 | 138 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 831 | 138 | UInt32 from_scale = 0; | 832 | | | 833 | 138 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 834 | 138 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 835 | 138 | UInt32 to_precision = to_decimal_type.get_precision(); | 836 | 138 | ToDataType::check_type_precision(to_precision); | 837 | 138 | UInt32 to_scale = to_decimal_type.get_scale(); | 838 | 138 | ToDataType::check_type_scale(to_scale); | 839 | | | 840 | 138 | auto from_max_int_digit_count = from_precision - from_scale; | 841 | 138 | auto to_max_int_digit_count = to_precision - to_scale; | 842 | 138 | bool narrow_integral = | 843 | 138 | (to_max_int_digit_count < from_max_int_digit_count) || | 844 | 138 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 845 | | // only in non-strict mode and may overflow, we set nullable | 846 | 138 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 847 | | | 848 | 138 | ColumnUInt8::MutablePtr col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 849 | 138 | NullMap::value_type* null_map_data = col_null_map_to->get_data().data(); | 850 | | | 851 | 138 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 852 | 138 | const auto& vec_from = col_from->get_data(); | 853 | 138 | const auto* vec_from_data = vec_from.data(); | 854 | 138 | auto& vec_to = col_to->get_data(); | 855 | 138 | auto* vec_to_data = vec_to.data(); | 856 | | | 857 | 138 | CastParameters params; | 858 | 138 | params.is_strict = (CastMode == CastModeType::StrictMode); | 859 | 138 | size_t size = vec_from.size(); | 860 | | | 861 | 138 | typename ToFieldType::NativeType scale_multiplier = | 862 | 138 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 863 | 138 | typename ToFieldType::NativeType max_result = | 864 | 138 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 865 | 138 | typename ToFieldType::NativeType min_result = -max_result; | 866 | 950 | for (size_t i = 0; i < size; i++) { | 867 | 812 | if (!CastToDecimal::_from_float<typename FromDataType::FieldType, | 868 | 812 | typename ToDataType::FieldType>( | 869 | 812 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, scale_multiplier, | 870 | 812 | min_result, max_result, params)) { | 871 | 36 | if (set_nullable) { | 872 | 36 | null_map_data[i] = 1; | 873 | 36 | } else { | 874 | 0 | return params.status; | 875 | 0 | } | 876 | 36 | } | 877 | 812 | } | 878 | | | 879 | 138 | block.get_by_position(result).column = | 880 | 138 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 881 | 138 | return Status::OK(); | 882 | 138 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE9EEENS_15DataTypeDecimalILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 819 | 36 | const NullMap::value_type* null_map = nullptr) const override { | 820 | 36 | using FromFieldType = typename FromDataType::FieldType; | 821 | 36 | using ToFieldType = typename ToDataType::FieldType; | 822 | 36 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 823 | 36 | const auto* col_from = | 824 | 36 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 825 | 36 | if (!col_from) { | 826 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 827 | 0 | named_from.column->get_name()); | 828 | 0 | } | 829 | | | 830 | 36 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 831 | 36 | UInt32 from_scale = 0; | 832 | | | 833 | 36 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 834 | 36 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 835 | 36 | UInt32 to_precision = to_decimal_type.get_precision(); | 836 | 36 | ToDataType::check_type_precision(to_precision); | 837 | 36 | UInt32 to_scale = to_decimal_type.get_scale(); | 838 | 36 | ToDataType::check_type_scale(to_scale); | 839 | | | 840 | 36 | auto from_max_int_digit_count = from_precision - from_scale; | 841 | 36 | auto to_max_int_digit_count = to_precision - to_scale; | 842 | 36 | bool narrow_integral = | 843 | 36 | (to_max_int_digit_count < from_max_int_digit_count) || | 844 | 36 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 845 | | // only in non-strict mode and may overflow, we set nullable | 846 | 36 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 847 | | | 848 | 36 | ColumnUInt8::MutablePtr col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 849 | 36 | NullMap::value_type* null_map_data = col_null_map_to->get_data().data(); | 850 | | | 851 | 36 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 852 | 36 | const auto& vec_from = col_from->get_data(); | 853 | 36 | const auto* vec_from_data = vec_from.data(); | 854 | 36 | auto& vec_to = col_to->get_data(); | 855 | 36 | auto* vec_to_data = vec_to.data(); | 856 | | | 857 | 36 | CastParameters params; | 858 | 36 | params.is_strict = (CastMode == CastModeType::StrictMode); | 859 | 36 | size_t size = vec_from.size(); | 860 | | | 861 | 36 | typename ToFieldType::NativeType scale_multiplier = | 862 | 36 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 863 | 36 | typename ToFieldType::NativeType max_result = | 864 | 36 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 865 | 36 | typename ToFieldType::NativeType min_result = -max_result; | 866 | 36 | for (size_t i = 0; i < size; i++) { | 867 | 36 | if (!CastToDecimal::_from_float<typename FromDataType::FieldType, | 868 | 36 | typename ToDataType::FieldType>( | 869 | 36 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, scale_multiplier, | 870 | 36 | min_result, max_result, params)) { | 871 | 36 | if (set_nullable) { | 872 | 0 | null_map_data[i] = 1; | 873 | 36 | } else { | 874 | 36 | return params.status; | 875 | 36 | } | 876 | 36 | } | 877 | 36 | } | 878 | | | 879 | 0 | block.get_by_position(result).column = | 880 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 881 | 0 | return Status::OK(); | 882 | 36 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE9EEENS_15DataTypeDecimalILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 819 | 162 | const NullMap::value_type* null_map = nullptr) const override { | 820 | 162 | using FromFieldType = typename FromDataType::FieldType; | 821 | 162 | using ToFieldType = typename ToDataType::FieldType; | 822 | 162 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 823 | 162 | const auto* col_from = | 824 | 162 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 825 | 162 | if (!col_from) { | 826 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 827 | 0 | named_from.column->get_name()); | 828 | 0 | } | 829 | | | 830 | 162 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 831 | 162 | UInt32 from_scale = 0; | 832 | | | 833 | 162 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 834 | 162 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 835 | 162 | UInt32 to_precision = to_decimal_type.get_precision(); | 836 | 162 | ToDataType::check_type_precision(to_precision); | 837 | 162 | UInt32 to_scale = to_decimal_type.get_scale(); | 838 | 162 | ToDataType::check_type_scale(to_scale); | 839 | | | 840 | 162 | auto from_max_int_digit_count = from_precision - from_scale; | 841 | 162 | auto to_max_int_digit_count = to_precision - to_scale; | 842 | 162 | bool narrow_integral = | 843 | 162 | (to_max_int_digit_count < from_max_int_digit_count) || | 844 | 162 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 845 | | // only in non-strict mode and may overflow, we set nullable | 846 | 162 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 847 | | | 848 | 162 | ColumnUInt8::MutablePtr col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 849 | 162 | NullMap::value_type* null_map_data = col_null_map_to->get_data().data(); | 850 | | | 851 | 162 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 852 | 162 | const auto& vec_from = col_from->get_data(); | 853 | 162 | const auto* vec_from_data = vec_from.data(); | 854 | 162 | auto& vec_to = col_to->get_data(); | 855 | 162 | auto* vec_to_data = vec_to.data(); | 856 | | | 857 | 162 | CastParameters params; | 858 | 162 | params.is_strict = (CastMode == CastModeType::StrictMode); | 859 | 162 | size_t size = vec_from.size(); | 860 | | | 861 | 162 | typename ToFieldType::NativeType scale_multiplier = | 862 | 162 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 863 | 162 | typename ToFieldType::NativeType max_result = | 864 | 162 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 865 | 162 | typename ToFieldType::NativeType min_result = -max_result; | 866 | 998 | for (size_t i = 0; i < size; i++) { | 867 | 836 | if (!CastToDecimal::_from_float<typename FromDataType::FieldType, | 868 | 836 | typename ToDataType::FieldType>( | 869 | 836 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, scale_multiplier, | 870 | 836 | min_result, max_result, params)) { | 871 | 36 | if (set_nullable) { | 872 | 36 | null_map_data[i] = 1; | 873 | 36 | } else { | 874 | 0 | return params.status; | 875 | 0 | } | 876 | 36 | } | 877 | 836 | } | 878 | | | 879 | 162 | block.get_by_position(result).column = | 880 | 162 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 881 | 162 | return Status::OK(); | 882 | 162 | } |
|
883 | | }; |
884 | | |
885 | | // cast decimalv3 types to decimalv2 types |
886 | | template <CastModeType CastMode, typename FromDataType, typename ToDataType> |
887 | | requires(IsDataTypeDecimalV3<ToDataType> && IsDataTypeDecimalV2<ToDataType>) |
888 | | class CastToImpl<CastMode, FromDataType, ToDataType> : public CastToBase { |
889 | | public: |
890 | | Status execute_impl(FunctionContext* context, Block& block, const ColumnNumbers& arguments, |
891 | | uint32_t result, size_t input_rows_count, |
892 | | const NullMap::value_type* null_map = nullptr) const override { |
893 | | return Status::RuntimeError( |
894 | | "not support {} ", |
895 | | cast_mode_type_to_string(CastMode, block.get_by_position(arguments[0]).type, |
896 | | block.get_by_position(result).type)); |
897 | | } |
898 | | }; |
899 | | |
900 | | // cast decimalv2 types to decimalv3 types |
901 | | template <CastModeType CastMode, typename FromDataType, typename ToDataType> |
902 | | requires(IsDataTypeDecimalV2<FromDataType> && IsDataTypeDecimalV3<ToDataType>) |
903 | | class CastToImpl<CastMode, FromDataType, ToDataType> : public CastToBase { |
904 | | public: |
905 | | Status execute_impl(FunctionContext* context, Block& block, const ColumnNumbers& arguments, |
906 | | uint32_t result, size_t input_rows_count, |
907 | 1.21k | const NullMap::value_type* null_map = nullptr) const override { |
908 | 1.21k | using FromFieldType = typename FromDataType::FieldType; |
909 | 1.21k | using ToFieldType = typename ToDataType::FieldType; |
910 | 1.21k | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); |
911 | 1.21k | const auto* col_from = |
912 | 1.21k | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); |
913 | 1.21k | if (!col_from) { |
914 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", |
915 | 0 | named_from.column->get_name()); |
916 | 0 | } |
917 | | |
918 | 1.21k | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); |
919 | 1.21k | UInt32 from_precision = from_decimal_type.get_precision(); |
920 | 1.21k | UInt32 from_scale = from_decimal_type.get_scale(); |
921 | 1.21k | UInt32 from_original_precision = from_decimal_type.get_original_precision(); |
922 | 1.21k | UInt32 from_original_scale = from_decimal_type.get_original_scale(); |
923 | | |
924 | 1.21k | const ColumnWithTypeAndName& named_to = block.get_by_position(result); |
925 | 1.21k | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); |
926 | 1.21k | UInt32 to_precision = to_decimal_type.get_precision(); |
927 | 1.21k | ToDataType::check_type_precision(to_precision); |
928 | 1.21k | UInt32 to_scale = to_decimal_type.get_scale(); |
929 | 1.21k | ToDataType::check_type_scale(to_scale); |
930 | | |
931 | 1.21k | auto from_max_int_digit_count = from_original_precision - from_original_scale; |
932 | 1.21k | auto to_max_int_digit_count = to_precision - to_scale; |
933 | 1.21k | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count) || |
934 | 1.21k | (to_max_int_digit_count == from_max_int_digit_count && |
935 | 432 | to_scale < from_original_scale); |
936 | | // only in non-strict mode and may overflow, we set nullable |
937 | 1.21k | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; |
938 | | |
939 | 1.21k | size_t size = col_from->size(); |
940 | 1.21k | ColumnUInt8::MutablePtr col_null_map_to; |
941 | 1.21k | NullMap::value_type* null_map_data = nullptr; |
942 | 1.21k | if (narrow_integral) { |
943 | 820 | col_null_map_to = ColumnUInt8::create(size, 0); |
944 | 820 | null_map_data = col_null_map_to->get_data().data(); |
945 | 820 | } |
946 | 1.21k | CastParameters params; |
947 | 1.21k | params.is_strict = (CastMode == CastModeType::StrictMode); |
948 | 1.21k | auto col_to = ToDataType::ColumnType::create(size, to_scale); |
949 | 1.21k | const auto& vec_from = col_from->get_data(); |
950 | 1.21k | const auto* vec_from_data = vec_from.data(); |
951 | 1.21k | auto& vec_to = col_to->get_data(); |
952 | 1.21k | auto* vec_to_data = vec_to.data(); |
953 | | |
954 | 1.21k | using MaxFieldType = |
955 | 1.21k | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && |
956 | 1.21k | (std::is_same_v<ToFieldType, Decimal128V3> || |
957 | 1.21k | std::is_same_v<FromFieldType, Decimal128V3>), |
958 | 1.21k | Decimal128V3, |
959 | 1.21k | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), |
960 | 1.21k | FromFieldType, ToFieldType>>; |
961 | 1.21k | using MaxNativeType = typename MaxFieldType::NativeType; |
962 | | |
963 | 1.21k | constexpr UInt32 to_max_digits = |
964 | 1.21k | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); |
965 | 1.21k | bool multiply_may_overflow = false; |
966 | 1.21k | if (to_scale > from_scale) { |
967 | 372 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; |
968 | 372 | } |
969 | | |
970 | 1.21k | typename ToFieldType::NativeType max_result = |
971 | 1.21k | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); |
972 | 1.21k | typename ToFieldType::NativeType min_result = -max_result; |
973 | | |
974 | 1.21k | MaxNativeType multiplier {}; |
975 | 1.21k | if (from_scale < to_scale) { |
976 | 372 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - |
977 | 372 | from_scale); |
978 | 844 | } else if (from_scale > to_scale) { |
979 | 776 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - |
980 | 776 | to_scale); |
981 | 776 | } |
982 | 1.21k | RETURN_IF_ERROR(std::visit( |
983 | 1.21k | [&](auto multiply_may_overflow, auto narrow_integral) { |
984 | 1.21k | for (size_t i = 0; i < size; i++) { |
985 | 1.21k | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, |
986 | 1.21k | multiply_may_overflow, narrow_integral>( |
987 | 1.21k | vec_from_data[i], from_precision, from_scale, vec_to_data[i], |
988 | 1.21k | to_precision, to_scale, min_result, max_result, multiplier, |
989 | 1.21k | params)) { |
990 | 1.21k | if (set_nullable) { |
991 | 1.21k | null_map_data[i] = 1; |
992 | 1.21k | } else { |
993 | 1.21k | return params.status; |
994 | 1.21k | } |
995 | 1.21k | } |
996 | 1.21k | } |
997 | 1.21k | return Status::OK(); |
998 | 1.21k | }, |
999 | 1.21k | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); |
1000 | 774 | if (narrow_integral) { |
1001 | 378 | block.get_by_position(result).column = |
1002 | 378 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); |
1003 | 396 | } else { |
1004 | 396 | block.get_by_position(result).column = std::move(col_to); |
1005 | 396 | } |
1006 | 774 | return Status::OK(); |
1007 | 1.21k | } _ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEENS2_ILS3_28EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 907 | 174 | const NullMap::value_type* null_map = nullptr) const override { | 908 | 174 | using FromFieldType = typename FromDataType::FieldType; | 909 | 174 | using ToFieldType = typename ToDataType::FieldType; | 910 | 174 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 911 | 174 | const auto* col_from = | 912 | 174 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 913 | 174 | if (!col_from) { | 914 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 915 | 0 | named_from.column->get_name()); | 916 | 0 | } | 917 | | | 918 | 174 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 919 | 174 | UInt32 from_precision = from_decimal_type.get_precision(); | 920 | 174 | UInt32 from_scale = from_decimal_type.get_scale(); | 921 | 174 | UInt32 from_original_precision = from_decimal_type.get_original_precision(); | 922 | 174 | UInt32 from_original_scale = from_decimal_type.get_original_scale(); | 923 | | | 924 | 174 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 925 | 174 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 926 | 174 | UInt32 to_precision = to_decimal_type.get_precision(); | 927 | 174 | ToDataType::check_type_precision(to_precision); | 928 | 174 | UInt32 to_scale = to_decimal_type.get_scale(); | 929 | 174 | ToDataType::check_type_scale(to_scale); | 930 | | | 931 | 174 | auto from_max_int_digit_count = from_original_precision - from_original_scale; | 932 | 174 | auto to_max_int_digit_count = to_precision - to_scale; | 933 | 174 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count) || | 934 | 174 | (to_max_int_digit_count == from_max_int_digit_count && | 935 | 0 | to_scale < from_original_scale); | 936 | | // only in non-strict mode and may overflow, we set nullable | 937 | 174 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 938 | | | 939 | 174 | size_t size = col_from->size(); | 940 | 174 | ColumnUInt8::MutablePtr col_null_map_to; | 941 | 174 | NullMap::value_type* null_map_data = nullptr; | 942 | 174 | if (narrow_integral) { | 943 | 174 | col_null_map_to = ColumnUInt8::create(size, 0); | 944 | 174 | null_map_data = col_null_map_to->get_data().data(); | 945 | 174 | } | 946 | 174 | CastParameters params; | 947 | 174 | params.is_strict = (CastMode == CastModeType::StrictMode); | 948 | 174 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 949 | 174 | const auto& vec_from = col_from->get_data(); | 950 | 174 | const auto* vec_from_data = vec_from.data(); | 951 | 174 | auto& vec_to = col_to->get_data(); | 952 | 174 | auto* vec_to_data = vec_to.data(); | 953 | | | 954 | 174 | using MaxFieldType = | 955 | 174 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 956 | 174 | (std::is_same_v<ToFieldType, Decimal128V3> || | 957 | 174 | std::is_same_v<FromFieldType, Decimal128V3>), | 958 | 174 | Decimal128V3, | 959 | 174 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 960 | 174 | FromFieldType, ToFieldType>>; | 961 | 174 | using MaxNativeType = typename MaxFieldType::NativeType; | 962 | | | 963 | 174 | constexpr UInt32 to_max_digits = | 964 | 174 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 965 | 174 | bool multiply_may_overflow = false; | 966 | 174 | if (to_scale > from_scale) { | 967 | 0 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 968 | 0 | } | 969 | | | 970 | 174 | typename ToFieldType::NativeType max_result = | 971 | 174 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 972 | 174 | typename ToFieldType::NativeType min_result = -max_result; | 973 | | | 974 | 174 | MaxNativeType multiplier {}; | 975 | 174 | if (from_scale < to_scale) { | 976 | 0 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 977 | 0 | from_scale); | 978 | 174 | } else if (from_scale > to_scale) { | 979 | 156 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 980 | 156 | to_scale); | 981 | 156 | } | 982 | 174 | RETURN_IF_ERROR(std::visit( | 983 | 174 | [&](auto multiply_may_overflow, auto narrow_integral) { | 984 | 174 | for (size_t i = 0; i < size; i++) { | 985 | 174 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 986 | 174 | multiply_may_overflow, narrow_integral>( | 987 | 174 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 988 | 174 | to_precision, to_scale, min_result, max_result, multiplier, | 989 | 174 | params)) { | 990 | 174 | if (set_nullable) { | 991 | 174 | null_map_data[i] = 1; | 992 | 174 | } else { | 993 | 174 | return params.status; | 994 | 174 | } | 995 | 174 | } | 996 | 174 | } | 997 | 174 | return Status::OK(); | 998 | 174 | }, | 999 | 174 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1000 | 0 | if (narrow_integral) { | 1001 | 0 | block.get_by_position(result).column = | 1002 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1003 | 0 | } else { | 1004 | 0 | block.get_by_position(result).column = std::move(col_to); | 1005 | 0 | } | 1006 | 0 | return Status::OK(); | 1007 | 174 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEENS2_ILS3_28EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 907 | 148 | const NullMap::value_type* null_map = nullptr) const override { | 908 | 148 | using FromFieldType = typename FromDataType::FieldType; | 909 | 148 | using ToFieldType = typename ToDataType::FieldType; | 910 | 148 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 911 | 148 | const auto* col_from = | 912 | 148 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 913 | 148 | if (!col_from) { | 914 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 915 | 0 | named_from.column->get_name()); | 916 | 0 | } | 917 | | | 918 | 148 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 919 | 148 | UInt32 from_precision = from_decimal_type.get_precision(); | 920 | 148 | UInt32 from_scale = from_decimal_type.get_scale(); | 921 | 148 | UInt32 from_original_precision = from_decimal_type.get_original_precision(); | 922 | 148 | UInt32 from_original_scale = from_decimal_type.get_original_scale(); | 923 | | | 924 | 148 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 925 | 148 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 926 | 148 | UInt32 to_precision = to_decimal_type.get_precision(); | 927 | 148 | ToDataType::check_type_precision(to_precision); | 928 | 148 | UInt32 to_scale = to_decimal_type.get_scale(); | 929 | 148 | ToDataType::check_type_scale(to_scale); | 930 | | | 931 | 148 | auto from_max_int_digit_count = from_original_precision - from_original_scale; | 932 | 148 | auto to_max_int_digit_count = to_precision - to_scale; | 933 | 148 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count) || | 934 | 148 | (to_max_int_digit_count == from_max_int_digit_count && | 935 | 36 | to_scale < from_original_scale); | 936 | | // only in non-strict mode and may overflow, we set nullable | 937 | 148 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 938 | | | 939 | 148 | size_t size = col_from->size(); | 940 | 148 | ColumnUInt8::MutablePtr col_null_map_to; | 941 | 148 | NullMap::value_type* null_map_data = nullptr; | 942 | 148 | if (narrow_integral) { | 943 | 112 | col_null_map_to = ColumnUInt8::create(size, 0); | 944 | 112 | null_map_data = col_null_map_to->get_data().data(); | 945 | 112 | } | 946 | 148 | CastParameters params; | 947 | 148 | params.is_strict = (CastMode == CastModeType::StrictMode); | 948 | 148 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 949 | 148 | const auto& vec_from = col_from->get_data(); | 950 | 148 | const auto* vec_from_data = vec_from.data(); | 951 | 148 | auto& vec_to = col_to->get_data(); | 952 | 148 | auto* vec_to_data = vec_to.data(); | 953 | | | 954 | 148 | using MaxFieldType = | 955 | 148 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 956 | 148 | (std::is_same_v<ToFieldType, Decimal128V3> || | 957 | 148 | std::is_same_v<FromFieldType, Decimal128V3>), | 958 | 148 | Decimal128V3, | 959 | 148 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 960 | 148 | FromFieldType, ToFieldType>>; | 961 | 148 | using MaxNativeType = typename MaxFieldType::NativeType; | 962 | | | 963 | 148 | constexpr UInt32 to_max_digits = | 964 | 148 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 965 | 148 | bool multiply_may_overflow = false; | 966 | 148 | if (to_scale > from_scale) { | 967 | 0 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 968 | 0 | } | 969 | | | 970 | 148 | typename ToFieldType::NativeType max_result = | 971 | 148 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 972 | 148 | typename ToFieldType::NativeType min_result = -max_result; | 973 | | | 974 | 148 | MaxNativeType multiplier {}; | 975 | 148 | if (from_scale < to_scale) { | 976 | 0 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 977 | 0 | from_scale); | 978 | 148 | } else if (from_scale > to_scale) { | 979 | 134 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 980 | 134 | to_scale); | 981 | 134 | } | 982 | 148 | RETURN_IF_ERROR(std::visit( | 983 | 148 | [&](auto multiply_may_overflow, auto narrow_integral) { | 984 | 148 | for (size_t i = 0; i < size; i++) { | 985 | 148 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 986 | 148 | multiply_may_overflow, narrow_integral>( | 987 | 148 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 988 | 148 | to_precision, to_scale, min_result, max_result, multiplier, | 989 | 148 | params)) { | 990 | 148 | if (set_nullable) { | 991 | 148 | null_map_data[i] = 1; | 992 | 148 | } else { | 993 | 148 | return params.status; | 994 | 148 | } | 995 | 148 | } | 996 | 148 | } | 997 | 148 | return Status::OK(); | 998 | 148 | }, | 999 | 148 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1000 | 148 | if (narrow_integral) { | 1001 | 112 | block.get_by_position(result).column = | 1002 | 112 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1003 | 112 | } else { | 1004 | 36 | block.get_by_position(result).column = std::move(col_to); | 1005 | 36 | } | 1006 | 148 | return Status::OK(); | 1007 | 148 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEENS2_ILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 907 | 144 | const NullMap::value_type* null_map = nullptr) const override { | 908 | 144 | using FromFieldType = typename FromDataType::FieldType; | 909 | 144 | using ToFieldType = typename ToDataType::FieldType; | 910 | 144 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 911 | 144 | const auto* col_from = | 912 | 144 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 913 | 144 | if (!col_from) { | 914 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 915 | 0 | named_from.column->get_name()); | 916 | 0 | } | 917 | | | 918 | 144 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 919 | 144 | UInt32 from_precision = from_decimal_type.get_precision(); | 920 | 144 | UInt32 from_scale = from_decimal_type.get_scale(); | 921 | 144 | UInt32 from_original_precision = from_decimal_type.get_original_precision(); | 922 | 144 | UInt32 from_original_scale = from_decimal_type.get_original_scale(); | 923 | | | 924 | 144 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 925 | 144 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 926 | 144 | UInt32 to_precision = to_decimal_type.get_precision(); | 927 | 144 | ToDataType::check_type_precision(to_precision); | 928 | 144 | UInt32 to_scale = to_decimal_type.get_scale(); | 929 | 144 | ToDataType::check_type_scale(to_scale); | 930 | | | 931 | 144 | auto from_max_int_digit_count = from_original_precision - from_original_scale; | 932 | 144 | auto to_max_int_digit_count = to_precision - to_scale; | 933 | 144 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count) || | 934 | 144 | (to_max_int_digit_count == from_max_int_digit_count && | 935 | 4 | to_scale < from_original_scale); | 936 | | // only in non-strict mode and may overflow, we set nullable | 937 | 144 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 938 | | | 939 | 144 | size_t size = col_from->size(); | 940 | 144 | ColumnUInt8::MutablePtr col_null_map_to; | 941 | 144 | NullMap::value_type* null_map_data = nullptr; | 942 | 144 | if (narrow_integral) { | 943 | 144 | col_null_map_to = ColumnUInt8::create(size, 0); | 944 | 144 | null_map_data = col_null_map_to->get_data().data(); | 945 | 144 | } | 946 | 144 | CastParameters params; | 947 | 144 | params.is_strict = (CastMode == CastModeType::StrictMode); | 948 | 144 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 949 | 144 | const auto& vec_from = col_from->get_data(); | 950 | 144 | const auto* vec_from_data = vec_from.data(); | 951 | 144 | auto& vec_to = col_to->get_data(); | 952 | 144 | auto* vec_to_data = vec_to.data(); | 953 | | | 954 | 144 | using MaxFieldType = | 955 | 144 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 956 | 144 | (std::is_same_v<ToFieldType, Decimal128V3> || | 957 | 144 | std::is_same_v<FromFieldType, Decimal128V3>), | 958 | 144 | Decimal128V3, | 959 | 144 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 960 | 144 | FromFieldType, ToFieldType>>; | 961 | 144 | using MaxNativeType = typename MaxFieldType::NativeType; | 962 | | | 963 | 144 | constexpr UInt32 to_max_digits = | 964 | 144 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 965 | 144 | bool multiply_may_overflow = false; | 966 | 144 | if (to_scale > from_scale) { | 967 | 48 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 968 | 48 | } | 969 | | | 970 | 144 | typename ToFieldType::NativeType max_result = | 971 | 144 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 972 | 144 | typename ToFieldType::NativeType min_result = -max_result; | 973 | | | 974 | 144 | MaxNativeType multiplier {}; | 975 | 144 | if (from_scale < to_scale) { | 976 | 48 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 977 | 48 | from_scale); | 978 | 96 | } else if (from_scale > to_scale) { | 979 | 84 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 980 | 84 | to_scale); | 981 | 84 | } | 982 | 144 | RETURN_IF_ERROR(std::visit( | 983 | 144 | [&](auto multiply_may_overflow, auto narrow_integral) { | 984 | 144 | for (size_t i = 0; i < size; i++) { | 985 | 144 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 986 | 144 | multiply_may_overflow, narrow_integral>( | 987 | 144 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 988 | 144 | to_precision, to_scale, min_result, max_result, multiplier, | 989 | 144 | params)) { | 990 | 144 | if (set_nullable) { | 991 | 144 | null_map_data[i] = 1; | 992 | 144 | } else { | 993 | 144 | return params.status; | 994 | 144 | } | 995 | 144 | } | 996 | 144 | } | 997 | 144 | return Status::OK(); | 998 | 144 | }, | 999 | 144 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1000 | 0 | if (narrow_integral) { | 1001 | 0 | block.get_by_position(result).column = | 1002 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1003 | 0 | } else { | 1004 | 0 | block.get_by_position(result).column = std::move(col_to); | 1005 | 0 | } | 1006 | 0 | return Status::OK(); | 1007 | 144 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEENS2_ILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 907 | 216 | const NullMap::value_type* null_map = nullptr) const override { | 908 | 216 | using FromFieldType = typename FromDataType::FieldType; | 909 | 216 | using ToFieldType = typename ToDataType::FieldType; | 910 | 216 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 911 | 216 | const auto* col_from = | 912 | 216 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 913 | 216 | if (!col_from) { | 914 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 915 | 0 | named_from.column->get_name()); | 916 | 0 | } | 917 | | | 918 | 216 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 919 | 216 | UInt32 from_precision = from_decimal_type.get_precision(); | 920 | 216 | UInt32 from_scale = from_decimal_type.get_scale(); | 921 | 216 | UInt32 from_original_precision = from_decimal_type.get_original_precision(); | 922 | 216 | UInt32 from_original_scale = from_decimal_type.get_original_scale(); | 923 | | | 924 | 216 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 925 | 216 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 926 | 216 | UInt32 to_precision = to_decimal_type.get_precision(); | 927 | 216 | ToDataType::check_type_precision(to_precision); | 928 | 216 | UInt32 to_scale = to_decimal_type.get_scale(); | 929 | 216 | ToDataType::check_type_scale(to_scale); | 930 | | | 931 | 216 | auto from_max_int_digit_count = from_original_precision - from_original_scale; | 932 | 216 | auto to_max_int_digit_count = to_precision - to_scale; | 933 | 216 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count) || | 934 | 216 | (to_max_int_digit_count == from_max_int_digit_count && | 935 | 90 | to_scale < from_original_scale); | 936 | | // only in non-strict mode and may overflow, we set nullable | 937 | 216 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 938 | | | 939 | 216 | size_t size = col_from->size(); | 940 | 216 | ColumnUInt8::MutablePtr col_null_map_to; | 941 | 216 | NullMap::value_type* null_map_data = nullptr; | 942 | 216 | if (narrow_integral) { | 943 | 140 | col_null_map_to = ColumnUInt8::create(size, 0); | 944 | 140 | null_map_data = col_null_map_to->get_data().data(); | 945 | 140 | } | 946 | 216 | CastParameters params; | 947 | 216 | params.is_strict = (CastMode == CastModeType::StrictMode); | 948 | 216 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 949 | 216 | const auto& vec_from = col_from->get_data(); | 950 | 216 | const auto* vec_from_data = vec_from.data(); | 951 | 216 | auto& vec_to = col_to->get_data(); | 952 | 216 | auto* vec_to_data = vec_to.data(); | 953 | | | 954 | 216 | using MaxFieldType = | 955 | 216 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 956 | 216 | (std::is_same_v<ToFieldType, Decimal128V3> || | 957 | 216 | std::is_same_v<FromFieldType, Decimal128V3>), | 958 | 216 | Decimal128V3, | 959 | 216 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 960 | 216 | FromFieldType, ToFieldType>>; | 961 | 216 | using MaxNativeType = typename MaxFieldType::NativeType; | 962 | | | 963 | 216 | constexpr UInt32 to_max_digits = | 964 | 216 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 965 | 216 | bool multiply_may_overflow = false; | 966 | 216 | if (to_scale > from_scale) { | 967 | 52 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 968 | 52 | } | 969 | | | 970 | 216 | typename ToFieldType::NativeType max_result = | 971 | 216 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 972 | 216 | typename ToFieldType::NativeType min_result = -max_result; | 973 | | | 974 | 216 | MaxNativeType multiplier {}; | 975 | 216 | if (from_scale < to_scale) { | 976 | 52 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 977 | 52 | from_scale); | 978 | 164 | } else if (from_scale > to_scale) { | 979 | 140 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 980 | 140 | to_scale); | 981 | 140 | } | 982 | 216 | RETURN_IF_ERROR(std::visit( | 983 | 216 | [&](auto multiply_may_overflow, auto narrow_integral) { | 984 | 216 | for (size_t i = 0; i < size; i++) { | 985 | 216 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 986 | 216 | multiply_may_overflow, narrow_integral>( | 987 | 216 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 988 | 216 | to_precision, to_scale, min_result, max_result, multiplier, | 989 | 216 | params)) { | 990 | 216 | if (set_nullable) { | 991 | 216 | null_map_data[i] = 1; | 992 | 216 | } else { | 993 | 216 | return params.status; | 994 | 216 | } | 995 | 216 | } | 996 | 216 | } | 997 | 216 | return Status::OK(); | 998 | 216 | }, | 999 | 216 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1000 | 216 | if (narrow_integral) { | 1001 | 140 | block.get_by_position(result).column = | 1002 | 140 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1003 | 140 | } else { | 1004 | 76 | block.get_by_position(result).column = std::move(col_to); | 1005 | 76 | } | 1006 | 216 | return Status::OK(); | 1007 | 216 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEENS2_ILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 907 | 64 | const NullMap::value_type* null_map = nullptr) const override { | 908 | 64 | using FromFieldType = typename FromDataType::FieldType; | 909 | 64 | using ToFieldType = typename ToDataType::FieldType; | 910 | 64 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 911 | 64 | const auto* col_from = | 912 | 64 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 913 | 64 | if (!col_from) { | 914 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 915 | 0 | named_from.column->get_name()); | 916 | 0 | } | 917 | | | 918 | 64 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 919 | 64 | UInt32 from_precision = from_decimal_type.get_precision(); | 920 | 64 | UInt32 from_scale = from_decimal_type.get_scale(); | 921 | 64 | UInt32 from_original_precision = from_decimal_type.get_original_precision(); | 922 | 64 | UInt32 from_original_scale = from_decimal_type.get_original_scale(); | 923 | | | 924 | 64 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 925 | 64 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 926 | 64 | UInt32 to_precision = to_decimal_type.get_precision(); | 927 | 64 | ToDataType::check_type_precision(to_precision); | 928 | 64 | UInt32 to_scale = to_decimal_type.get_scale(); | 929 | 64 | ToDataType::check_type_scale(to_scale); | 930 | | | 931 | 64 | auto from_max_int_digit_count = from_original_precision - from_original_scale; | 932 | 64 | auto to_max_int_digit_count = to_precision - to_scale; | 933 | 64 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count) || | 934 | 64 | (to_max_int_digit_count == from_max_int_digit_count && | 935 | 4 | to_scale < from_original_scale); | 936 | | // only in non-strict mode and may overflow, we set nullable | 937 | 64 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 938 | | | 939 | 64 | size_t size = col_from->size(); | 940 | 64 | ColumnUInt8::MutablePtr col_null_map_to; | 941 | 64 | NullMap::value_type* null_map_data = nullptr; | 942 | 64 | if (narrow_integral) { | 943 | 64 | col_null_map_to = ColumnUInt8::create(size, 0); | 944 | 64 | null_map_data = col_null_map_to->get_data().data(); | 945 | 64 | } | 946 | 64 | CastParameters params; | 947 | 64 | params.is_strict = (CastMode == CastModeType::StrictMode); | 948 | 64 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 949 | 64 | const auto& vec_from = col_from->get_data(); | 950 | 64 | const auto* vec_from_data = vec_from.data(); | 951 | 64 | auto& vec_to = col_to->get_data(); | 952 | 64 | auto* vec_to_data = vec_to.data(); | 953 | | | 954 | 64 | using MaxFieldType = | 955 | 64 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 956 | 64 | (std::is_same_v<ToFieldType, Decimal128V3> || | 957 | 64 | std::is_same_v<FromFieldType, Decimal128V3>), | 958 | 64 | Decimal128V3, | 959 | 64 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 960 | 64 | FromFieldType, ToFieldType>>; | 961 | 64 | using MaxNativeType = typename MaxFieldType::NativeType; | 962 | | | 963 | 64 | constexpr UInt32 to_max_digits = | 964 | 64 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 965 | 64 | bool multiply_may_overflow = false; | 966 | 64 | if (to_scale > from_scale) { | 967 | 60 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 968 | 60 | } | 969 | | | 970 | 64 | typename ToFieldType::NativeType max_result = | 971 | 64 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 972 | 64 | typename ToFieldType::NativeType min_result = -max_result; | 973 | | | 974 | 64 | MaxNativeType multiplier {}; | 975 | 64 | if (from_scale < to_scale) { | 976 | 60 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 977 | 60 | from_scale); | 978 | 60 | } else if (from_scale > to_scale) { | 979 | 4 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 980 | 4 | to_scale); | 981 | 4 | } | 982 | 64 | RETURN_IF_ERROR(std::visit( | 983 | 64 | [&](auto multiply_may_overflow, auto narrow_integral) { | 984 | 64 | for (size_t i = 0; i < size; i++) { | 985 | 64 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 986 | 64 | multiply_may_overflow, narrow_integral>( | 987 | 64 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 988 | 64 | to_precision, to_scale, min_result, max_result, multiplier, | 989 | 64 | params)) { | 990 | 64 | if (set_nullable) { | 991 | 64 | null_map_data[i] = 1; | 992 | 64 | } else { | 993 | 64 | return params.status; | 994 | 64 | } | 995 | 64 | } | 996 | 64 | } | 997 | 64 | return Status::OK(); | 998 | 64 | }, | 999 | 64 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1000 | 0 | if (narrow_integral) { | 1001 | 0 | block.get_by_position(result).column = | 1002 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1003 | 0 | } else { | 1004 | 0 | block.get_by_position(result).column = std::move(col_to); | 1005 | 0 | } | 1006 | 0 | return Status::OK(); | 1007 | 64 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEENS2_ILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 907 | 206 | const NullMap::value_type* null_map = nullptr) const override { | 908 | 206 | using FromFieldType = typename FromDataType::FieldType; | 909 | 206 | using ToFieldType = typename ToDataType::FieldType; | 910 | 206 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 911 | 206 | const auto* col_from = | 912 | 206 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 913 | 206 | if (!col_from) { | 914 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 915 | 0 | named_from.column->get_name()); | 916 | 0 | } | 917 | | | 918 | 206 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 919 | 206 | UInt32 from_precision = from_decimal_type.get_precision(); | 920 | 206 | UInt32 from_scale = from_decimal_type.get_scale(); | 921 | 206 | UInt32 from_original_precision = from_decimal_type.get_original_precision(); | 922 | 206 | UInt32 from_original_scale = from_decimal_type.get_original_scale(); | 923 | | | 924 | 206 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 925 | 206 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 926 | 206 | UInt32 to_precision = to_decimal_type.get_precision(); | 927 | 206 | ToDataType::check_type_precision(to_precision); | 928 | 206 | UInt32 to_scale = to_decimal_type.get_scale(); | 929 | 206 | ToDataType::check_type_scale(to_scale); | 930 | | | 931 | 206 | auto from_max_int_digit_count = from_original_precision - from_original_scale; | 932 | 206 | auto to_max_int_digit_count = to_precision - to_scale; | 933 | 206 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count) || | 934 | 206 | (to_max_int_digit_count == from_max_int_digit_count && | 935 | 150 | to_scale < from_original_scale); | 936 | | // only in non-strict mode and may overflow, we set nullable | 937 | 206 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 938 | | | 939 | 206 | size_t size = col_from->size(); | 940 | 206 | ColumnUInt8::MutablePtr col_null_map_to; | 941 | 206 | NullMap::value_type* null_map_data = nullptr; | 942 | 206 | if (narrow_integral) { | 943 | 70 | col_null_map_to = ColumnUInt8::create(size, 0); | 944 | 70 | null_map_data = col_null_map_to->get_data().data(); | 945 | 70 | } | 946 | 206 | CastParameters params; | 947 | 206 | params.is_strict = (CastMode == CastModeType::StrictMode); | 948 | 206 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 949 | 206 | const auto& vec_from = col_from->get_data(); | 950 | 206 | const auto* vec_from_data = vec_from.data(); | 951 | 206 | auto& vec_to = col_to->get_data(); | 952 | 206 | auto* vec_to_data = vec_to.data(); | 953 | | | 954 | 206 | using MaxFieldType = | 955 | 206 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 956 | 206 | (std::is_same_v<ToFieldType, Decimal128V3> || | 957 | 206 | std::is_same_v<FromFieldType, Decimal128V3>), | 958 | 206 | Decimal128V3, | 959 | 206 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 960 | 206 | FromFieldType, ToFieldType>>; | 961 | 206 | using MaxNativeType = typename MaxFieldType::NativeType; | 962 | | | 963 | 206 | constexpr UInt32 to_max_digits = | 964 | 206 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 965 | 206 | bool multiply_may_overflow = false; | 966 | 206 | if (to_scale > from_scale) { | 967 | 76 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 968 | 76 | } | 969 | | | 970 | 206 | typename ToFieldType::NativeType max_result = | 971 | 206 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 972 | 206 | typename ToFieldType::NativeType min_result = -max_result; | 973 | | | 974 | 206 | MaxNativeType multiplier {}; | 975 | 206 | if (from_scale < to_scale) { | 976 | 76 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 977 | 76 | from_scale); | 978 | 130 | } else if (from_scale > to_scale) { | 979 | 130 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 980 | 130 | to_scale); | 981 | 130 | } | 982 | 206 | RETURN_IF_ERROR(std::visit( | 983 | 206 | [&](auto multiply_may_overflow, auto narrow_integral) { | 984 | 206 | for (size_t i = 0; i < size; i++) { | 985 | 206 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 986 | 206 | multiply_may_overflow, narrow_integral>( | 987 | 206 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 988 | 206 | to_precision, to_scale, min_result, max_result, multiplier, | 989 | 206 | params)) { | 990 | 206 | if (set_nullable) { | 991 | 206 | null_map_data[i] = 1; | 992 | 206 | } else { | 993 | 206 | return params.status; | 994 | 206 | } | 995 | 206 | } | 996 | 206 | } | 997 | 206 | return Status::OK(); | 998 | 206 | }, | 999 | 206 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1000 | 206 | if (narrow_integral) { | 1001 | 70 | block.get_by_position(result).column = | 1002 | 70 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1003 | 136 | } else { | 1004 | 136 | block.get_by_position(result).column = std::move(col_to); | 1005 | 136 | } | 1006 | 206 | return Status::OK(); | 1007 | 206 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEENS2_ILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 907 | 60 | const NullMap::value_type* null_map = nullptr) const override { | 908 | 60 | using FromFieldType = typename FromDataType::FieldType; | 909 | 60 | using ToFieldType = typename ToDataType::FieldType; | 910 | 60 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 911 | 60 | const auto* col_from = | 912 | 60 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 913 | 60 | if (!col_from) { | 914 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 915 | 0 | named_from.column->get_name()); | 916 | 0 | } | 917 | | | 918 | 60 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 919 | 60 | UInt32 from_precision = from_decimal_type.get_precision(); | 920 | 60 | UInt32 from_scale = from_decimal_type.get_scale(); | 921 | 60 | UInt32 from_original_precision = from_decimal_type.get_original_precision(); | 922 | 60 | UInt32 from_original_scale = from_decimal_type.get_original_scale(); | 923 | | | 924 | 60 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 925 | 60 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 926 | 60 | UInt32 to_precision = to_decimal_type.get_precision(); | 927 | 60 | ToDataType::check_type_precision(to_precision); | 928 | 60 | UInt32 to_scale = to_decimal_type.get_scale(); | 929 | 60 | ToDataType::check_type_scale(to_scale); | 930 | | | 931 | 60 | auto from_max_int_digit_count = from_original_precision - from_original_scale; | 932 | 60 | auto to_max_int_digit_count = to_precision - to_scale; | 933 | 60 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count) || | 934 | 60 | (to_max_int_digit_count == from_max_int_digit_count && | 935 | 0 | to_scale < from_original_scale); | 936 | | // only in non-strict mode and may overflow, we set nullable | 937 | 60 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 938 | | | 939 | 60 | size_t size = col_from->size(); | 940 | 60 | ColumnUInt8::MutablePtr col_null_map_to; | 941 | 60 | NullMap::value_type* null_map_data = nullptr; | 942 | 60 | if (narrow_integral) { | 943 | 60 | col_null_map_to = ColumnUInt8::create(size, 0); | 944 | 60 | null_map_data = col_null_map_to->get_data().data(); | 945 | 60 | } | 946 | 60 | CastParameters params; | 947 | 60 | params.is_strict = (CastMode == CastModeType::StrictMode); | 948 | 60 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 949 | 60 | const auto& vec_from = col_from->get_data(); | 950 | 60 | const auto* vec_from_data = vec_from.data(); | 951 | 60 | auto& vec_to = col_to->get_data(); | 952 | 60 | auto* vec_to_data = vec_to.data(); | 953 | | | 954 | 60 | using MaxFieldType = | 955 | 60 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 956 | 60 | (std::is_same_v<ToFieldType, Decimal128V3> || | 957 | 60 | std::is_same_v<FromFieldType, Decimal128V3>), | 958 | 60 | Decimal128V3, | 959 | 60 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 960 | 60 | FromFieldType, ToFieldType>>; | 961 | 60 | using MaxNativeType = typename MaxFieldType::NativeType; | 962 | | | 963 | 60 | constexpr UInt32 to_max_digits = | 964 | 60 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 965 | 60 | bool multiply_may_overflow = false; | 966 | 60 | if (to_scale > from_scale) { | 967 | 60 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 968 | 60 | } | 969 | | | 970 | 60 | typename ToFieldType::NativeType max_result = | 971 | 60 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 972 | 60 | typename ToFieldType::NativeType min_result = -max_result; | 973 | | | 974 | 60 | MaxNativeType multiplier {}; | 975 | 60 | if (from_scale < to_scale) { | 976 | 60 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 977 | 60 | from_scale); | 978 | 60 | } else if (from_scale > to_scale) { | 979 | 0 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 980 | 0 | to_scale); | 981 | 0 | } | 982 | 60 | RETURN_IF_ERROR(std::visit( | 983 | 60 | [&](auto multiply_may_overflow, auto narrow_integral) { | 984 | 60 | for (size_t i = 0; i < size; i++) { | 985 | 60 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 986 | 60 | multiply_may_overflow, narrow_integral>( | 987 | 60 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 988 | 60 | to_precision, to_scale, min_result, max_result, multiplier, | 989 | 60 | params)) { | 990 | 60 | if (set_nullable) { | 991 | 60 | null_map_data[i] = 1; | 992 | 60 | } else { | 993 | 60 | return params.status; | 994 | 60 | } | 995 | 60 | } | 996 | 60 | } | 997 | 60 | return Status::OK(); | 998 | 60 | }, | 999 | 60 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1000 | 0 | if (narrow_integral) { | 1001 | 0 | block.get_by_position(result).column = | 1002 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1003 | 0 | } else { | 1004 | 0 | block.get_by_position(result).column = std::move(col_to); | 1005 | 0 | } | 1006 | 0 | return Status::OK(); | 1007 | 60 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEENS2_ILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 907 | 204 | const NullMap::value_type* null_map = nullptr) const override { | 908 | 204 | using FromFieldType = typename FromDataType::FieldType; | 909 | 204 | using ToFieldType = typename ToDataType::FieldType; | 910 | 204 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 911 | 204 | const auto* col_from = | 912 | 204 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 913 | 204 | if (!col_from) { | 914 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 915 | 0 | named_from.column->get_name()); | 916 | 0 | } | 917 | | | 918 | 204 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 919 | 204 | UInt32 from_precision = from_decimal_type.get_precision(); | 920 | 204 | UInt32 from_scale = from_decimal_type.get_scale(); | 921 | 204 | UInt32 from_original_precision = from_decimal_type.get_original_precision(); | 922 | 204 | UInt32 from_original_scale = from_decimal_type.get_original_scale(); | 923 | | | 924 | 204 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 925 | 204 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 926 | 204 | UInt32 to_precision = to_decimal_type.get_precision(); | 927 | 204 | ToDataType::check_type_precision(to_precision); | 928 | 204 | UInt32 to_scale = to_decimal_type.get_scale(); | 929 | 204 | ToDataType::check_type_scale(to_scale); | 930 | | | 931 | 204 | auto from_max_int_digit_count = from_original_precision - from_original_scale; | 932 | 204 | auto to_max_int_digit_count = to_precision - to_scale; | 933 | 204 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count) || | 934 | 204 | (to_max_int_digit_count == from_max_int_digit_count && | 935 | 148 | to_scale < from_original_scale); | 936 | | // only in non-strict mode and may overflow, we set nullable | 937 | 204 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 938 | | | 939 | 204 | size_t size = col_from->size(); | 940 | 204 | ColumnUInt8::MutablePtr col_null_map_to; | 941 | 204 | NullMap::value_type* null_map_data = nullptr; | 942 | 204 | if (narrow_integral) { | 943 | 56 | col_null_map_to = ColumnUInt8::create(size, 0); | 944 | 56 | null_map_data = col_null_map_to->get_data().data(); | 945 | 56 | } | 946 | 204 | CastParameters params; | 947 | 204 | params.is_strict = (CastMode == CastModeType::StrictMode); | 948 | 204 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 949 | 204 | const auto& vec_from = col_from->get_data(); | 950 | 204 | const auto* vec_from_data = vec_from.data(); | 951 | 204 | auto& vec_to = col_to->get_data(); | 952 | 204 | auto* vec_to_data = vec_to.data(); | 953 | | | 954 | 204 | using MaxFieldType = | 955 | 204 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 956 | 204 | (std::is_same_v<ToFieldType, Decimal128V3> || | 957 | 204 | std::is_same_v<FromFieldType, Decimal128V3>), | 958 | 204 | Decimal128V3, | 959 | 204 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 960 | 204 | FromFieldType, ToFieldType>>; | 961 | 204 | using MaxNativeType = typename MaxFieldType::NativeType; | 962 | | | 963 | 204 | constexpr UInt32 to_max_digits = | 964 | 204 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 965 | 204 | bool multiply_may_overflow = false; | 966 | 204 | if (to_scale > from_scale) { | 967 | 76 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 968 | 76 | } | 969 | | | 970 | 204 | typename ToFieldType::NativeType max_result = | 971 | 204 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 972 | 204 | typename ToFieldType::NativeType min_result = -max_result; | 973 | | | 974 | 204 | MaxNativeType multiplier {}; | 975 | 204 | if (from_scale < to_scale) { | 976 | 76 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 977 | 76 | from_scale); | 978 | 128 | } else if (from_scale > to_scale) { | 979 | 128 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 980 | 128 | to_scale); | 981 | 128 | } | 982 | 204 | RETURN_IF_ERROR(std::visit( | 983 | 204 | [&](auto multiply_may_overflow, auto narrow_integral) { | 984 | 204 | for (size_t i = 0; i < size; i++) { | 985 | 204 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 986 | 204 | multiply_may_overflow, narrow_integral>( | 987 | 204 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 988 | 204 | to_precision, to_scale, min_result, max_result, multiplier, | 989 | 204 | params)) { | 990 | 204 | if (set_nullable) { | 991 | 204 | null_map_data[i] = 1; | 992 | 204 | } else { | 993 | 204 | return params.status; | 994 | 204 | } | 995 | 204 | } | 996 | 204 | } | 997 | 204 | return Status::OK(); | 998 | 204 | }, | 999 | 204 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1000 | 204 | if (narrow_integral) { | 1001 | 56 | block.get_by_position(result).column = | 1002 | 56 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1003 | 148 | } else { | 1004 | 148 | block.get_by_position(result).column = std::move(col_to); | 1005 | 148 | } | 1006 | 204 | return Status::OK(); | 1007 | 204 | } |
|
1008 | | }; |
1009 | | |
1010 | | // cast between decimalv3 types |
1011 | | template <CastModeType CastMode, typename FromDataType, typename ToDataType> |
1012 | | requires(IsDataTypeDecimalV3<ToDataType> && IsDataTypeDecimalV3<FromDataType>) |
1013 | | class CastToImpl<CastMode, FromDataType, ToDataType> : public CastToBase { |
1014 | | public: |
1015 | | Status execute_impl(FunctionContext* context, Block& block, const ColumnNumbers& arguments, |
1016 | | uint32_t result, size_t input_rows_count, |
1017 | 8.54k | const NullMap::value_type* null_map = nullptr) const override { |
1018 | 8.54k | using FromFieldType = typename FromDataType::FieldType; |
1019 | 8.54k | using ToFieldType = typename ToDataType::FieldType; |
1020 | 8.54k | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); |
1021 | 8.54k | const auto* col_from = |
1022 | 8.54k | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); |
1023 | 8.54k | if (!col_from) { |
1024 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", |
1025 | 0 | named_from.column->get_name()); |
1026 | 0 | } |
1027 | | |
1028 | 8.54k | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); |
1029 | 8.54k | UInt32 from_precision = from_decimal_type.get_precision(); |
1030 | 8.54k | UInt32 from_scale = from_decimal_type.get_scale(); |
1031 | | |
1032 | 8.54k | const ColumnWithTypeAndName& named_to = block.get_by_position(result); |
1033 | 8.54k | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); |
1034 | 8.54k | UInt32 to_precision = to_decimal_type.get_precision(); |
1035 | 8.54k | ToDataType::check_type_precision(to_precision); |
1036 | 8.54k | UInt32 to_scale = to_decimal_type.get_scale(); |
1037 | 8.54k | ToDataType::check_type_scale(to_scale); |
1038 | | |
1039 | 8.54k | auto from_max_int_digit_count = from_precision - from_scale; |
1040 | 8.54k | auto to_max_int_digit_count = to_precision - to_scale; |
1041 | 8.54k | bool narrow_integral = |
1042 | 8.54k | (to_max_int_digit_count < from_max_int_digit_count) || |
1043 | 8.54k | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); |
1044 | | // only in non-strict mode and may overflow, we set nullable |
1045 | 8.54k | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; |
1046 | | |
1047 | 8.54k | size_t size = col_from->size(); |
1048 | 8.54k | ColumnUInt8::MutablePtr col_null_map_to; |
1049 | 8.54k | NullMap::value_type* null_map_data = nullptr; |
1050 | 8.54k | if (narrow_integral) { |
1051 | 6.20k | col_null_map_to = ColumnUInt8::create(size, 0); |
1052 | 6.20k | null_map_data = col_null_map_to->get_data().data(); |
1053 | 6.20k | } |
1054 | 8.54k | CastParameters params; |
1055 | 8.54k | params.is_strict = (CastMode == CastModeType::StrictMode); |
1056 | 8.54k | auto col_to = ToDataType::ColumnType::create(size, to_scale); |
1057 | 8.54k | const auto& vec_from = col_from->get_data(); |
1058 | 8.54k | const auto* vec_from_data = vec_from.data(); |
1059 | 8.54k | auto& vec_to = col_to->get_data(); |
1060 | 8.54k | auto* vec_to_data = vec_to.data(); |
1061 | | |
1062 | 8.54k | using MaxFieldType = |
1063 | 8.54k | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && |
1064 | 8.54k | (std::is_same_v<ToFieldType, Decimal128V3> || |
1065 | 8.54k | std::is_same_v<FromFieldType, Decimal128V3>), |
1066 | 8.54k | Decimal128V3, |
1067 | 8.54k | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), |
1068 | 8.54k | FromFieldType, ToFieldType>>; |
1069 | 8.54k | using MaxNativeType = typename MaxFieldType::NativeType; |
1070 | | |
1071 | 8.54k | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); |
1072 | 8.54k | bool multiply_may_overflow = false; |
1073 | 8.54k | if (to_scale > from_scale) { |
1074 | 3.91k | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; |
1075 | 3.91k | } |
1076 | | |
1077 | 8.54k | typename ToFieldType::NativeType max_result = |
1078 | 8.54k | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); |
1079 | 8.54k | typename ToFieldType::NativeType min_result = -max_result; |
1080 | | |
1081 | 8.54k | MaxNativeType multiplier {}; |
1082 | 8.54k | if (from_scale < to_scale) { |
1083 | 3.91k | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - |
1084 | 3.91k | from_scale); |
1085 | 4.63k | } else if (from_scale > to_scale) { |
1086 | 3.02k | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - |
1087 | 3.02k | to_scale); |
1088 | 3.02k | } |
1089 | 8.54k | RETURN_IF_ERROR(std::visit( |
1090 | 8.54k | [&](auto multiply_may_overflow, auto narrow_integral) { |
1091 | 8.54k | for (size_t i = 0; i < size; i++) { |
1092 | 8.54k | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, |
1093 | 8.54k | multiply_may_overflow, narrow_integral>( |
1094 | 8.54k | vec_from_data[i], from_precision, from_scale, vec_to_data[i], |
1095 | 8.54k | to_precision, to_scale, min_result, max_result, multiplier, |
1096 | 8.54k | params)) { |
1097 | 8.54k | if (set_nullable) { |
1098 | 8.54k | null_map_data[i] = 1; |
1099 | 8.54k | } else { |
1100 | 8.54k | return params.status; |
1101 | 8.54k | } |
1102 | 8.54k | } |
1103 | 8.54k | } |
1104 | 8.54k | return Status::OK(); |
1105 | 8.54k | }, |
1106 | 8.54k | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); |
1107 | 5.55k | if (narrow_integral) { |
1108 | 3.21k | block.get_by_position(result).column = |
1109 | 3.21k | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); |
1110 | 3.21k | } else { |
1111 | 2.34k | block.get_by_position(result).column = std::move(col_to); |
1112 | 2.34k | } |
1113 | 5.55k | return Status::OK(); |
1114 | 8.54k | } _ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEES4_E12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 1017 | 106 | const NullMap::value_type* null_map = nullptr) const override { | 1018 | 106 | using FromFieldType = typename FromDataType::FieldType; | 1019 | 106 | using ToFieldType = typename ToDataType::FieldType; | 1020 | 106 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 1021 | 106 | const auto* col_from = | 1022 | 106 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 1023 | 106 | if (!col_from) { | 1024 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 1025 | 0 | named_from.column->get_name()); | 1026 | 0 | } | 1027 | | | 1028 | 106 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 1029 | 106 | UInt32 from_precision = from_decimal_type.get_precision(); | 1030 | 106 | UInt32 from_scale = from_decimal_type.get_scale(); | 1031 | | | 1032 | 106 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 1033 | 106 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 1034 | 106 | UInt32 to_precision = to_decimal_type.get_precision(); | 1035 | 106 | ToDataType::check_type_precision(to_precision); | 1036 | 106 | UInt32 to_scale = to_decimal_type.get_scale(); | 1037 | 106 | ToDataType::check_type_scale(to_scale); | 1038 | | | 1039 | 106 | auto from_max_int_digit_count = from_precision - from_scale; | 1040 | 106 | auto to_max_int_digit_count = to_precision - to_scale; | 1041 | 106 | bool narrow_integral = | 1042 | 106 | (to_max_int_digit_count < from_max_int_digit_count) || | 1043 | 106 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1044 | | // only in non-strict mode and may overflow, we set nullable | 1045 | 106 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1046 | | | 1047 | 106 | size_t size = col_from->size(); | 1048 | 106 | ColumnUInt8::MutablePtr col_null_map_to; | 1049 | 106 | NullMap::value_type* null_map_data = nullptr; | 1050 | 106 | if (narrow_integral) { | 1051 | 106 | col_null_map_to = ColumnUInt8::create(size, 0); | 1052 | 106 | null_map_data = col_null_map_to->get_data().data(); | 1053 | 106 | } | 1054 | 106 | CastParameters params; | 1055 | 106 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1056 | 106 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1057 | 106 | const auto& vec_from = col_from->get_data(); | 1058 | 106 | const auto* vec_from_data = vec_from.data(); | 1059 | 106 | auto& vec_to = col_to->get_data(); | 1060 | 106 | auto* vec_to_data = vec_to.data(); | 1061 | | | 1062 | 106 | using MaxFieldType = | 1063 | 106 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1064 | 106 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1065 | 106 | std::is_same_v<FromFieldType, Decimal128V3>), | 1066 | 106 | Decimal128V3, | 1067 | 106 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1068 | 106 | FromFieldType, ToFieldType>>; | 1069 | 106 | using MaxNativeType = typename MaxFieldType::NativeType; | 1070 | | | 1071 | 106 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1072 | 106 | bool multiply_may_overflow = false; | 1073 | 106 | if (to_scale > from_scale) { | 1074 | 54 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1075 | 54 | } | 1076 | | | 1077 | 106 | typename ToFieldType::NativeType max_result = | 1078 | 106 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1079 | 106 | typename ToFieldType::NativeType min_result = -max_result; | 1080 | | | 1081 | 106 | MaxNativeType multiplier {}; | 1082 | 106 | if (from_scale < to_scale) { | 1083 | 54 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1084 | 54 | from_scale); | 1085 | 54 | } else if (from_scale > to_scale) { | 1086 | 40 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1087 | 40 | to_scale); | 1088 | 40 | } | 1089 | 106 | RETURN_IF_ERROR(std::visit( | 1090 | 106 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1091 | 106 | for (size_t i = 0; i < size; i++) { | 1092 | 106 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1093 | 106 | multiply_may_overflow, narrow_integral>( | 1094 | 106 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1095 | 106 | to_precision, to_scale, min_result, max_result, multiplier, | 1096 | 106 | params)) { | 1097 | 106 | if (set_nullable) { | 1098 | 106 | null_map_data[i] = 1; | 1099 | 106 | } else { | 1100 | 106 | return params.status; | 1101 | 106 | } | 1102 | 106 | } | 1103 | 106 | } | 1104 | 106 | return Status::OK(); | 1105 | 106 | }, | 1106 | 106 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1107 | 0 | if (narrow_integral) { | 1108 | 0 | block.get_by_position(result).column = | 1109 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1110 | 0 | } else { | 1111 | 0 | block.get_by_position(result).column = std::move(col_to); | 1112 | 0 | } | 1113 | 0 | return Status::OK(); | 1114 | 106 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEES4_E12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 1017 | 150 | const NullMap::value_type* null_map = nullptr) const override { | 1018 | 150 | using FromFieldType = typename FromDataType::FieldType; | 1019 | 150 | using ToFieldType = typename ToDataType::FieldType; | 1020 | 150 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 1021 | 150 | const auto* col_from = | 1022 | 150 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 1023 | 150 | if (!col_from) { | 1024 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 1025 | 0 | named_from.column->get_name()); | 1026 | 0 | } | 1027 | | | 1028 | 150 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 1029 | 150 | UInt32 from_precision = from_decimal_type.get_precision(); | 1030 | 150 | UInt32 from_scale = from_decimal_type.get_scale(); | 1031 | | | 1032 | 150 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 1033 | 150 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 1034 | 150 | UInt32 to_precision = to_decimal_type.get_precision(); | 1035 | 150 | ToDataType::check_type_precision(to_precision); | 1036 | 150 | UInt32 to_scale = to_decimal_type.get_scale(); | 1037 | 150 | ToDataType::check_type_scale(to_scale); | 1038 | | | 1039 | 150 | auto from_max_int_digit_count = from_precision - from_scale; | 1040 | 150 | auto to_max_int_digit_count = to_precision - to_scale; | 1041 | 150 | bool narrow_integral = | 1042 | 150 | (to_max_int_digit_count < from_max_int_digit_count) || | 1043 | 150 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1044 | | // only in non-strict mode and may overflow, we set nullable | 1045 | 150 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1046 | | | 1047 | 150 | size_t size = col_from->size(); | 1048 | 150 | ColumnUInt8::MutablePtr col_null_map_to; | 1049 | 150 | NullMap::value_type* null_map_data = nullptr; | 1050 | 150 | if (narrow_integral) { | 1051 | 90 | col_null_map_to = ColumnUInt8::create(size, 0); | 1052 | 90 | null_map_data = col_null_map_to->get_data().data(); | 1053 | 90 | } | 1054 | 150 | CastParameters params; | 1055 | 150 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1056 | 150 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1057 | 150 | const auto& vec_from = col_from->get_data(); | 1058 | 150 | const auto* vec_from_data = vec_from.data(); | 1059 | 150 | auto& vec_to = col_to->get_data(); | 1060 | 150 | auto* vec_to_data = vec_to.data(); | 1061 | | | 1062 | 150 | using MaxFieldType = | 1063 | 150 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1064 | 150 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1065 | 150 | std::is_same_v<FromFieldType, Decimal128V3>), | 1066 | 150 | Decimal128V3, | 1067 | 150 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1068 | 150 | FromFieldType, ToFieldType>>; | 1069 | 150 | using MaxNativeType = typename MaxFieldType::NativeType; | 1070 | | | 1071 | 150 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1072 | 150 | bool multiply_may_overflow = false; | 1073 | 150 | if (to_scale > from_scale) { | 1074 | 70 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1075 | 70 | } | 1076 | | | 1077 | 150 | typename ToFieldType::NativeType max_result = | 1078 | 150 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1079 | 150 | typename ToFieldType::NativeType min_result = -max_result; | 1080 | | | 1081 | 150 | MaxNativeType multiplier {}; | 1082 | 150 | if (from_scale < to_scale) { | 1083 | 70 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1084 | 70 | from_scale); | 1085 | 80 | } else if (from_scale > to_scale) { | 1086 | 60 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1087 | 60 | to_scale); | 1088 | 60 | } | 1089 | 150 | RETURN_IF_ERROR(std::visit( | 1090 | 150 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1091 | 150 | for (size_t i = 0; i < size; i++) { | 1092 | 150 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1093 | 150 | multiply_may_overflow, narrow_integral>( | 1094 | 150 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1095 | 150 | to_precision, to_scale, min_result, max_result, multiplier, | 1096 | 150 | params)) { | 1097 | 150 | if (set_nullable) { | 1098 | 150 | null_map_data[i] = 1; | 1099 | 150 | } else { | 1100 | 150 | return params.status; | 1101 | 150 | } | 1102 | 150 | } | 1103 | 150 | } | 1104 | 150 | return Status::OK(); | 1105 | 150 | }, | 1106 | 150 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1107 | 150 | if (narrow_integral) { | 1108 | 90 | block.get_by_position(result).column = | 1109 | 90 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1110 | 90 | } else { | 1111 | 60 | block.get_by_position(result).column = std::move(col_to); | 1112 | 60 | } | 1113 | 150 | return Status::OK(); | 1114 | 150 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEENS2_ILS3_28EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 1017 | 258 | const NullMap::value_type* null_map = nullptr) const override { | 1018 | 258 | using FromFieldType = typename FromDataType::FieldType; | 1019 | 258 | using ToFieldType = typename ToDataType::FieldType; | 1020 | 258 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 1021 | 258 | const auto* col_from = | 1022 | 258 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 1023 | 258 | if (!col_from) { | 1024 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 1025 | 0 | named_from.column->get_name()); | 1026 | 0 | } | 1027 | | | 1028 | 258 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 1029 | 258 | UInt32 from_precision = from_decimal_type.get_precision(); | 1030 | 258 | UInt32 from_scale = from_decimal_type.get_scale(); | 1031 | | | 1032 | 258 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 1033 | 258 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 1034 | 258 | UInt32 to_precision = to_decimal_type.get_precision(); | 1035 | 258 | ToDataType::check_type_precision(to_precision); | 1036 | 258 | UInt32 to_scale = to_decimal_type.get_scale(); | 1037 | 258 | ToDataType::check_type_scale(to_scale); | 1038 | | | 1039 | 258 | auto from_max_int_digit_count = from_precision - from_scale; | 1040 | 258 | auto to_max_int_digit_count = to_precision - to_scale; | 1041 | 258 | bool narrow_integral = | 1042 | 258 | (to_max_int_digit_count < from_max_int_digit_count) || | 1043 | 258 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1044 | | // only in non-strict mode and may overflow, we set nullable | 1045 | 258 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1046 | | | 1047 | 258 | size_t size = col_from->size(); | 1048 | 258 | ColumnUInt8::MutablePtr col_null_map_to; | 1049 | 258 | NullMap::value_type* null_map_data = nullptr; | 1050 | 258 | if (narrow_integral) { | 1051 | 258 | col_null_map_to = ColumnUInt8::create(size, 0); | 1052 | 258 | null_map_data = col_null_map_to->get_data().data(); | 1053 | 258 | } | 1054 | 258 | CastParameters params; | 1055 | 258 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1056 | 258 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1057 | 258 | const auto& vec_from = col_from->get_data(); | 1058 | 258 | const auto* vec_from_data = vec_from.data(); | 1059 | 258 | auto& vec_to = col_to->get_data(); | 1060 | 258 | auto* vec_to_data = vec_to.data(); | 1061 | | | 1062 | 258 | using MaxFieldType = | 1063 | 258 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1064 | 258 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1065 | 258 | std::is_same_v<FromFieldType, Decimal128V3>), | 1066 | 258 | Decimal128V3, | 1067 | 258 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1068 | 258 | FromFieldType, ToFieldType>>; | 1069 | 258 | using MaxNativeType = typename MaxFieldType::NativeType; | 1070 | | | 1071 | 258 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1072 | 258 | bool multiply_may_overflow = false; | 1073 | 258 | if (to_scale > from_scale) { | 1074 | 72 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1075 | 72 | } | 1076 | | | 1077 | 258 | typename ToFieldType::NativeType max_result = | 1078 | 258 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1079 | 258 | typename ToFieldType::NativeType min_result = -max_result; | 1080 | | | 1081 | 258 | MaxNativeType multiplier {}; | 1082 | 258 | if (from_scale < to_scale) { | 1083 | 72 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1084 | 72 | from_scale); | 1085 | 186 | } else if (from_scale > to_scale) { | 1086 | 132 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1087 | 132 | to_scale); | 1088 | 132 | } | 1089 | 258 | RETURN_IF_ERROR(std::visit( | 1090 | 258 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1091 | 258 | for (size_t i = 0; i < size; i++) { | 1092 | 258 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1093 | 258 | multiply_may_overflow, narrow_integral>( | 1094 | 258 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1095 | 258 | to_precision, to_scale, min_result, max_result, multiplier, | 1096 | 258 | params)) { | 1097 | 258 | if (set_nullable) { | 1098 | 258 | null_map_data[i] = 1; | 1099 | 258 | } else { | 1100 | 258 | return params.status; | 1101 | 258 | } | 1102 | 258 | } | 1103 | 258 | } | 1104 | 258 | return Status::OK(); | 1105 | 258 | }, | 1106 | 258 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1107 | 0 | if (narrow_integral) { | 1108 | 0 | block.get_by_position(result).column = | 1109 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1110 | 0 | } else { | 1111 | 0 | block.get_by_position(result).column = std::move(col_to); | 1112 | 0 | } | 1113 | 0 | return Status::OK(); | 1114 | 258 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEENS2_ILS3_28EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 1017 | 312 | const NullMap::value_type* null_map = nullptr) const override { | 1018 | 312 | using FromFieldType = typename FromDataType::FieldType; | 1019 | 312 | using ToFieldType = typename ToDataType::FieldType; | 1020 | 312 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 1021 | 312 | const auto* col_from = | 1022 | 312 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 1023 | 312 | if (!col_from) { | 1024 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 1025 | 0 | named_from.column->get_name()); | 1026 | 0 | } | 1027 | | | 1028 | 312 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 1029 | 312 | UInt32 from_precision = from_decimal_type.get_precision(); | 1030 | 312 | UInt32 from_scale = from_decimal_type.get_scale(); | 1031 | | | 1032 | 312 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 1033 | 312 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 1034 | 312 | UInt32 to_precision = to_decimal_type.get_precision(); | 1035 | 312 | ToDataType::check_type_precision(to_precision); | 1036 | 312 | UInt32 to_scale = to_decimal_type.get_scale(); | 1037 | 312 | ToDataType::check_type_scale(to_scale); | 1038 | | | 1039 | 312 | auto from_max_int_digit_count = from_precision - from_scale; | 1040 | 312 | auto to_max_int_digit_count = to_precision - to_scale; | 1041 | 312 | bool narrow_integral = | 1042 | 312 | (to_max_int_digit_count < from_max_int_digit_count) || | 1043 | 312 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1044 | | // only in non-strict mode and may overflow, we set nullable | 1045 | 312 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1046 | | | 1047 | 312 | size_t size = col_from->size(); | 1048 | 312 | ColumnUInt8::MutablePtr col_null_map_to; | 1049 | 312 | NullMap::value_type* null_map_data = nullptr; | 1050 | 312 | if (narrow_integral) { | 1051 | 272 | col_null_map_to = ColumnUInt8::create(size, 0); | 1052 | 272 | null_map_data = col_null_map_to->get_data().data(); | 1053 | 272 | } | 1054 | 312 | CastParameters params; | 1055 | 312 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1056 | 312 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1057 | 312 | const auto& vec_from = col_from->get_data(); | 1058 | 312 | const auto* vec_from_data = vec_from.data(); | 1059 | 312 | auto& vec_to = col_to->get_data(); | 1060 | 312 | auto* vec_to_data = vec_to.data(); | 1061 | | | 1062 | 312 | using MaxFieldType = | 1063 | 312 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1064 | 312 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1065 | 312 | std::is_same_v<FromFieldType, Decimal128V3>), | 1066 | 312 | Decimal128V3, | 1067 | 312 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1068 | 312 | FromFieldType, ToFieldType>>; | 1069 | 312 | using MaxNativeType = typename MaxFieldType::NativeType; | 1070 | | | 1071 | 312 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1072 | 312 | bool multiply_may_overflow = false; | 1073 | 312 | if (to_scale > from_scale) { | 1074 | 84 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1075 | 84 | } | 1076 | | | 1077 | 312 | typename ToFieldType::NativeType max_result = | 1078 | 312 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1079 | 312 | typename ToFieldType::NativeType min_result = -max_result; | 1080 | | | 1081 | 312 | MaxNativeType multiplier {}; | 1082 | 312 | if (from_scale < to_scale) { | 1083 | 84 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1084 | 84 | from_scale); | 1085 | 228 | } else if (from_scale > to_scale) { | 1086 | 144 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1087 | 144 | to_scale); | 1088 | 144 | } | 1089 | 312 | RETURN_IF_ERROR(std::visit( | 1090 | 312 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1091 | 312 | for (size_t i = 0; i < size; i++) { | 1092 | 312 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1093 | 312 | multiply_may_overflow, narrow_integral>( | 1094 | 312 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1095 | 312 | to_precision, to_scale, min_result, max_result, multiplier, | 1096 | 312 | params)) { | 1097 | 312 | if (set_nullable) { | 1098 | 312 | null_map_data[i] = 1; | 1099 | 312 | } else { | 1100 | 312 | return params.status; | 1101 | 312 | } | 1102 | 312 | } | 1103 | 312 | } | 1104 | 312 | return Status::OK(); | 1105 | 312 | }, | 1106 | 312 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1107 | 312 | if (narrow_integral) { | 1108 | 272 | block.get_by_position(result).column = | 1109 | 272 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1110 | 272 | } else { | 1111 | 40 | block.get_by_position(result).column = std::move(col_to); | 1112 | 40 | } | 1113 | 312 | return Status::OK(); | 1114 | 312 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEENS2_ILS3_28EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 1017 | 280 | const NullMap::value_type* null_map = nullptr) const override { | 1018 | 280 | using FromFieldType = typename FromDataType::FieldType; | 1019 | 280 | using ToFieldType = typename ToDataType::FieldType; | 1020 | 280 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 1021 | 280 | const auto* col_from = | 1022 | 280 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 1023 | 280 | if (!col_from) { | 1024 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 1025 | 0 | named_from.column->get_name()); | 1026 | 0 | } | 1027 | | | 1028 | 280 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 1029 | 280 | UInt32 from_precision = from_decimal_type.get_precision(); | 1030 | 280 | UInt32 from_scale = from_decimal_type.get_scale(); | 1031 | | | 1032 | 280 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 1033 | 280 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 1034 | 280 | UInt32 to_precision = to_decimal_type.get_precision(); | 1035 | 280 | ToDataType::check_type_precision(to_precision); | 1036 | 280 | UInt32 to_scale = to_decimal_type.get_scale(); | 1037 | 280 | ToDataType::check_type_scale(to_scale); | 1038 | | | 1039 | 280 | auto from_max_int_digit_count = from_precision - from_scale; | 1040 | 280 | auto to_max_int_digit_count = to_precision - to_scale; | 1041 | 280 | bool narrow_integral = | 1042 | 280 | (to_max_int_digit_count < from_max_int_digit_count) || | 1043 | 280 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1044 | | // only in non-strict mode and may overflow, we set nullable | 1045 | 280 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1046 | | | 1047 | 280 | size_t size = col_from->size(); | 1048 | 280 | ColumnUInt8::MutablePtr col_null_map_to; | 1049 | 280 | NullMap::value_type* null_map_data = nullptr; | 1050 | 280 | if (narrow_integral) { | 1051 | 280 | col_null_map_to = ColumnUInt8::create(size, 0); | 1052 | 280 | null_map_data = col_null_map_to->get_data().data(); | 1053 | 280 | } | 1054 | 280 | CastParameters params; | 1055 | 280 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1056 | 280 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1057 | 280 | const auto& vec_from = col_from->get_data(); | 1058 | 280 | const auto* vec_from_data = vec_from.data(); | 1059 | 280 | auto& vec_to = col_to->get_data(); | 1060 | 280 | auto* vec_to_data = vec_to.data(); | 1061 | | | 1062 | 280 | using MaxFieldType = | 1063 | 280 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1064 | 280 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1065 | 280 | std::is_same_v<FromFieldType, Decimal128V3>), | 1066 | 280 | Decimal128V3, | 1067 | 280 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1068 | 280 | FromFieldType, ToFieldType>>; | 1069 | 280 | using MaxNativeType = typename MaxFieldType::NativeType; | 1070 | | | 1071 | 280 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1072 | 280 | bool multiply_may_overflow = false; | 1073 | 280 | if (to_scale > from_scale) { | 1074 | 72 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1075 | 72 | } | 1076 | | | 1077 | 280 | typename ToFieldType::NativeType max_result = | 1078 | 280 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1079 | 280 | typename ToFieldType::NativeType min_result = -max_result; | 1080 | | | 1081 | 280 | MaxNativeType multiplier {}; | 1082 | 280 | if (from_scale < to_scale) { | 1083 | 72 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1084 | 72 | from_scale); | 1085 | 208 | } else if (from_scale > to_scale) { | 1086 | 160 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1087 | 160 | to_scale); | 1088 | 160 | } | 1089 | 280 | RETURN_IF_ERROR(std::visit( | 1090 | 280 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1091 | 280 | for (size_t i = 0; i < size; i++) { | 1092 | 280 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1093 | 280 | multiply_may_overflow, narrow_integral>( | 1094 | 280 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1095 | 280 | to_precision, to_scale, min_result, max_result, multiplier, | 1096 | 280 | params)) { | 1097 | 280 | if (set_nullable) { | 1098 | 280 | null_map_data[i] = 1; | 1099 | 280 | } else { | 1100 | 280 | return params.status; | 1101 | 280 | } | 1102 | 280 | } | 1103 | 280 | } | 1104 | 280 | return Status::OK(); | 1105 | 280 | }, | 1106 | 280 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1107 | 0 | if (narrow_integral) { | 1108 | 0 | block.get_by_position(result).column = | 1109 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1110 | 0 | } else { | 1111 | 0 | block.get_by_position(result).column = std::move(col_to); | 1112 | 0 | } | 1113 | 0 | return Status::OK(); | 1114 | 280 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEENS2_ILS3_28EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 1017 | 312 | const NullMap::value_type* null_map = nullptr) const override { | 1018 | 312 | using FromFieldType = typename FromDataType::FieldType; | 1019 | 312 | using ToFieldType = typename ToDataType::FieldType; | 1020 | 312 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 1021 | 312 | const auto* col_from = | 1022 | 312 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 1023 | 312 | if (!col_from) { | 1024 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 1025 | 0 | named_from.column->get_name()); | 1026 | 0 | } | 1027 | | | 1028 | 312 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 1029 | 312 | UInt32 from_precision = from_decimal_type.get_precision(); | 1030 | 312 | UInt32 from_scale = from_decimal_type.get_scale(); | 1031 | | | 1032 | 312 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 1033 | 312 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 1034 | 312 | UInt32 to_precision = to_decimal_type.get_precision(); | 1035 | 312 | ToDataType::check_type_precision(to_precision); | 1036 | 312 | UInt32 to_scale = to_decimal_type.get_scale(); | 1037 | 312 | ToDataType::check_type_scale(to_scale); | 1038 | | | 1039 | 312 | auto from_max_int_digit_count = from_precision - from_scale; | 1040 | 312 | auto to_max_int_digit_count = to_precision - to_scale; | 1041 | 312 | bool narrow_integral = | 1042 | 312 | (to_max_int_digit_count < from_max_int_digit_count) || | 1043 | 312 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1044 | | // only in non-strict mode and may overflow, we set nullable | 1045 | 312 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1046 | | | 1047 | 312 | size_t size = col_from->size(); | 1048 | 312 | ColumnUInt8::MutablePtr col_null_map_to; | 1049 | 312 | NullMap::value_type* null_map_data = nullptr; | 1050 | 312 | if (narrow_integral) { | 1051 | 272 | col_null_map_to = ColumnUInt8::create(size, 0); | 1052 | 272 | null_map_data = col_null_map_to->get_data().data(); | 1053 | 272 | } | 1054 | 312 | CastParameters params; | 1055 | 312 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1056 | 312 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1057 | 312 | const auto& vec_from = col_from->get_data(); | 1058 | 312 | const auto* vec_from_data = vec_from.data(); | 1059 | 312 | auto& vec_to = col_to->get_data(); | 1060 | 312 | auto* vec_to_data = vec_to.data(); | 1061 | | | 1062 | 312 | using MaxFieldType = | 1063 | 312 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1064 | 312 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1065 | 312 | std::is_same_v<FromFieldType, Decimal128V3>), | 1066 | 312 | Decimal128V3, | 1067 | 312 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1068 | 312 | FromFieldType, ToFieldType>>; | 1069 | 312 | using MaxNativeType = typename MaxFieldType::NativeType; | 1070 | | | 1071 | 312 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1072 | 312 | bool multiply_may_overflow = false; | 1073 | 312 | if (to_scale > from_scale) { | 1074 | 84 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1075 | 84 | } | 1076 | | | 1077 | 312 | typename ToFieldType::NativeType max_result = | 1078 | 312 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1079 | 312 | typename ToFieldType::NativeType min_result = -max_result; | 1080 | | | 1081 | 312 | MaxNativeType multiplier {}; | 1082 | 312 | if (from_scale < to_scale) { | 1083 | 84 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1084 | 84 | from_scale); | 1085 | 228 | } else if (from_scale > to_scale) { | 1086 | 148 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1087 | 148 | to_scale); | 1088 | 148 | } | 1089 | 312 | RETURN_IF_ERROR(std::visit( | 1090 | 312 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1091 | 312 | for (size_t i = 0; i < size; i++) { | 1092 | 312 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1093 | 312 | multiply_may_overflow, narrow_integral>( | 1094 | 312 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1095 | 312 | to_precision, to_scale, min_result, max_result, multiplier, | 1096 | 312 | params)) { | 1097 | 312 | if (set_nullable) { | 1098 | 312 | null_map_data[i] = 1; | 1099 | 312 | } else { | 1100 | 312 | return params.status; | 1101 | 312 | } | 1102 | 312 | } | 1103 | 312 | } | 1104 | 312 | return Status::OK(); | 1105 | 312 | }, | 1106 | 312 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1107 | 312 | if (narrow_integral) { | 1108 | 272 | block.get_by_position(result).column = | 1109 | 272 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1110 | 272 | } else { | 1111 | 40 | block.get_by_position(result).column = std::move(col_to); | 1112 | 40 | } | 1113 | 312 | return Status::OK(); | 1114 | 312 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEENS2_ILS3_28EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 1017 | 280 | const NullMap::value_type* null_map = nullptr) const override { | 1018 | 280 | using FromFieldType = typename FromDataType::FieldType; | 1019 | 280 | using ToFieldType = typename ToDataType::FieldType; | 1020 | 280 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 1021 | 280 | const auto* col_from = | 1022 | 280 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 1023 | 280 | if (!col_from) { | 1024 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 1025 | 0 | named_from.column->get_name()); | 1026 | 0 | } | 1027 | | | 1028 | 280 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 1029 | 280 | UInt32 from_precision = from_decimal_type.get_precision(); | 1030 | 280 | UInt32 from_scale = from_decimal_type.get_scale(); | 1031 | | | 1032 | 280 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 1033 | 280 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 1034 | 280 | UInt32 to_precision = to_decimal_type.get_precision(); | 1035 | 280 | ToDataType::check_type_precision(to_precision); | 1036 | 280 | UInt32 to_scale = to_decimal_type.get_scale(); | 1037 | 280 | ToDataType::check_type_scale(to_scale); | 1038 | | | 1039 | 280 | auto from_max_int_digit_count = from_precision - from_scale; | 1040 | 280 | auto to_max_int_digit_count = to_precision - to_scale; | 1041 | 280 | bool narrow_integral = | 1042 | 280 | (to_max_int_digit_count < from_max_int_digit_count) || | 1043 | 280 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1044 | | // only in non-strict mode and may overflow, we set nullable | 1045 | 280 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1046 | | | 1047 | 280 | size_t size = col_from->size(); | 1048 | 280 | ColumnUInt8::MutablePtr col_null_map_to; | 1049 | 280 | NullMap::value_type* null_map_data = nullptr; | 1050 | 280 | if (narrow_integral) { | 1051 | 280 | col_null_map_to = ColumnUInt8::create(size, 0); | 1052 | 280 | null_map_data = col_null_map_to->get_data().data(); | 1053 | 280 | } | 1054 | 280 | CastParameters params; | 1055 | 280 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1056 | 280 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1057 | 280 | const auto& vec_from = col_from->get_data(); | 1058 | 280 | const auto* vec_from_data = vec_from.data(); | 1059 | 280 | auto& vec_to = col_to->get_data(); | 1060 | 280 | auto* vec_to_data = vec_to.data(); | 1061 | | | 1062 | 280 | using MaxFieldType = | 1063 | 280 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1064 | 280 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1065 | 280 | std::is_same_v<FromFieldType, Decimal128V3>), | 1066 | 280 | Decimal128V3, | 1067 | 280 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1068 | 280 | FromFieldType, ToFieldType>>; | 1069 | 280 | using MaxNativeType = typename MaxFieldType::NativeType; | 1070 | | | 1071 | 280 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1072 | 280 | bool multiply_may_overflow = false; | 1073 | 280 | if (to_scale > from_scale) { | 1074 | 72 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1075 | 72 | } | 1076 | | | 1077 | 280 | typename ToFieldType::NativeType max_result = | 1078 | 280 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1079 | 280 | typename ToFieldType::NativeType min_result = -max_result; | 1080 | | | 1081 | 280 | MaxNativeType multiplier {}; | 1082 | 280 | if (from_scale < to_scale) { | 1083 | 72 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1084 | 72 | from_scale); | 1085 | 208 | } else if (from_scale > to_scale) { | 1086 | 160 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1087 | 160 | to_scale); | 1088 | 160 | } | 1089 | 280 | RETURN_IF_ERROR(std::visit( | 1090 | 280 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1091 | 280 | for (size_t i = 0; i < size; i++) { | 1092 | 280 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1093 | 280 | multiply_may_overflow, narrow_integral>( | 1094 | 280 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1095 | 280 | to_precision, to_scale, min_result, max_result, multiplier, | 1096 | 280 | params)) { | 1097 | 280 | if (set_nullable) { | 1098 | 280 | null_map_data[i] = 1; | 1099 | 280 | } else { | 1100 | 280 | return params.status; | 1101 | 280 | } | 1102 | 280 | } | 1103 | 280 | } | 1104 | 280 | return Status::OK(); | 1105 | 280 | }, | 1106 | 280 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1107 | 0 | if (narrow_integral) { | 1108 | 0 | block.get_by_position(result).column = | 1109 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1110 | 0 | } else { | 1111 | 0 | block.get_by_position(result).column = std::move(col_to); | 1112 | 0 | } | 1113 | 0 | return Status::OK(); | 1114 | 280 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEENS2_ILS3_28EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 1017 | 312 | const NullMap::value_type* null_map = nullptr) const override { | 1018 | 312 | using FromFieldType = typename FromDataType::FieldType; | 1019 | 312 | using ToFieldType = typename ToDataType::FieldType; | 1020 | 312 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 1021 | 312 | const auto* col_from = | 1022 | 312 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 1023 | 312 | if (!col_from) { | 1024 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 1025 | 0 | named_from.column->get_name()); | 1026 | 0 | } | 1027 | | | 1028 | 312 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 1029 | 312 | UInt32 from_precision = from_decimal_type.get_precision(); | 1030 | 312 | UInt32 from_scale = from_decimal_type.get_scale(); | 1031 | | | 1032 | 312 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 1033 | 312 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 1034 | 312 | UInt32 to_precision = to_decimal_type.get_precision(); | 1035 | 312 | ToDataType::check_type_precision(to_precision); | 1036 | 312 | UInt32 to_scale = to_decimal_type.get_scale(); | 1037 | 312 | ToDataType::check_type_scale(to_scale); | 1038 | | | 1039 | 312 | auto from_max_int_digit_count = from_precision - from_scale; | 1040 | 312 | auto to_max_int_digit_count = to_precision - to_scale; | 1041 | 312 | bool narrow_integral = | 1042 | 312 | (to_max_int_digit_count < from_max_int_digit_count) || | 1043 | 312 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1044 | | // only in non-strict mode and may overflow, we set nullable | 1045 | 312 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1046 | | | 1047 | 312 | size_t size = col_from->size(); | 1048 | 312 | ColumnUInt8::MutablePtr col_null_map_to; | 1049 | 312 | NullMap::value_type* null_map_data = nullptr; | 1050 | 312 | if (narrow_integral) { | 1051 | 272 | col_null_map_to = ColumnUInt8::create(size, 0); | 1052 | 272 | null_map_data = col_null_map_to->get_data().data(); | 1053 | 272 | } | 1054 | 312 | CastParameters params; | 1055 | 312 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1056 | 312 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1057 | 312 | const auto& vec_from = col_from->get_data(); | 1058 | 312 | const auto* vec_from_data = vec_from.data(); | 1059 | 312 | auto& vec_to = col_to->get_data(); | 1060 | 312 | auto* vec_to_data = vec_to.data(); | 1061 | | | 1062 | 312 | using MaxFieldType = | 1063 | 312 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1064 | 312 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1065 | 312 | std::is_same_v<FromFieldType, Decimal128V3>), | 1066 | 312 | Decimal128V3, | 1067 | 312 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1068 | 312 | FromFieldType, ToFieldType>>; | 1069 | 312 | using MaxNativeType = typename MaxFieldType::NativeType; | 1070 | | | 1071 | 312 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1072 | 312 | bool multiply_may_overflow = false; | 1073 | 312 | if (to_scale > from_scale) { | 1074 | 84 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1075 | 84 | } | 1076 | | | 1077 | 312 | typename ToFieldType::NativeType max_result = | 1078 | 312 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1079 | 312 | typename ToFieldType::NativeType min_result = -max_result; | 1080 | | | 1081 | 312 | MaxNativeType multiplier {}; | 1082 | 312 | if (from_scale < to_scale) { | 1083 | 84 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1084 | 84 | from_scale); | 1085 | 228 | } else if (from_scale > to_scale) { | 1086 | 148 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1087 | 148 | to_scale); | 1088 | 148 | } | 1089 | 312 | RETURN_IF_ERROR(std::visit( | 1090 | 312 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1091 | 312 | for (size_t i = 0; i < size; i++) { | 1092 | 312 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1093 | 312 | multiply_may_overflow, narrow_integral>( | 1094 | 312 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1095 | 312 | to_precision, to_scale, min_result, max_result, multiplier, | 1096 | 312 | params)) { | 1097 | 312 | if (set_nullable) { | 1098 | 312 | null_map_data[i] = 1; | 1099 | 312 | } else { | 1100 | 312 | return params.status; | 1101 | 312 | } | 1102 | 312 | } | 1103 | 312 | } | 1104 | 312 | return Status::OK(); | 1105 | 312 | }, | 1106 | 312 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1107 | 312 | if (narrow_integral) { | 1108 | 272 | block.get_by_position(result).column = | 1109 | 272 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1110 | 272 | } else { | 1111 | 40 | block.get_by_position(result).column = std::move(col_to); | 1112 | 40 | } | 1113 | 312 | return Status::OK(); | 1114 | 312 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEENS2_ILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 1017 | 72 | const NullMap::value_type* null_map = nullptr) const override { | 1018 | 72 | using FromFieldType = typename FromDataType::FieldType; | 1019 | 72 | using ToFieldType = typename ToDataType::FieldType; | 1020 | 72 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 1021 | 72 | const auto* col_from = | 1022 | 72 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 1023 | 72 | if (!col_from) { | 1024 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 1025 | 0 | named_from.column->get_name()); | 1026 | 0 | } | 1027 | | | 1028 | 72 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 1029 | 72 | UInt32 from_precision = from_decimal_type.get_precision(); | 1030 | 72 | UInt32 from_scale = from_decimal_type.get_scale(); | 1031 | | | 1032 | 72 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 1033 | 72 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 1034 | 72 | UInt32 to_precision = to_decimal_type.get_precision(); | 1035 | 72 | ToDataType::check_type_precision(to_precision); | 1036 | 72 | UInt32 to_scale = to_decimal_type.get_scale(); | 1037 | 72 | ToDataType::check_type_scale(to_scale); | 1038 | | | 1039 | 72 | auto from_max_int_digit_count = from_precision - from_scale; | 1040 | 72 | auto to_max_int_digit_count = to_precision - to_scale; | 1041 | 72 | bool narrow_integral = | 1042 | 72 | (to_max_int_digit_count < from_max_int_digit_count) || | 1043 | 72 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1044 | | // only in non-strict mode and may overflow, we set nullable | 1045 | 72 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1046 | | | 1047 | 72 | size_t size = col_from->size(); | 1048 | 72 | ColumnUInt8::MutablePtr col_null_map_to; | 1049 | 72 | NullMap::value_type* null_map_data = nullptr; | 1050 | 72 | if (narrow_integral) { | 1051 | 72 | col_null_map_to = ColumnUInt8::create(size, 0); | 1052 | 72 | null_map_data = col_null_map_to->get_data().data(); | 1053 | 72 | } | 1054 | 72 | CastParameters params; | 1055 | 72 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1056 | 72 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1057 | 72 | const auto& vec_from = col_from->get_data(); | 1058 | 72 | const auto* vec_from_data = vec_from.data(); | 1059 | 72 | auto& vec_to = col_to->get_data(); | 1060 | 72 | auto* vec_to_data = vec_to.data(); | 1061 | | | 1062 | 72 | using MaxFieldType = | 1063 | 72 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1064 | 72 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1065 | 72 | std::is_same_v<FromFieldType, Decimal128V3>), | 1066 | 72 | Decimal128V3, | 1067 | 72 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1068 | 72 | FromFieldType, ToFieldType>>; | 1069 | 72 | using MaxNativeType = typename MaxFieldType::NativeType; | 1070 | | | 1071 | 72 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1072 | 72 | bool multiply_may_overflow = false; | 1073 | 72 | if (to_scale > from_scale) { | 1074 | 72 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1075 | 72 | } | 1076 | | | 1077 | 72 | typename ToFieldType::NativeType max_result = | 1078 | 72 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1079 | 72 | typename ToFieldType::NativeType min_result = -max_result; | 1080 | | | 1081 | 72 | MaxNativeType multiplier {}; | 1082 | 72 | if (from_scale < to_scale) { | 1083 | 72 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1084 | 72 | from_scale); | 1085 | 72 | } else if (from_scale > to_scale) { | 1086 | 0 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1087 | 0 | to_scale); | 1088 | 0 | } | 1089 | 72 | RETURN_IF_ERROR(std::visit( | 1090 | 72 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1091 | 72 | for (size_t i = 0; i < size; i++) { | 1092 | 72 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1093 | 72 | multiply_may_overflow, narrow_integral>( | 1094 | 72 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1095 | 72 | to_precision, to_scale, min_result, max_result, multiplier, | 1096 | 72 | params)) { | 1097 | 72 | if (set_nullable) { | 1098 | 72 | null_map_data[i] = 1; | 1099 | 72 | } else { | 1100 | 72 | return params.status; | 1101 | 72 | } | 1102 | 72 | } | 1103 | 72 | } | 1104 | 72 | return Status::OK(); | 1105 | 72 | }, | 1106 | 72 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1107 | 0 | if (narrow_integral) { | 1108 | 0 | block.get_by_position(result).column = | 1109 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1110 | 0 | } else { | 1111 | 0 | block.get_by_position(result).column = std::move(col_to); | 1112 | 0 | } | 1113 | 0 | return Status::OK(); | 1114 | 72 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEENS2_ILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 1017 | 264 | const NullMap::value_type* null_map = nullptr) const override { | 1018 | 264 | using FromFieldType = typename FromDataType::FieldType; | 1019 | 264 | using ToFieldType = typename ToDataType::FieldType; | 1020 | 264 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 1021 | 264 | const auto* col_from = | 1022 | 264 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 1023 | 264 | if (!col_from) { | 1024 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 1025 | 0 | named_from.column->get_name()); | 1026 | 0 | } | 1027 | | | 1028 | 264 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 1029 | 264 | UInt32 from_precision = from_decimal_type.get_precision(); | 1030 | 264 | UInt32 from_scale = from_decimal_type.get_scale(); | 1031 | | | 1032 | 264 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 1033 | 264 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 1034 | 264 | UInt32 to_precision = to_decimal_type.get_precision(); | 1035 | 264 | ToDataType::check_type_precision(to_precision); | 1036 | 264 | UInt32 to_scale = to_decimal_type.get_scale(); | 1037 | 264 | ToDataType::check_type_scale(to_scale); | 1038 | | | 1039 | 264 | auto from_max_int_digit_count = from_precision - from_scale; | 1040 | 264 | auto to_max_int_digit_count = to_precision - to_scale; | 1041 | 264 | bool narrow_integral = | 1042 | 264 | (to_max_int_digit_count < from_max_int_digit_count) || | 1043 | 264 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1044 | | // only in non-strict mode and may overflow, we set nullable | 1045 | 264 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1046 | | | 1047 | 264 | size_t size = col_from->size(); | 1048 | 264 | ColumnUInt8::MutablePtr col_null_map_to; | 1049 | 264 | NullMap::value_type* null_map_data = nullptr; | 1050 | 264 | if (narrow_integral) { | 1051 | 64 | col_null_map_to = ColumnUInt8::create(size, 0); | 1052 | 64 | null_map_data = col_null_map_to->get_data().data(); | 1053 | 64 | } | 1054 | 264 | CastParameters params; | 1055 | 264 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1056 | 264 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1057 | 264 | const auto& vec_from = col_from->get_data(); | 1058 | 264 | const auto* vec_from_data = vec_from.data(); | 1059 | 264 | auto& vec_to = col_to->get_data(); | 1060 | 264 | auto* vec_to_data = vec_to.data(); | 1061 | | | 1062 | 264 | using MaxFieldType = | 1063 | 264 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1064 | 264 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1065 | 264 | std::is_same_v<FromFieldType, Decimal128V3>), | 1066 | 264 | Decimal128V3, | 1067 | 264 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1068 | 264 | FromFieldType, ToFieldType>>; | 1069 | 264 | using MaxNativeType = typename MaxFieldType::NativeType; | 1070 | | | 1071 | 264 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1072 | 264 | bool multiply_may_overflow = false; | 1073 | 264 | if (to_scale > from_scale) { | 1074 | 138 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1075 | 138 | } | 1076 | | | 1077 | 264 | typename ToFieldType::NativeType max_result = | 1078 | 264 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1079 | 264 | typename ToFieldType::NativeType min_result = -max_result; | 1080 | | | 1081 | 264 | MaxNativeType multiplier {}; | 1082 | 264 | if (from_scale < to_scale) { | 1083 | 138 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1084 | 138 | from_scale); | 1085 | 138 | } else if (from_scale > to_scale) { | 1086 | 60 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1087 | 60 | to_scale); | 1088 | 60 | } | 1089 | 264 | RETURN_IF_ERROR(std::visit( | 1090 | 264 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1091 | 264 | for (size_t i = 0; i < size; i++) { | 1092 | 264 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1093 | 264 | multiply_may_overflow, narrow_integral>( | 1094 | 264 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1095 | 264 | to_precision, to_scale, min_result, max_result, multiplier, | 1096 | 264 | params)) { | 1097 | 264 | if (set_nullable) { | 1098 | 264 | null_map_data[i] = 1; | 1099 | 264 | } else { | 1100 | 264 | return params.status; | 1101 | 264 | } | 1102 | 264 | } | 1103 | 264 | } | 1104 | 264 | return Status::OK(); | 1105 | 264 | }, | 1106 | 264 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1107 | 264 | if (narrow_integral) { | 1108 | 64 | block.get_by_position(result).column = | 1109 | 64 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1110 | 200 | } else { | 1111 | 200 | block.get_by_position(result).column = std::move(col_to); | 1112 | 200 | } | 1113 | 264 | return Status::OK(); | 1114 | 264 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEES4_E12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 1017 | 184 | const NullMap::value_type* null_map = nullptr) const override { | 1018 | 184 | using FromFieldType = typename FromDataType::FieldType; | 1019 | 184 | using ToFieldType = typename ToDataType::FieldType; | 1020 | 184 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 1021 | 184 | const auto* col_from = | 1022 | 184 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 1023 | 184 | if (!col_from) { | 1024 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 1025 | 0 | named_from.column->get_name()); | 1026 | 0 | } | 1027 | | | 1028 | 184 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 1029 | 184 | UInt32 from_precision = from_decimal_type.get_precision(); | 1030 | 184 | UInt32 from_scale = from_decimal_type.get_scale(); | 1031 | | | 1032 | 184 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 1033 | 184 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 1034 | 184 | UInt32 to_precision = to_decimal_type.get_precision(); | 1035 | 184 | ToDataType::check_type_precision(to_precision); | 1036 | 184 | UInt32 to_scale = to_decimal_type.get_scale(); | 1037 | 184 | ToDataType::check_type_scale(to_scale); | 1038 | | | 1039 | 184 | auto from_max_int_digit_count = from_precision - from_scale; | 1040 | 184 | auto to_max_int_digit_count = to_precision - to_scale; | 1041 | 184 | bool narrow_integral = | 1042 | 184 | (to_max_int_digit_count < from_max_int_digit_count) || | 1043 | 184 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1044 | | // only in non-strict mode and may overflow, we set nullable | 1045 | 184 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1046 | | | 1047 | 184 | size_t size = col_from->size(); | 1048 | 184 | ColumnUInt8::MutablePtr col_null_map_to; | 1049 | 184 | NullMap::value_type* null_map_data = nullptr; | 1050 | 184 | if (narrow_integral) { | 1051 | 184 | col_null_map_to = ColumnUInt8::create(size, 0); | 1052 | 184 | null_map_data = col_null_map_to->get_data().data(); | 1053 | 184 | } | 1054 | 184 | CastParameters params; | 1055 | 184 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1056 | 184 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1057 | 184 | const auto& vec_from = col_from->get_data(); | 1058 | 184 | const auto* vec_from_data = vec_from.data(); | 1059 | 184 | auto& vec_to = col_to->get_data(); | 1060 | 184 | auto* vec_to_data = vec_to.data(); | 1061 | | | 1062 | 184 | using MaxFieldType = | 1063 | 184 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1064 | 184 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1065 | 184 | std::is_same_v<FromFieldType, Decimal128V3>), | 1066 | 184 | Decimal128V3, | 1067 | 184 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1068 | 184 | FromFieldType, ToFieldType>>; | 1069 | 184 | using MaxNativeType = typename MaxFieldType::NativeType; | 1070 | | | 1071 | 184 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1072 | 184 | bool multiply_may_overflow = false; | 1073 | 184 | if (to_scale > from_scale) { | 1074 | 132 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1075 | 132 | } | 1076 | | | 1077 | 184 | typename ToFieldType::NativeType max_result = | 1078 | 184 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1079 | 184 | typename ToFieldType::NativeType min_result = -max_result; | 1080 | | | 1081 | 184 | MaxNativeType multiplier {}; | 1082 | 184 | if (from_scale < to_scale) { | 1083 | 132 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1084 | 132 | from_scale); | 1085 | 132 | } else if (from_scale > to_scale) { | 1086 | 40 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1087 | 40 | to_scale); | 1088 | 40 | } | 1089 | 184 | RETURN_IF_ERROR(std::visit( | 1090 | 184 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1091 | 184 | for (size_t i = 0; i < size; i++) { | 1092 | 184 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1093 | 184 | multiply_may_overflow, narrow_integral>( | 1094 | 184 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1095 | 184 | to_precision, to_scale, min_result, max_result, multiplier, | 1096 | 184 | params)) { | 1097 | 184 | if (set_nullable) { | 1098 | 184 | null_map_data[i] = 1; | 1099 | 184 | } else { | 1100 | 184 | return params.status; | 1101 | 184 | } | 1102 | 184 | } | 1103 | 184 | } | 1104 | 184 | return Status::OK(); | 1105 | 184 | }, | 1106 | 184 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1107 | 0 | if (narrow_integral) { | 1108 | 0 | block.get_by_position(result).column = | 1109 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1110 | 0 | } else { | 1111 | 0 | block.get_by_position(result).column = std::move(col_to); | 1112 | 0 | } | 1113 | 0 | return Status::OK(); | 1114 | 184 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEES4_E12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 1017 | 360 | const NullMap::value_type* null_map = nullptr) const override { | 1018 | 360 | using FromFieldType = typename FromDataType::FieldType; | 1019 | 360 | using ToFieldType = typename ToDataType::FieldType; | 1020 | 360 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 1021 | 360 | const auto* col_from = | 1022 | 360 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 1023 | 360 | if (!col_from) { | 1024 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 1025 | 0 | named_from.column->get_name()); | 1026 | 0 | } | 1027 | | | 1028 | 360 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 1029 | 360 | UInt32 from_precision = from_decimal_type.get_precision(); | 1030 | 360 | UInt32 from_scale = from_decimal_type.get_scale(); | 1031 | | | 1032 | 360 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 1033 | 360 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 1034 | 360 | UInt32 to_precision = to_decimal_type.get_precision(); | 1035 | 360 | ToDataType::check_type_precision(to_precision); | 1036 | 360 | UInt32 to_scale = to_decimal_type.get_scale(); | 1037 | 360 | ToDataType::check_type_scale(to_scale); | 1038 | | | 1039 | 360 | auto from_max_int_digit_count = from_precision - from_scale; | 1040 | 360 | auto to_max_int_digit_count = to_precision - to_scale; | 1041 | 360 | bool narrow_integral = | 1042 | 360 | (to_max_int_digit_count < from_max_int_digit_count) || | 1043 | 360 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1044 | | // only in non-strict mode and may overflow, we set nullable | 1045 | 360 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1046 | | | 1047 | 360 | size_t size = col_from->size(); | 1048 | 360 | ColumnUInt8::MutablePtr col_null_map_to; | 1049 | 360 | NullMap::value_type* null_map_data = nullptr; | 1050 | 360 | if (narrow_integral) { | 1051 | 208 | col_null_map_to = ColumnUInt8::create(size, 0); | 1052 | 208 | null_map_data = col_null_map_to->get_data().data(); | 1053 | 208 | } | 1054 | 360 | CastParameters params; | 1055 | 360 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1056 | 360 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1057 | 360 | const auto& vec_from = col_from->get_data(); | 1058 | 360 | const auto* vec_from_data = vec_from.data(); | 1059 | 360 | auto& vec_to = col_to->get_data(); | 1060 | 360 | auto* vec_to_data = vec_to.data(); | 1061 | | | 1062 | 360 | using MaxFieldType = | 1063 | 360 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1064 | 360 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1065 | 360 | std::is_same_v<FromFieldType, Decimal128V3>), | 1066 | 360 | Decimal128V3, | 1067 | 360 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1068 | 360 | FromFieldType, ToFieldType>>; | 1069 | 360 | using MaxNativeType = typename MaxFieldType::NativeType; | 1070 | | | 1071 | 360 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1072 | 360 | bool multiply_may_overflow = false; | 1073 | 360 | if (to_scale > from_scale) { | 1074 | 172 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1075 | 172 | } | 1076 | | | 1077 | 360 | typename ToFieldType::NativeType max_result = | 1078 | 360 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1079 | 360 | typename ToFieldType::NativeType min_result = -max_result; | 1080 | | | 1081 | 360 | MaxNativeType multiplier {}; | 1082 | 360 | if (from_scale < to_scale) { | 1083 | 172 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1084 | 172 | from_scale); | 1085 | 188 | } else if (from_scale > to_scale) { | 1086 | 136 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1087 | 136 | to_scale); | 1088 | 136 | } | 1089 | 360 | RETURN_IF_ERROR(std::visit( | 1090 | 360 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1091 | 360 | for (size_t i = 0; i < size; i++) { | 1092 | 360 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1093 | 360 | multiply_may_overflow, narrow_integral>( | 1094 | 360 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1095 | 360 | to_precision, to_scale, min_result, max_result, multiplier, | 1096 | 360 | params)) { | 1097 | 360 | if (set_nullable) { | 1098 | 360 | null_map_data[i] = 1; | 1099 | 360 | } else { | 1100 | 360 | return params.status; | 1101 | 360 | } | 1102 | 360 | } | 1103 | 360 | } | 1104 | 360 | return Status::OK(); | 1105 | 360 | }, | 1106 | 360 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1107 | 360 | if (narrow_integral) { | 1108 | 208 | block.get_by_position(result).column = | 1109 | 208 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1110 | 208 | } else { | 1111 | 152 | block.get_by_position(result).column = std::move(col_to); | 1112 | 152 | } | 1113 | 360 | return Status::OK(); | 1114 | 360 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEENS2_ILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 1017 | 306 | const NullMap::value_type* null_map = nullptr) const override { | 1018 | 306 | using FromFieldType = typename FromDataType::FieldType; | 1019 | 306 | using ToFieldType = typename ToDataType::FieldType; | 1020 | 306 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 1021 | 306 | const auto* col_from = | 1022 | 306 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 1023 | 306 | if (!col_from) { | 1024 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 1025 | 0 | named_from.column->get_name()); | 1026 | 0 | } | 1027 | | | 1028 | 306 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 1029 | 306 | UInt32 from_precision = from_decimal_type.get_precision(); | 1030 | 306 | UInt32 from_scale = from_decimal_type.get_scale(); | 1031 | | | 1032 | 306 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 1033 | 306 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 1034 | 306 | UInt32 to_precision = to_decimal_type.get_precision(); | 1035 | 306 | ToDataType::check_type_precision(to_precision); | 1036 | 306 | UInt32 to_scale = to_decimal_type.get_scale(); | 1037 | 306 | ToDataType::check_type_scale(to_scale); | 1038 | | | 1039 | 306 | auto from_max_int_digit_count = from_precision - from_scale; | 1040 | 306 | auto to_max_int_digit_count = to_precision - to_scale; | 1041 | 306 | bool narrow_integral = | 1042 | 306 | (to_max_int_digit_count < from_max_int_digit_count) || | 1043 | 306 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1044 | | // only in non-strict mode and may overflow, we set nullable | 1045 | 306 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1046 | | | 1047 | 306 | size_t size = col_from->size(); | 1048 | 306 | ColumnUInt8::MutablePtr col_null_map_to; | 1049 | 306 | NullMap::value_type* null_map_data = nullptr; | 1050 | 306 | if (narrow_integral) { | 1051 | 306 | col_null_map_to = ColumnUInt8::create(size, 0); | 1052 | 306 | null_map_data = col_null_map_to->get_data().data(); | 1053 | 306 | } | 1054 | 306 | CastParameters params; | 1055 | 306 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1056 | 306 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1057 | 306 | const auto& vec_from = col_from->get_data(); | 1058 | 306 | const auto* vec_from_data = vec_from.data(); | 1059 | 306 | auto& vec_to = col_to->get_data(); | 1060 | 306 | auto* vec_to_data = vec_to.data(); | 1061 | | | 1062 | 306 | using MaxFieldType = | 1063 | 306 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1064 | 306 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1065 | 306 | std::is_same_v<FromFieldType, Decimal128V3>), | 1066 | 306 | Decimal128V3, | 1067 | 306 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1068 | 306 | FromFieldType, ToFieldType>>; | 1069 | 306 | using MaxNativeType = typename MaxFieldType::NativeType; | 1070 | | | 1071 | 306 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1072 | 306 | bool multiply_may_overflow = false; | 1073 | 306 | if (to_scale > from_scale) { | 1074 | 120 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1075 | 120 | } | 1076 | | | 1077 | 306 | typename ToFieldType::NativeType max_result = | 1078 | 306 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1079 | 306 | typename ToFieldType::NativeType min_result = -max_result; | 1080 | | | 1081 | 306 | MaxNativeType multiplier {}; | 1082 | 306 | if (from_scale < to_scale) { | 1083 | 120 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1084 | 120 | from_scale); | 1085 | 186 | } else if (from_scale > to_scale) { | 1086 | 132 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1087 | 132 | to_scale); | 1088 | 132 | } | 1089 | 306 | RETURN_IF_ERROR(std::visit( | 1090 | 306 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1091 | 306 | for (size_t i = 0; i < size; i++) { | 1092 | 306 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1093 | 306 | multiply_may_overflow, narrow_integral>( | 1094 | 306 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1095 | 306 | to_precision, to_scale, min_result, max_result, multiplier, | 1096 | 306 | params)) { | 1097 | 306 | if (set_nullable) { | 1098 | 306 | null_map_data[i] = 1; | 1099 | 306 | } else { | 1100 | 306 | return params.status; | 1101 | 306 | } | 1102 | 306 | } | 1103 | 306 | } | 1104 | 306 | return Status::OK(); | 1105 | 306 | }, | 1106 | 306 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1107 | 0 | if (narrow_integral) { | 1108 | 0 | block.get_by_position(result).column = | 1109 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1110 | 0 | } else { | 1111 | 0 | block.get_by_position(result).column = std::move(col_to); | 1112 | 0 | } | 1113 | 0 | return Status::OK(); | 1114 | 306 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEENS2_ILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 1017 | 456 | const NullMap::value_type* null_map = nullptr) const override { | 1018 | 456 | using FromFieldType = typename FromDataType::FieldType; | 1019 | 456 | using ToFieldType = typename ToDataType::FieldType; | 1020 | 456 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 1021 | 456 | const auto* col_from = | 1022 | 456 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 1023 | 456 | if (!col_from) { | 1024 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 1025 | 0 | named_from.column->get_name()); | 1026 | 0 | } | 1027 | | | 1028 | 456 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 1029 | 456 | UInt32 from_precision = from_decimal_type.get_precision(); | 1030 | 456 | UInt32 from_scale = from_decimal_type.get_scale(); | 1031 | | | 1032 | 456 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 1033 | 456 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 1034 | 456 | UInt32 to_precision = to_decimal_type.get_precision(); | 1035 | 456 | ToDataType::check_type_precision(to_precision); | 1036 | 456 | UInt32 to_scale = to_decimal_type.get_scale(); | 1037 | 456 | ToDataType::check_type_scale(to_scale); | 1038 | | | 1039 | 456 | auto from_max_int_digit_count = from_precision - from_scale; | 1040 | 456 | auto to_max_int_digit_count = to_precision - to_scale; | 1041 | 456 | bool narrow_integral = | 1042 | 456 | (to_max_int_digit_count < from_max_int_digit_count) || | 1043 | 456 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1044 | | // only in non-strict mode and may overflow, we set nullable | 1045 | 456 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1046 | | | 1047 | 456 | size_t size = col_from->size(); | 1048 | 456 | ColumnUInt8::MutablePtr col_null_map_to; | 1049 | 456 | NullMap::value_type* null_map_data = nullptr; | 1050 | 456 | if (narrow_integral) { | 1051 | 384 | col_null_map_to = ColumnUInt8::create(size, 0); | 1052 | 384 | null_map_data = col_null_map_to->get_data().data(); | 1053 | 384 | } | 1054 | 456 | CastParameters params; | 1055 | 456 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1056 | 456 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1057 | 456 | const auto& vec_from = col_from->get_data(); | 1058 | 456 | const auto* vec_from_data = vec_from.data(); | 1059 | 456 | auto& vec_to = col_to->get_data(); | 1060 | 456 | auto* vec_to_data = vec_to.data(); | 1061 | | | 1062 | 456 | using MaxFieldType = | 1063 | 456 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1064 | 456 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1065 | 456 | std::is_same_v<FromFieldType, Decimal128V3>), | 1066 | 456 | Decimal128V3, | 1067 | 456 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1068 | 456 | FromFieldType, ToFieldType>>; | 1069 | 456 | using MaxNativeType = typename MaxFieldType::NativeType; | 1070 | | | 1071 | 456 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1072 | 456 | bool multiply_may_overflow = false; | 1073 | 456 | if (to_scale > from_scale) { | 1074 | 152 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1075 | 152 | } | 1076 | | | 1077 | 456 | typename ToFieldType::NativeType max_result = | 1078 | 456 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1079 | 456 | typename ToFieldType::NativeType min_result = -max_result; | 1080 | | | 1081 | 456 | MaxNativeType multiplier {}; | 1082 | 456 | if (from_scale < to_scale) { | 1083 | 152 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1084 | 152 | from_scale); | 1085 | 304 | } else if (from_scale > to_scale) { | 1086 | 188 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1087 | 188 | to_scale); | 1088 | 188 | } | 1089 | 456 | RETURN_IF_ERROR(std::visit( | 1090 | 456 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1091 | 456 | for (size_t i = 0; i < size; i++) { | 1092 | 456 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1093 | 456 | multiply_may_overflow, narrow_integral>( | 1094 | 456 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1095 | 456 | to_precision, to_scale, min_result, max_result, multiplier, | 1096 | 456 | params)) { | 1097 | 456 | if (set_nullable) { | 1098 | 456 | null_map_data[i] = 1; | 1099 | 456 | } else { | 1100 | 456 | return params.status; | 1101 | 456 | } | 1102 | 456 | } | 1103 | 456 | } | 1104 | 456 | return Status::OK(); | 1105 | 456 | }, | 1106 | 456 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1107 | 456 | if (narrow_integral) { | 1108 | 384 | block.get_by_position(result).column = | 1109 | 384 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1110 | 384 | } else { | 1111 | 72 | block.get_by_position(result).column = std::move(col_to); | 1112 | 72 | } | 1113 | 456 | return Status::OK(); | 1114 | 456 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEENS2_ILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 1017 | 328 | const NullMap::value_type* null_map = nullptr) const override { | 1018 | 328 | using FromFieldType = typename FromDataType::FieldType; | 1019 | 328 | using ToFieldType = typename ToDataType::FieldType; | 1020 | 328 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 1021 | 328 | const auto* col_from = | 1022 | 328 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 1023 | 328 | if (!col_from) { | 1024 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 1025 | 0 | named_from.column->get_name()); | 1026 | 0 | } | 1027 | | | 1028 | 328 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 1029 | 328 | UInt32 from_precision = from_decimal_type.get_precision(); | 1030 | 328 | UInt32 from_scale = from_decimal_type.get_scale(); | 1031 | | | 1032 | 328 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 1033 | 328 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 1034 | 328 | UInt32 to_precision = to_decimal_type.get_precision(); | 1035 | 328 | ToDataType::check_type_precision(to_precision); | 1036 | 328 | UInt32 to_scale = to_decimal_type.get_scale(); | 1037 | 328 | ToDataType::check_type_scale(to_scale); | 1038 | | | 1039 | 328 | auto from_max_int_digit_count = from_precision - from_scale; | 1040 | 328 | auto to_max_int_digit_count = to_precision - to_scale; | 1041 | 328 | bool narrow_integral = | 1042 | 328 | (to_max_int_digit_count < from_max_int_digit_count) || | 1043 | 328 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1044 | | // only in non-strict mode and may overflow, we set nullable | 1045 | 328 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1046 | | | 1047 | 328 | size_t size = col_from->size(); | 1048 | 328 | ColumnUInt8::MutablePtr col_null_map_to; | 1049 | 328 | NullMap::value_type* null_map_data = nullptr; | 1050 | 328 | if (narrow_integral) { | 1051 | 328 | col_null_map_to = ColumnUInt8::create(size, 0); | 1052 | 328 | null_map_data = col_null_map_to->get_data().data(); | 1053 | 328 | } | 1054 | 328 | CastParameters params; | 1055 | 328 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1056 | 328 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1057 | 328 | const auto& vec_from = col_from->get_data(); | 1058 | 328 | const auto* vec_from_data = vec_from.data(); | 1059 | 328 | auto& vec_to = col_to->get_data(); | 1060 | 328 | auto* vec_to_data = vec_to.data(); | 1061 | | | 1062 | 328 | using MaxFieldType = | 1063 | 328 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1064 | 328 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1065 | 328 | std::is_same_v<FromFieldType, Decimal128V3>), | 1066 | 328 | Decimal128V3, | 1067 | 328 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1068 | 328 | FromFieldType, ToFieldType>>; | 1069 | 328 | using MaxNativeType = typename MaxFieldType::NativeType; | 1070 | | | 1071 | 328 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1072 | 328 | bool multiply_may_overflow = false; | 1073 | 328 | if (to_scale > from_scale) { | 1074 | 120 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1075 | 120 | } | 1076 | | | 1077 | 328 | typename ToFieldType::NativeType max_result = | 1078 | 328 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1079 | 328 | typename ToFieldType::NativeType min_result = -max_result; | 1080 | | | 1081 | 328 | MaxNativeType multiplier {}; | 1082 | 328 | if (from_scale < to_scale) { | 1083 | 120 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1084 | 120 | from_scale); | 1085 | 208 | } else if (from_scale > to_scale) { | 1086 | 160 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1087 | 160 | to_scale); | 1088 | 160 | } | 1089 | 328 | RETURN_IF_ERROR(std::visit( | 1090 | 328 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1091 | 328 | for (size_t i = 0; i < size; i++) { | 1092 | 328 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1093 | 328 | multiply_may_overflow, narrow_integral>( | 1094 | 328 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1095 | 328 | to_precision, to_scale, min_result, max_result, multiplier, | 1096 | 328 | params)) { | 1097 | 328 | if (set_nullable) { | 1098 | 328 | null_map_data[i] = 1; | 1099 | 328 | } else { | 1100 | 328 | return params.status; | 1101 | 328 | } | 1102 | 328 | } | 1103 | 328 | } | 1104 | 328 | return Status::OK(); | 1105 | 328 | }, | 1106 | 328 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1107 | 0 | if (narrow_integral) { | 1108 | 0 | block.get_by_position(result).column = | 1109 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1110 | 0 | } else { | 1111 | 0 | block.get_by_position(result).column = std::move(col_to); | 1112 | 0 | } | 1113 | 0 | return Status::OK(); | 1114 | 328 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEENS2_ILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 1017 | 456 | const NullMap::value_type* null_map = nullptr) const override { | 1018 | 456 | using FromFieldType = typename FromDataType::FieldType; | 1019 | 456 | using ToFieldType = typename ToDataType::FieldType; | 1020 | 456 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 1021 | 456 | const auto* col_from = | 1022 | 456 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 1023 | 456 | if (!col_from) { | 1024 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 1025 | 0 | named_from.column->get_name()); | 1026 | 0 | } | 1027 | | | 1028 | 456 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 1029 | 456 | UInt32 from_precision = from_decimal_type.get_precision(); | 1030 | 456 | UInt32 from_scale = from_decimal_type.get_scale(); | 1031 | | | 1032 | 456 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 1033 | 456 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 1034 | 456 | UInt32 to_precision = to_decimal_type.get_precision(); | 1035 | 456 | ToDataType::check_type_precision(to_precision); | 1036 | 456 | UInt32 to_scale = to_decimal_type.get_scale(); | 1037 | 456 | ToDataType::check_type_scale(to_scale); | 1038 | | | 1039 | 456 | auto from_max_int_digit_count = from_precision - from_scale; | 1040 | 456 | auto to_max_int_digit_count = to_precision - to_scale; | 1041 | 456 | bool narrow_integral = | 1042 | 456 | (to_max_int_digit_count < from_max_int_digit_count) || | 1043 | 456 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1044 | | // only in non-strict mode and may overflow, we set nullable | 1045 | 456 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1046 | | | 1047 | 456 | size_t size = col_from->size(); | 1048 | 456 | ColumnUInt8::MutablePtr col_null_map_to; | 1049 | 456 | NullMap::value_type* null_map_data = nullptr; | 1050 | 456 | if (narrow_integral) { | 1051 | 384 | col_null_map_to = ColumnUInt8::create(size, 0); | 1052 | 384 | null_map_data = col_null_map_to->get_data().data(); | 1053 | 384 | } | 1054 | 456 | CastParameters params; | 1055 | 456 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1056 | 456 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1057 | 456 | const auto& vec_from = col_from->get_data(); | 1058 | 456 | const auto* vec_from_data = vec_from.data(); | 1059 | 456 | auto& vec_to = col_to->get_data(); | 1060 | 456 | auto* vec_to_data = vec_to.data(); | 1061 | | | 1062 | 456 | using MaxFieldType = | 1063 | 456 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1064 | 456 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1065 | 456 | std::is_same_v<FromFieldType, Decimal128V3>), | 1066 | 456 | Decimal128V3, | 1067 | 456 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1068 | 456 | FromFieldType, ToFieldType>>; | 1069 | 456 | using MaxNativeType = typename MaxFieldType::NativeType; | 1070 | | | 1071 | 456 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1072 | 456 | bool multiply_may_overflow = false; | 1073 | 456 | if (to_scale > from_scale) { | 1074 | 152 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1075 | 152 | } | 1076 | | | 1077 | 456 | typename ToFieldType::NativeType max_result = | 1078 | 456 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1079 | 456 | typename ToFieldType::NativeType min_result = -max_result; | 1080 | | | 1081 | 456 | MaxNativeType multiplier {}; | 1082 | 456 | if (from_scale < to_scale) { | 1083 | 152 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1084 | 152 | from_scale); | 1085 | 304 | } else if (from_scale > to_scale) { | 1086 | 192 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1087 | 192 | to_scale); | 1088 | 192 | } | 1089 | 456 | RETURN_IF_ERROR(std::visit( | 1090 | 456 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1091 | 456 | for (size_t i = 0; i < size; i++) { | 1092 | 456 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1093 | 456 | multiply_may_overflow, narrow_integral>( | 1094 | 456 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1095 | 456 | to_precision, to_scale, min_result, max_result, multiplier, | 1096 | 456 | params)) { | 1097 | 456 | if (set_nullable) { | 1098 | 456 | null_map_data[i] = 1; | 1099 | 456 | } else { | 1100 | 456 | return params.status; | 1101 | 456 | } | 1102 | 456 | } | 1103 | 456 | } | 1104 | 456 | return Status::OK(); | 1105 | 456 | }, | 1106 | 456 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1107 | 456 | if (narrow_integral) { | 1108 | 384 | block.get_by_position(result).column = | 1109 | 384 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1110 | 384 | } else { | 1111 | 72 | block.get_by_position(result).column = std::move(col_to); | 1112 | 72 | } | 1113 | 456 | return Status::OK(); | 1114 | 456 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEENS2_ILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 1017 | 72 | const NullMap::value_type* null_map = nullptr) const override { | 1018 | 72 | using FromFieldType = typename FromDataType::FieldType; | 1019 | 72 | using ToFieldType = typename ToDataType::FieldType; | 1020 | 72 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 1021 | 72 | const auto* col_from = | 1022 | 72 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 1023 | 72 | if (!col_from) { | 1024 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 1025 | 0 | named_from.column->get_name()); | 1026 | 0 | } | 1027 | | | 1028 | 72 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 1029 | 72 | UInt32 from_precision = from_decimal_type.get_precision(); | 1030 | 72 | UInt32 from_scale = from_decimal_type.get_scale(); | 1031 | | | 1032 | 72 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 1033 | 72 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 1034 | 72 | UInt32 to_precision = to_decimal_type.get_precision(); | 1035 | 72 | ToDataType::check_type_precision(to_precision); | 1036 | 72 | UInt32 to_scale = to_decimal_type.get_scale(); | 1037 | 72 | ToDataType::check_type_scale(to_scale); | 1038 | | | 1039 | 72 | auto from_max_int_digit_count = from_precision - from_scale; | 1040 | 72 | auto to_max_int_digit_count = to_precision - to_scale; | 1041 | 72 | bool narrow_integral = | 1042 | 72 | (to_max_int_digit_count < from_max_int_digit_count) || | 1043 | 72 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1044 | | // only in non-strict mode and may overflow, we set nullable | 1045 | 72 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1046 | | | 1047 | 72 | size_t size = col_from->size(); | 1048 | 72 | ColumnUInt8::MutablePtr col_null_map_to; | 1049 | 72 | NullMap::value_type* null_map_data = nullptr; | 1050 | 72 | if (narrow_integral) { | 1051 | 72 | col_null_map_to = ColumnUInt8::create(size, 0); | 1052 | 72 | null_map_data = col_null_map_to->get_data().data(); | 1053 | 72 | } | 1054 | 72 | CastParameters params; | 1055 | 72 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1056 | 72 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1057 | 72 | const auto& vec_from = col_from->get_data(); | 1058 | 72 | const auto* vec_from_data = vec_from.data(); | 1059 | 72 | auto& vec_to = col_to->get_data(); | 1060 | 72 | auto* vec_to_data = vec_to.data(); | 1061 | | | 1062 | 72 | using MaxFieldType = | 1063 | 72 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1064 | 72 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1065 | 72 | std::is_same_v<FromFieldType, Decimal128V3>), | 1066 | 72 | Decimal128V3, | 1067 | 72 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1068 | 72 | FromFieldType, ToFieldType>>; | 1069 | 72 | using MaxNativeType = typename MaxFieldType::NativeType; | 1070 | | | 1071 | 72 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1072 | 72 | bool multiply_may_overflow = false; | 1073 | 72 | if (to_scale > from_scale) { | 1074 | 72 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1075 | 72 | } | 1076 | | | 1077 | 72 | typename ToFieldType::NativeType max_result = | 1078 | 72 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1079 | 72 | typename ToFieldType::NativeType min_result = -max_result; | 1080 | | | 1081 | 72 | MaxNativeType multiplier {}; | 1082 | 72 | if (from_scale < to_scale) { | 1083 | 72 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1084 | 72 | from_scale); | 1085 | 72 | } else if (from_scale > to_scale) { | 1086 | 0 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1087 | 0 | to_scale); | 1088 | 0 | } | 1089 | 72 | RETURN_IF_ERROR(std::visit( | 1090 | 72 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1091 | 72 | for (size_t i = 0; i < size; i++) { | 1092 | 72 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1093 | 72 | multiply_may_overflow, narrow_integral>( | 1094 | 72 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1095 | 72 | to_precision, to_scale, min_result, max_result, multiplier, | 1096 | 72 | params)) { | 1097 | 72 | if (set_nullable) { | 1098 | 72 | null_map_data[i] = 1; | 1099 | 72 | } else { | 1100 | 72 | return params.status; | 1101 | 72 | } | 1102 | 72 | } | 1103 | 72 | } | 1104 | 72 | return Status::OK(); | 1105 | 72 | }, | 1106 | 72 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1107 | 0 | if (narrow_integral) { | 1108 | 0 | block.get_by_position(result).column = | 1109 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1110 | 0 | } else { | 1111 | 0 | block.get_by_position(result).column = std::move(col_to); | 1112 | 0 | } | 1113 | 0 | return Status::OK(); | 1114 | 72 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEENS2_ILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 1017 | 264 | const NullMap::value_type* null_map = nullptr) const override { | 1018 | 264 | using FromFieldType = typename FromDataType::FieldType; | 1019 | 264 | using ToFieldType = typename ToDataType::FieldType; | 1020 | 264 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 1021 | 264 | const auto* col_from = | 1022 | 264 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 1023 | 264 | if (!col_from) { | 1024 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 1025 | 0 | named_from.column->get_name()); | 1026 | 0 | } | 1027 | | | 1028 | 264 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 1029 | 264 | UInt32 from_precision = from_decimal_type.get_precision(); | 1030 | 264 | UInt32 from_scale = from_decimal_type.get_scale(); | 1031 | | | 1032 | 264 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 1033 | 264 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 1034 | 264 | UInt32 to_precision = to_decimal_type.get_precision(); | 1035 | 264 | ToDataType::check_type_precision(to_precision); | 1036 | 264 | UInt32 to_scale = to_decimal_type.get_scale(); | 1037 | 264 | ToDataType::check_type_scale(to_scale); | 1038 | | | 1039 | 264 | auto from_max_int_digit_count = from_precision - from_scale; | 1040 | 264 | auto to_max_int_digit_count = to_precision - to_scale; | 1041 | 264 | bool narrow_integral = | 1042 | 264 | (to_max_int_digit_count < from_max_int_digit_count) || | 1043 | 264 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1044 | | // only in non-strict mode and may overflow, we set nullable | 1045 | 264 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1046 | | | 1047 | 264 | size_t size = col_from->size(); | 1048 | 264 | ColumnUInt8::MutablePtr col_null_map_to; | 1049 | 264 | NullMap::value_type* null_map_data = nullptr; | 1050 | 264 | if (narrow_integral) { | 1051 | 64 | col_null_map_to = ColumnUInt8::create(size, 0); | 1052 | 64 | null_map_data = col_null_map_to->get_data().data(); | 1053 | 64 | } | 1054 | 264 | CastParameters params; | 1055 | 264 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1056 | 264 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1057 | 264 | const auto& vec_from = col_from->get_data(); | 1058 | 264 | const auto* vec_from_data = vec_from.data(); | 1059 | 264 | auto& vec_to = col_to->get_data(); | 1060 | 264 | auto* vec_to_data = vec_to.data(); | 1061 | | | 1062 | 264 | using MaxFieldType = | 1063 | 264 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1064 | 264 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1065 | 264 | std::is_same_v<FromFieldType, Decimal128V3>), | 1066 | 264 | Decimal128V3, | 1067 | 264 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1068 | 264 | FromFieldType, ToFieldType>>; | 1069 | 264 | using MaxNativeType = typename MaxFieldType::NativeType; | 1070 | | | 1071 | 264 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1072 | 264 | bool multiply_may_overflow = false; | 1073 | 264 | if (to_scale > from_scale) { | 1074 | 140 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1075 | 140 | } | 1076 | | | 1077 | 264 | typename ToFieldType::NativeType max_result = | 1078 | 264 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1079 | 264 | typename ToFieldType::NativeType min_result = -max_result; | 1080 | | | 1081 | 264 | MaxNativeType multiplier {}; | 1082 | 264 | if (from_scale < to_scale) { | 1083 | 140 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1084 | 140 | from_scale); | 1085 | 140 | } else if (from_scale > to_scale) { | 1086 | 60 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1087 | 60 | to_scale); | 1088 | 60 | } | 1089 | 264 | RETURN_IF_ERROR(std::visit( | 1090 | 264 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1091 | 264 | for (size_t i = 0; i < size; i++) { | 1092 | 264 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1093 | 264 | multiply_may_overflow, narrow_integral>( | 1094 | 264 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1095 | 264 | to_precision, to_scale, min_result, max_result, multiplier, | 1096 | 264 | params)) { | 1097 | 264 | if (set_nullable) { | 1098 | 264 | null_map_data[i] = 1; | 1099 | 264 | } else { | 1100 | 264 | return params.status; | 1101 | 264 | } | 1102 | 264 | } | 1103 | 264 | } | 1104 | 264 | return Status::OK(); | 1105 | 264 | }, | 1106 | 264 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1107 | 264 | if (narrow_integral) { | 1108 | 64 | block.get_by_position(result).column = | 1109 | 64 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1110 | 200 | } else { | 1111 | 200 | block.get_by_position(result).column = std::move(col_to); | 1112 | 200 | } | 1113 | 264 | return Status::OK(); | 1114 | 264 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEENS2_ILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 1017 | 120 | const NullMap::value_type* null_map = nullptr) const override { | 1018 | 120 | using FromFieldType = typename FromDataType::FieldType; | 1019 | 120 | using ToFieldType = typename ToDataType::FieldType; | 1020 | 120 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 1021 | 120 | const auto* col_from = | 1022 | 120 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 1023 | 120 | if (!col_from) { | 1024 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 1025 | 0 | named_from.column->get_name()); | 1026 | 0 | } | 1027 | | | 1028 | 120 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 1029 | 120 | UInt32 from_precision = from_decimal_type.get_precision(); | 1030 | 120 | UInt32 from_scale = from_decimal_type.get_scale(); | 1031 | | | 1032 | 120 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 1033 | 120 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 1034 | 120 | UInt32 to_precision = to_decimal_type.get_precision(); | 1035 | 120 | ToDataType::check_type_precision(to_precision); | 1036 | 120 | UInt32 to_scale = to_decimal_type.get_scale(); | 1037 | 120 | ToDataType::check_type_scale(to_scale); | 1038 | | | 1039 | 120 | auto from_max_int_digit_count = from_precision - from_scale; | 1040 | 120 | auto to_max_int_digit_count = to_precision - to_scale; | 1041 | 120 | bool narrow_integral = | 1042 | 120 | (to_max_int_digit_count < from_max_int_digit_count) || | 1043 | 120 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1044 | | // only in non-strict mode and may overflow, we set nullable | 1045 | 120 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1046 | | | 1047 | 120 | size_t size = col_from->size(); | 1048 | 120 | ColumnUInt8::MutablePtr col_null_map_to; | 1049 | 120 | NullMap::value_type* null_map_data = nullptr; | 1050 | 120 | if (narrow_integral) { | 1051 | 120 | col_null_map_to = ColumnUInt8::create(size, 0); | 1052 | 120 | null_map_data = col_null_map_to->get_data().data(); | 1053 | 120 | } | 1054 | 120 | CastParameters params; | 1055 | 120 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1056 | 120 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1057 | 120 | const auto& vec_from = col_from->get_data(); | 1058 | 120 | const auto* vec_from_data = vec_from.data(); | 1059 | 120 | auto& vec_to = col_to->get_data(); | 1060 | 120 | auto* vec_to_data = vec_to.data(); | 1061 | | | 1062 | 120 | using MaxFieldType = | 1063 | 120 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1064 | 120 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1065 | 120 | std::is_same_v<FromFieldType, Decimal128V3>), | 1066 | 120 | Decimal128V3, | 1067 | 120 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1068 | 120 | FromFieldType, ToFieldType>>; | 1069 | 120 | using MaxNativeType = typename MaxFieldType::NativeType; | 1070 | | | 1071 | 120 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1072 | 120 | bool multiply_may_overflow = false; | 1073 | 120 | if (to_scale > from_scale) { | 1074 | 120 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1075 | 120 | } | 1076 | | | 1077 | 120 | typename ToFieldType::NativeType max_result = | 1078 | 120 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1079 | 120 | typename ToFieldType::NativeType min_result = -max_result; | 1080 | | | 1081 | 120 | MaxNativeType multiplier {}; | 1082 | 120 | if (from_scale < to_scale) { | 1083 | 120 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1084 | 120 | from_scale); | 1085 | 120 | } else if (from_scale > to_scale) { | 1086 | 0 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1087 | 0 | to_scale); | 1088 | 0 | } | 1089 | 120 | RETURN_IF_ERROR(std::visit( | 1090 | 120 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1091 | 120 | for (size_t i = 0; i < size; i++) { | 1092 | 120 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1093 | 120 | multiply_may_overflow, narrow_integral>( | 1094 | 120 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1095 | 120 | to_precision, to_scale, min_result, max_result, multiplier, | 1096 | 120 | params)) { | 1097 | 120 | if (set_nullable) { | 1098 | 120 | null_map_data[i] = 1; | 1099 | 120 | } else { | 1100 | 120 | return params.status; | 1101 | 120 | } | 1102 | 120 | } | 1103 | 120 | } | 1104 | 120 | return Status::OK(); | 1105 | 120 | }, | 1106 | 120 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1107 | 0 | if (narrow_integral) { | 1108 | 0 | block.get_by_position(result).column = | 1109 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1110 | 0 | } else { | 1111 | 0 | block.get_by_position(result).column = std::move(col_to); | 1112 | 0 | } | 1113 | 0 | return Status::OK(); | 1114 | 120 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEENS2_ILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 1017 | 408 | const NullMap::value_type* null_map = nullptr) const override { | 1018 | 408 | using FromFieldType = typename FromDataType::FieldType; | 1019 | 408 | using ToFieldType = typename ToDataType::FieldType; | 1020 | 408 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 1021 | 408 | const auto* col_from = | 1022 | 408 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 1023 | 408 | if (!col_from) { | 1024 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 1025 | 0 | named_from.column->get_name()); | 1026 | 0 | } | 1027 | | | 1028 | 408 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 1029 | 408 | UInt32 from_precision = from_decimal_type.get_precision(); | 1030 | 408 | UInt32 from_scale = from_decimal_type.get_scale(); | 1031 | | | 1032 | 408 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 1033 | 408 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 1034 | 408 | UInt32 to_precision = to_decimal_type.get_precision(); | 1035 | 408 | ToDataType::check_type_precision(to_precision); | 1036 | 408 | UInt32 to_scale = to_decimal_type.get_scale(); | 1037 | 408 | ToDataType::check_type_scale(to_scale); | 1038 | | | 1039 | 408 | auto from_max_int_digit_count = from_precision - from_scale; | 1040 | 408 | auto to_max_int_digit_count = to_precision - to_scale; | 1041 | 408 | bool narrow_integral = | 1042 | 408 | (to_max_int_digit_count < from_max_int_digit_count) || | 1043 | 408 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1044 | | // only in non-strict mode and may overflow, we set nullable | 1045 | 408 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1046 | | | 1047 | 408 | size_t size = col_from->size(); | 1048 | 408 | ColumnUInt8::MutablePtr col_null_map_to; | 1049 | 408 | NullMap::value_type* null_map_data = nullptr; | 1050 | 408 | if (narrow_integral) { | 1051 | 112 | col_null_map_to = ColumnUInt8::create(size, 0); | 1052 | 112 | null_map_data = col_null_map_to->get_data().data(); | 1053 | 112 | } | 1054 | 408 | CastParameters params; | 1055 | 408 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1056 | 408 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1057 | 408 | const auto& vec_from = col_from->get_data(); | 1058 | 408 | const auto* vec_from_data = vec_from.data(); | 1059 | 408 | auto& vec_to = col_to->get_data(); | 1060 | 408 | auto* vec_to_data = vec_to.data(); | 1061 | | | 1062 | 408 | using MaxFieldType = | 1063 | 408 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1064 | 408 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1065 | 408 | std::is_same_v<FromFieldType, Decimal128V3>), | 1066 | 408 | Decimal128V3, | 1067 | 408 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1068 | 408 | FromFieldType, ToFieldType>>; | 1069 | 408 | using MaxNativeType = typename MaxFieldType::NativeType; | 1070 | | | 1071 | 408 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1072 | 408 | bool multiply_may_overflow = false; | 1073 | 408 | if (to_scale > from_scale) { | 1074 | 198 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1075 | 198 | } | 1076 | | | 1077 | 408 | typename ToFieldType::NativeType max_result = | 1078 | 408 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1079 | 408 | typename ToFieldType::NativeType min_result = -max_result; | 1080 | | | 1081 | 408 | MaxNativeType multiplier {}; | 1082 | 408 | if (from_scale < to_scale) { | 1083 | 198 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1084 | 198 | from_scale); | 1085 | 210 | } else if (from_scale > to_scale) { | 1086 | 112 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1087 | 112 | to_scale); | 1088 | 112 | } | 1089 | 408 | RETURN_IF_ERROR(std::visit( | 1090 | 408 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1091 | 408 | for (size_t i = 0; i < size; i++) { | 1092 | 408 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1093 | 408 | multiply_may_overflow, narrow_integral>( | 1094 | 408 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1095 | 408 | to_precision, to_scale, min_result, max_result, multiplier, | 1096 | 408 | params)) { | 1097 | 408 | if (set_nullable) { | 1098 | 408 | null_map_data[i] = 1; | 1099 | 408 | } else { | 1100 | 408 | return params.status; | 1101 | 408 | } | 1102 | 408 | } | 1103 | 408 | } | 1104 | 408 | return Status::OK(); | 1105 | 408 | }, | 1106 | 408 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1107 | 408 | if (narrow_integral) { | 1108 | 112 | block.get_by_position(result).column = | 1109 | 112 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1110 | 296 | } else { | 1111 | 296 | block.get_by_position(result).column = std::move(col_to); | 1112 | 296 | } | 1113 | 408 | return Status::OK(); | 1114 | 408 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEES4_E12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 1017 | 184 | const NullMap::value_type* null_map = nullptr) const override { | 1018 | 184 | using FromFieldType = typename FromDataType::FieldType; | 1019 | 184 | using ToFieldType = typename ToDataType::FieldType; | 1020 | 184 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 1021 | 184 | const auto* col_from = | 1022 | 184 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 1023 | 184 | if (!col_from) { | 1024 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 1025 | 0 | named_from.column->get_name()); | 1026 | 0 | } | 1027 | | | 1028 | 184 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 1029 | 184 | UInt32 from_precision = from_decimal_type.get_precision(); | 1030 | 184 | UInt32 from_scale = from_decimal_type.get_scale(); | 1031 | | | 1032 | 184 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 1033 | 184 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 1034 | 184 | UInt32 to_precision = to_decimal_type.get_precision(); | 1035 | 184 | ToDataType::check_type_precision(to_precision); | 1036 | 184 | UInt32 to_scale = to_decimal_type.get_scale(); | 1037 | 184 | ToDataType::check_type_scale(to_scale); | 1038 | | | 1039 | 184 | auto from_max_int_digit_count = from_precision - from_scale; | 1040 | 184 | auto to_max_int_digit_count = to_precision - to_scale; | 1041 | 184 | bool narrow_integral = | 1042 | 184 | (to_max_int_digit_count < from_max_int_digit_count) || | 1043 | 184 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1044 | | // only in non-strict mode and may overflow, we set nullable | 1045 | 184 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1046 | | | 1047 | 184 | size_t size = col_from->size(); | 1048 | 184 | ColumnUInt8::MutablePtr col_null_map_to; | 1049 | 184 | NullMap::value_type* null_map_data = nullptr; | 1050 | 184 | if (narrow_integral) { | 1051 | 184 | col_null_map_to = ColumnUInt8::create(size, 0); | 1052 | 184 | null_map_data = col_null_map_to->get_data().data(); | 1053 | 184 | } | 1054 | 184 | CastParameters params; | 1055 | 184 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1056 | 184 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1057 | 184 | const auto& vec_from = col_from->get_data(); | 1058 | 184 | const auto* vec_from_data = vec_from.data(); | 1059 | 184 | auto& vec_to = col_to->get_data(); | 1060 | 184 | auto* vec_to_data = vec_to.data(); | 1061 | | | 1062 | 184 | using MaxFieldType = | 1063 | 184 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1064 | 184 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1065 | 184 | std::is_same_v<FromFieldType, Decimal128V3>), | 1066 | 184 | Decimal128V3, | 1067 | 184 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1068 | 184 | FromFieldType, ToFieldType>>; | 1069 | 184 | using MaxNativeType = typename MaxFieldType::NativeType; | 1070 | | | 1071 | 184 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1072 | 184 | bool multiply_may_overflow = false; | 1073 | 184 | if (to_scale > from_scale) { | 1074 | 132 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1075 | 132 | } | 1076 | | | 1077 | 184 | typename ToFieldType::NativeType max_result = | 1078 | 184 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1079 | 184 | typename ToFieldType::NativeType min_result = -max_result; | 1080 | | | 1081 | 184 | MaxNativeType multiplier {}; | 1082 | 184 | if (from_scale < to_scale) { | 1083 | 132 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1084 | 132 | from_scale); | 1085 | 132 | } else if (from_scale > to_scale) { | 1086 | 40 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1087 | 40 | to_scale); | 1088 | 40 | } | 1089 | 184 | RETURN_IF_ERROR(std::visit( | 1090 | 184 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1091 | 184 | for (size_t i = 0; i < size; i++) { | 1092 | 184 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1093 | 184 | multiply_may_overflow, narrow_integral>( | 1094 | 184 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1095 | 184 | to_precision, to_scale, min_result, max_result, multiplier, | 1096 | 184 | params)) { | 1097 | 184 | if (set_nullable) { | 1098 | 184 | null_map_data[i] = 1; | 1099 | 184 | } else { | 1100 | 184 | return params.status; | 1101 | 184 | } | 1102 | 184 | } | 1103 | 184 | } | 1104 | 184 | return Status::OK(); | 1105 | 184 | }, | 1106 | 184 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1107 | 0 | if (narrow_integral) { | 1108 | 0 | block.get_by_position(result).column = | 1109 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1110 | 0 | } else { | 1111 | 0 | block.get_by_position(result).column = std::move(col_to); | 1112 | 0 | } | 1113 | 0 | return Status::OK(); | 1114 | 184 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEES4_E12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 1017 | 360 | const NullMap::value_type* null_map = nullptr) const override { | 1018 | 360 | using FromFieldType = typename FromDataType::FieldType; | 1019 | 360 | using ToFieldType = typename ToDataType::FieldType; | 1020 | 360 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 1021 | 360 | const auto* col_from = | 1022 | 360 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 1023 | 360 | if (!col_from) { | 1024 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 1025 | 0 | named_from.column->get_name()); | 1026 | 0 | } | 1027 | | | 1028 | 360 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 1029 | 360 | UInt32 from_precision = from_decimal_type.get_precision(); | 1030 | 360 | UInt32 from_scale = from_decimal_type.get_scale(); | 1031 | | | 1032 | 360 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 1033 | 360 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 1034 | 360 | UInt32 to_precision = to_decimal_type.get_precision(); | 1035 | 360 | ToDataType::check_type_precision(to_precision); | 1036 | 360 | UInt32 to_scale = to_decimal_type.get_scale(); | 1037 | 360 | ToDataType::check_type_scale(to_scale); | 1038 | | | 1039 | 360 | auto from_max_int_digit_count = from_precision - from_scale; | 1040 | 360 | auto to_max_int_digit_count = to_precision - to_scale; | 1041 | 360 | bool narrow_integral = | 1042 | 360 | (to_max_int_digit_count < from_max_int_digit_count) || | 1043 | 360 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1044 | | // only in non-strict mode and may overflow, we set nullable | 1045 | 360 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1046 | | | 1047 | 360 | size_t size = col_from->size(); | 1048 | 360 | ColumnUInt8::MutablePtr col_null_map_to; | 1049 | 360 | NullMap::value_type* null_map_data = nullptr; | 1050 | 360 | if (narrow_integral) { | 1051 | 208 | col_null_map_to = ColumnUInt8::create(size, 0); | 1052 | 208 | null_map_data = col_null_map_to->get_data().data(); | 1053 | 208 | } | 1054 | 360 | CastParameters params; | 1055 | 360 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1056 | 360 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1057 | 360 | const auto& vec_from = col_from->get_data(); | 1058 | 360 | const auto* vec_from_data = vec_from.data(); | 1059 | 360 | auto& vec_to = col_to->get_data(); | 1060 | 360 | auto* vec_to_data = vec_to.data(); | 1061 | | | 1062 | 360 | using MaxFieldType = | 1063 | 360 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1064 | 360 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1065 | 360 | std::is_same_v<FromFieldType, Decimal128V3>), | 1066 | 360 | Decimal128V3, | 1067 | 360 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1068 | 360 | FromFieldType, ToFieldType>>; | 1069 | 360 | using MaxNativeType = typename MaxFieldType::NativeType; | 1070 | | | 1071 | 360 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1072 | 360 | bool multiply_may_overflow = false; | 1073 | 360 | if (to_scale > from_scale) { | 1074 | 172 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1075 | 172 | } | 1076 | | | 1077 | 360 | typename ToFieldType::NativeType max_result = | 1078 | 360 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1079 | 360 | typename ToFieldType::NativeType min_result = -max_result; | 1080 | | | 1081 | 360 | MaxNativeType multiplier {}; | 1082 | 360 | if (from_scale < to_scale) { | 1083 | 172 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1084 | 172 | from_scale); | 1085 | 188 | } else if (from_scale > to_scale) { | 1086 | 136 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1087 | 136 | to_scale); | 1088 | 136 | } | 1089 | 360 | RETURN_IF_ERROR(std::visit( | 1090 | 360 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1091 | 360 | for (size_t i = 0; i < size; i++) { | 1092 | 360 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1093 | 360 | multiply_may_overflow, narrow_integral>( | 1094 | 360 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1095 | 360 | to_precision, to_scale, min_result, max_result, multiplier, | 1096 | 360 | params)) { | 1097 | 360 | if (set_nullable) { | 1098 | 360 | null_map_data[i] = 1; | 1099 | 360 | } else { | 1100 | 360 | return params.status; | 1101 | 360 | } | 1102 | 360 | } | 1103 | 360 | } | 1104 | 360 | return Status::OK(); | 1105 | 360 | }, | 1106 | 360 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1107 | 360 | if (narrow_integral) { | 1108 | 208 | block.get_by_position(result).column = | 1109 | 208 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1110 | 208 | } else { | 1111 | 152 | block.get_by_position(result).column = std::move(col_to); | 1112 | 152 | } | 1113 | 360 | return Status::OK(); | 1114 | 360 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEENS2_ILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 1017 | 306 | const NullMap::value_type* null_map = nullptr) const override { | 1018 | 306 | using FromFieldType = typename FromDataType::FieldType; | 1019 | 306 | using ToFieldType = typename ToDataType::FieldType; | 1020 | 306 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 1021 | 306 | const auto* col_from = | 1022 | 306 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 1023 | 306 | if (!col_from) { | 1024 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 1025 | 0 | named_from.column->get_name()); | 1026 | 0 | } | 1027 | | | 1028 | 306 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 1029 | 306 | UInt32 from_precision = from_decimal_type.get_precision(); | 1030 | 306 | UInt32 from_scale = from_decimal_type.get_scale(); | 1031 | | | 1032 | 306 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 1033 | 306 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 1034 | 306 | UInt32 to_precision = to_decimal_type.get_precision(); | 1035 | 306 | ToDataType::check_type_precision(to_precision); | 1036 | 306 | UInt32 to_scale = to_decimal_type.get_scale(); | 1037 | 306 | ToDataType::check_type_scale(to_scale); | 1038 | | | 1039 | 306 | auto from_max_int_digit_count = from_precision - from_scale; | 1040 | 306 | auto to_max_int_digit_count = to_precision - to_scale; | 1041 | 306 | bool narrow_integral = | 1042 | 306 | (to_max_int_digit_count < from_max_int_digit_count) || | 1043 | 306 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1044 | | // only in non-strict mode and may overflow, we set nullable | 1045 | 306 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1046 | | | 1047 | 306 | size_t size = col_from->size(); | 1048 | 306 | ColumnUInt8::MutablePtr col_null_map_to; | 1049 | 306 | NullMap::value_type* null_map_data = nullptr; | 1050 | 306 | if (narrow_integral) { | 1051 | 306 | col_null_map_to = ColumnUInt8::create(size, 0); | 1052 | 306 | null_map_data = col_null_map_to->get_data().data(); | 1053 | 306 | } | 1054 | 306 | CastParameters params; | 1055 | 306 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1056 | 306 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1057 | 306 | const auto& vec_from = col_from->get_data(); | 1058 | 306 | const auto* vec_from_data = vec_from.data(); | 1059 | 306 | auto& vec_to = col_to->get_data(); | 1060 | 306 | auto* vec_to_data = vec_to.data(); | 1061 | | | 1062 | 306 | using MaxFieldType = | 1063 | 306 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1064 | 306 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1065 | 306 | std::is_same_v<FromFieldType, Decimal128V3>), | 1066 | 306 | Decimal128V3, | 1067 | 306 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1068 | 306 | FromFieldType, ToFieldType>>; | 1069 | 306 | using MaxNativeType = typename MaxFieldType::NativeType; | 1070 | | | 1071 | 306 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1072 | 306 | bool multiply_may_overflow = false; | 1073 | 306 | if (to_scale > from_scale) { | 1074 | 120 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1075 | 120 | } | 1076 | | | 1077 | 306 | typename ToFieldType::NativeType max_result = | 1078 | 306 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1079 | 306 | typename ToFieldType::NativeType min_result = -max_result; | 1080 | | | 1081 | 306 | MaxNativeType multiplier {}; | 1082 | 306 | if (from_scale < to_scale) { | 1083 | 120 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1084 | 120 | from_scale); | 1085 | 186 | } else if (from_scale > to_scale) { | 1086 | 132 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1087 | 132 | to_scale); | 1088 | 132 | } | 1089 | 306 | RETURN_IF_ERROR(std::visit( | 1090 | 306 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1091 | 306 | for (size_t i = 0; i < size; i++) { | 1092 | 306 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1093 | 306 | multiply_may_overflow, narrow_integral>( | 1094 | 306 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1095 | 306 | to_precision, to_scale, min_result, max_result, multiplier, | 1096 | 306 | params)) { | 1097 | 306 | if (set_nullable) { | 1098 | 306 | null_map_data[i] = 1; | 1099 | 306 | } else { | 1100 | 306 | return params.status; | 1101 | 306 | } | 1102 | 306 | } | 1103 | 306 | } | 1104 | 306 | return Status::OK(); | 1105 | 306 | }, | 1106 | 306 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1107 | 0 | if (narrow_integral) { | 1108 | 0 | block.get_by_position(result).column = | 1109 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1110 | 0 | } else { | 1111 | 0 | block.get_by_position(result).column = std::move(col_to); | 1112 | 0 | } | 1113 | 0 | return Status::OK(); | 1114 | 306 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEENS2_ILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 1017 | 456 | const NullMap::value_type* null_map = nullptr) const override { | 1018 | 456 | using FromFieldType = typename FromDataType::FieldType; | 1019 | 456 | using ToFieldType = typename ToDataType::FieldType; | 1020 | 456 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 1021 | 456 | const auto* col_from = | 1022 | 456 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 1023 | 456 | if (!col_from) { | 1024 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 1025 | 0 | named_from.column->get_name()); | 1026 | 0 | } | 1027 | | | 1028 | 456 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 1029 | 456 | UInt32 from_precision = from_decimal_type.get_precision(); | 1030 | 456 | UInt32 from_scale = from_decimal_type.get_scale(); | 1031 | | | 1032 | 456 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 1033 | 456 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 1034 | 456 | UInt32 to_precision = to_decimal_type.get_precision(); | 1035 | 456 | ToDataType::check_type_precision(to_precision); | 1036 | 456 | UInt32 to_scale = to_decimal_type.get_scale(); | 1037 | 456 | ToDataType::check_type_scale(to_scale); | 1038 | | | 1039 | 456 | auto from_max_int_digit_count = from_precision - from_scale; | 1040 | 456 | auto to_max_int_digit_count = to_precision - to_scale; | 1041 | 456 | bool narrow_integral = | 1042 | 456 | (to_max_int_digit_count < from_max_int_digit_count) || | 1043 | 456 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1044 | | // only in non-strict mode and may overflow, we set nullable | 1045 | 456 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1046 | | | 1047 | 456 | size_t size = col_from->size(); | 1048 | 456 | ColumnUInt8::MutablePtr col_null_map_to; | 1049 | 456 | NullMap::value_type* null_map_data = nullptr; | 1050 | 456 | if (narrow_integral) { | 1051 | 384 | col_null_map_to = ColumnUInt8::create(size, 0); | 1052 | 384 | null_map_data = col_null_map_to->get_data().data(); | 1053 | 384 | } | 1054 | 456 | CastParameters params; | 1055 | 456 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1056 | 456 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1057 | 456 | const auto& vec_from = col_from->get_data(); | 1058 | 456 | const auto* vec_from_data = vec_from.data(); | 1059 | 456 | auto& vec_to = col_to->get_data(); | 1060 | 456 | auto* vec_to_data = vec_to.data(); | 1061 | | | 1062 | 456 | using MaxFieldType = | 1063 | 456 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1064 | 456 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1065 | 456 | std::is_same_v<FromFieldType, Decimal128V3>), | 1066 | 456 | Decimal128V3, | 1067 | 456 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1068 | 456 | FromFieldType, ToFieldType>>; | 1069 | 456 | using MaxNativeType = typename MaxFieldType::NativeType; | 1070 | | | 1071 | 456 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1072 | 456 | bool multiply_may_overflow = false; | 1073 | 456 | if (to_scale > from_scale) { | 1074 | 152 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1075 | 152 | } | 1076 | | | 1077 | 456 | typename ToFieldType::NativeType max_result = | 1078 | 456 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1079 | 456 | typename ToFieldType::NativeType min_result = -max_result; | 1080 | | | 1081 | 456 | MaxNativeType multiplier {}; | 1082 | 456 | if (from_scale < to_scale) { | 1083 | 152 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1084 | 152 | from_scale); | 1085 | 304 | } else if (from_scale > to_scale) { | 1086 | 188 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1087 | 188 | to_scale); | 1088 | 188 | } | 1089 | 456 | RETURN_IF_ERROR(std::visit( | 1090 | 456 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1091 | 456 | for (size_t i = 0; i < size; i++) { | 1092 | 456 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1093 | 456 | multiply_may_overflow, narrow_integral>( | 1094 | 456 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1095 | 456 | to_precision, to_scale, min_result, max_result, multiplier, | 1096 | 456 | params)) { | 1097 | 456 | if (set_nullable) { | 1098 | 456 | null_map_data[i] = 1; | 1099 | 456 | } else { | 1100 | 456 | return params.status; | 1101 | 456 | } | 1102 | 456 | } | 1103 | 456 | } | 1104 | 456 | return Status::OK(); | 1105 | 456 | }, | 1106 | 456 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1107 | 456 | if (narrow_integral) { | 1108 | 384 | block.get_by_position(result).column = | 1109 | 384 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1110 | 384 | } else { | 1111 | 72 | block.get_by_position(result).column = std::move(col_to); | 1112 | 72 | } | 1113 | 456 | return Status::OK(); | 1114 | 456 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEENS2_ILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 1017 | 72 | const NullMap::value_type* null_map = nullptr) const override { | 1018 | 72 | using FromFieldType = typename FromDataType::FieldType; | 1019 | 72 | using ToFieldType = typename ToDataType::FieldType; | 1020 | 72 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 1021 | 72 | const auto* col_from = | 1022 | 72 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 1023 | 72 | if (!col_from) { | 1024 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 1025 | 0 | named_from.column->get_name()); | 1026 | 0 | } | 1027 | | | 1028 | 72 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 1029 | 72 | UInt32 from_precision = from_decimal_type.get_precision(); | 1030 | 72 | UInt32 from_scale = from_decimal_type.get_scale(); | 1031 | | | 1032 | 72 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 1033 | 72 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 1034 | 72 | UInt32 to_precision = to_decimal_type.get_precision(); | 1035 | 72 | ToDataType::check_type_precision(to_precision); | 1036 | 72 | UInt32 to_scale = to_decimal_type.get_scale(); | 1037 | 72 | ToDataType::check_type_scale(to_scale); | 1038 | | | 1039 | 72 | auto from_max_int_digit_count = from_precision - from_scale; | 1040 | 72 | auto to_max_int_digit_count = to_precision - to_scale; | 1041 | 72 | bool narrow_integral = | 1042 | 72 | (to_max_int_digit_count < from_max_int_digit_count) || | 1043 | 72 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1044 | | // only in non-strict mode and may overflow, we set nullable | 1045 | 72 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1046 | | | 1047 | 72 | size_t size = col_from->size(); | 1048 | 72 | ColumnUInt8::MutablePtr col_null_map_to; | 1049 | 72 | NullMap::value_type* null_map_data = nullptr; | 1050 | 72 | if (narrow_integral) { | 1051 | 72 | col_null_map_to = ColumnUInt8::create(size, 0); | 1052 | 72 | null_map_data = col_null_map_to->get_data().data(); | 1053 | 72 | } | 1054 | 72 | CastParameters params; | 1055 | 72 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1056 | 72 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1057 | 72 | const auto& vec_from = col_from->get_data(); | 1058 | 72 | const auto* vec_from_data = vec_from.data(); | 1059 | 72 | auto& vec_to = col_to->get_data(); | 1060 | 72 | auto* vec_to_data = vec_to.data(); | 1061 | | | 1062 | 72 | using MaxFieldType = | 1063 | 72 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1064 | 72 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1065 | 72 | std::is_same_v<FromFieldType, Decimal128V3>), | 1066 | 72 | Decimal128V3, | 1067 | 72 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1068 | 72 | FromFieldType, ToFieldType>>; | 1069 | 72 | using MaxNativeType = typename MaxFieldType::NativeType; | 1070 | | | 1071 | 72 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1072 | 72 | bool multiply_may_overflow = false; | 1073 | 72 | if (to_scale > from_scale) { | 1074 | 72 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1075 | 72 | } | 1076 | | | 1077 | 72 | typename ToFieldType::NativeType max_result = | 1078 | 72 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1079 | 72 | typename ToFieldType::NativeType min_result = -max_result; | 1080 | | | 1081 | 72 | MaxNativeType multiplier {}; | 1082 | 72 | if (from_scale < to_scale) { | 1083 | 72 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1084 | 72 | from_scale); | 1085 | 72 | } else if (from_scale > to_scale) { | 1086 | 0 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1087 | 0 | to_scale); | 1088 | 0 | } | 1089 | 72 | RETURN_IF_ERROR(std::visit( | 1090 | 72 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1091 | 72 | for (size_t i = 0; i < size; i++) { | 1092 | 72 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1093 | 72 | multiply_may_overflow, narrow_integral>( | 1094 | 72 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1095 | 72 | to_precision, to_scale, min_result, max_result, multiplier, | 1096 | 72 | params)) { | 1097 | 72 | if (set_nullable) { | 1098 | 72 | null_map_data[i] = 1; | 1099 | 72 | } else { | 1100 | 72 | return params.status; | 1101 | 72 | } | 1102 | 72 | } | 1103 | 72 | } | 1104 | 72 | return Status::OK(); | 1105 | 72 | }, | 1106 | 72 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1107 | 0 | if (narrow_integral) { | 1108 | 0 | block.get_by_position(result).column = | 1109 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1110 | 0 | } else { | 1111 | 0 | block.get_by_position(result).column = std::move(col_to); | 1112 | 0 | } | 1113 | 0 | return Status::OK(); | 1114 | 72 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEENS2_ILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 1017 | 264 | const NullMap::value_type* null_map = nullptr) const override { | 1018 | 264 | using FromFieldType = typename FromDataType::FieldType; | 1019 | 264 | using ToFieldType = typename ToDataType::FieldType; | 1020 | 264 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 1021 | 264 | const auto* col_from = | 1022 | 264 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 1023 | 264 | if (!col_from) { | 1024 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 1025 | 0 | named_from.column->get_name()); | 1026 | 0 | } | 1027 | | | 1028 | 264 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 1029 | 264 | UInt32 from_precision = from_decimal_type.get_precision(); | 1030 | 264 | UInt32 from_scale = from_decimal_type.get_scale(); | 1031 | | | 1032 | 264 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 1033 | 264 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 1034 | 264 | UInt32 to_precision = to_decimal_type.get_precision(); | 1035 | 264 | ToDataType::check_type_precision(to_precision); | 1036 | 264 | UInt32 to_scale = to_decimal_type.get_scale(); | 1037 | 264 | ToDataType::check_type_scale(to_scale); | 1038 | | | 1039 | 264 | auto from_max_int_digit_count = from_precision - from_scale; | 1040 | 264 | auto to_max_int_digit_count = to_precision - to_scale; | 1041 | 264 | bool narrow_integral = | 1042 | 264 | (to_max_int_digit_count < from_max_int_digit_count) || | 1043 | 264 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1044 | | // only in non-strict mode and may overflow, we set nullable | 1045 | 264 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1046 | | | 1047 | 264 | size_t size = col_from->size(); | 1048 | 264 | ColumnUInt8::MutablePtr col_null_map_to; | 1049 | 264 | NullMap::value_type* null_map_data = nullptr; | 1050 | 264 | if (narrow_integral) { | 1051 | 64 | col_null_map_to = ColumnUInt8::create(size, 0); | 1052 | 64 | null_map_data = col_null_map_to->get_data().data(); | 1053 | 64 | } | 1054 | 264 | CastParameters params; | 1055 | 264 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1056 | 264 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1057 | 264 | const auto& vec_from = col_from->get_data(); | 1058 | 264 | const auto* vec_from_data = vec_from.data(); | 1059 | 264 | auto& vec_to = col_to->get_data(); | 1060 | 264 | auto* vec_to_data = vec_to.data(); | 1061 | | | 1062 | 264 | using MaxFieldType = | 1063 | 264 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1064 | 264 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1065 | 264 | std::is_same_v<FromFieldType, Decimal128V3>), | 1066 | 264 | Decimal128V3, | 1067 | 264 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1068 | 264 | FromFieldType, ToFieldType>>; | 1069 | 264 | using MaxNativeType = typename MaxFieldType::NativeType; | 1070 | | | 1071 | 264 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1072 | 264 | bool multiply_may_overflow = false; | 1073 | 264 | if (to_scale > from_scale) { | 1074 | 140 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1075 | 140 | } | 1076 | | | 1077 | 264 | typename ToFieldType::NativeType max_result = | 1078 | 264 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1079 | 264 | typename ToFieldType::NativeType min_result = -max_result; | 1080 | | | 1081 | 264 | MaxNativeType multiplier {}; | 1082 | 264 | if (from_scale < to_scale) { | 1083 | 140 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1084 | 140 | from_scale); | 1085 | 140 | } else if (from_scale > to_scale) { | 1086 | 60 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1087 | 60 | to_scale); | 1088 | 60 | } | 1089 | 264 | RETURN_IF_ERROR(std::visit( | 1090 | 264 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1091 | 264 | for (size_t i = 0; i < size; i++) { | 1092 | 264 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1093 | 264 | multiply_may_overflow, narrow_integral>( | 1094 | 264 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1095 | 264 | to_precision, to_scale, min_result, max_result, multiplier, | 1096 | 264 | params)) { | 1097 | 264 | if (set_nullable) { | 1098 | 264 | null_map_data[i] = 1; | 1099 | 264 | } else { | 1100 | 264 | return params.status; | 1101 | 264 | } | 1102 | 264 | } | 1103 | 264 | } | 1104 | 264 | return Status::OK(); | 1105 | 264 | }, | 1106 | 264 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1107 | 264 | if (narrow_integral) { | 1108 | 64 | block.get_by_position(result).column = | 1109 | 64 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1110 | 200 | } else { | 1111 | 200 | block.get_by_position(result).column = std::move(col_to); | 1112 | 200 | } | 1113 | 264 | return Status::OK(); | 1114 | 264 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEENS2_ILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 1017 | 120 | const NullMap::value_type* null_map = nullptr) const override { | 1018 | 120 | using FromFieldType = typename FromDataType::FieldType; | 1019 | 120 | using ToFieldType = typename ToDataType::FieldType; | 1020 | 120 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 1021 | 120 | const auto* col_from = | 1022 | 120 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 1023 | 120 | if (!col_from) { | 1024 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 1025 | 0 | named_from.column->get_name()); | 1026 | 0 | } | 1027 | | | 1028 | 120 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 1029 | 120 | UInt32 from_precision = from_decimal_type.get_precision(); | 1030 | 120 | UInt32 from_scale = from_decimal_type.get_scale(); | 1031 | | | 1032 | 120 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 1033 | 120 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 1034 | 120 | UInt32 to_precision = to_decimal_type.get_precision(); | 1035 | 120 | ToDataType::check_type_precision(to_precision); | 1036 | 120 | UInt32 to_scale = to_decimal_type.get_scale(); | 1037 | 120 | ToDataType::check_type_scale(to_scale); | 1038 | | | 1039 | 120 | auto from_max_int_digit_count = from_precision - from_scale; | 1040 | 120 | auto to_max_int_digit_count = to_precision - to_scale; | 1041 | 120 | bool narrow_integral = | 1042 | 120 | (to_max_int_digit_count < from_max_int_digit_count) || | 1043 | 120 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1044 | | // only in non-strict mode and may overflow, we set nullable | 1045 | 120 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1046 | | | 1047 | 120 | size_t size = col_from->size(); | 1048 | 120 | ColumnUInt8::MutablePtr col_null_map_to; | 1049 | 120 | NullMap::value_type* null_map_data = nullptr; | 1050 | 120 | if (narrow_integral) { | 1051 | 120 | col_null_map_to = ColumnUInt8::create(size, 0); | 1052 | 120 | null_map_data = col_null_map_to->get_data().data(); | 1053 | 120 | } | 1054 | 120 | CastParameters params; | 1055 | 120 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1056 | 120 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1057 | 120 | const auto& vec_from = col_from->get_data(); | 1058 | 120 | const auto* vec_from_data = vec_from.data(); | 1059 | 120 | auto& vec_to = col_to->get_data(); | 1060 | 120 | auto* vec_to_data = vec_to.data(); | 1061 | | | 1062 | 120 | using MaxFieldType = | 1063 | 120 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1064 | 120 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1065 | 120 | std::is_same_v<FromFieldType, Decimal128V3>), | 1066 | 120 | Decimal128V3, | 1067 | 120 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1068 | 120 | FromFieldType, ToFieldType>>; | 1069 | 120 | using MaxNativeType = typename MaxFieldType::NativeType; | 1070 | | | 1071 | 120 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1072 | 120 | bool multiply_may_overflow = false; | 1073 | 120 | if (to_scale > from_scale) { | 1074 | 120 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1075 | 120 | } | 1076 | | | 1077 | 120 | typename ToFieldType::NativeType max_result = | 1078 | 120 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1079 | 120 | typename ToFieldType::NativeType min_result = -max_result; | 1080 | | | 1081 | 120 | MaxNativeType multiplier {}; | 1082 | 120 | if (from_scale < to_scale) { | 1083 | 120 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1084 | 120 | from_scale); | 1085 | 120 | } else if (from_scale > to_scale) { | 1086 | 0 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1087 | 0 | to_scale); | 1088 | 0 | } | 1089 | 120 | RETURN_IF_ERROR(std::visit( | 1090 | 120 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1091 | 120 | for (size_t i = 0; i < size; i++) { | 1092 | 120 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1093 | 120 | multiply_may_overflow, narrow_integral>( | 1094 | 120 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1095 | 120 | to_precision, to_scale, min_result, max_result, multiplier, | 1096 | 120 | params)) { | 1097 | 120 | if (set_nullable) { | 1098 | 120 | null_map_data[i] = 1; | 1099 | 120 | } else { | 1100 | 120 | return params.status; | 1101 | 120 | } | 1102 | 120 | } | 1103 | 120 | } | 1104 | 120 | return Status::OK(); | 1105 | 120 | }, | 1106 | 120 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1107 | 0 | if (narrow_integral) { | 1108 | 0 | block.get_by_position(result).column = | 1109 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1110 | 0 | } else { | 1111 | 0 | block.get_by_position(result).column = std::move(col_to); | 1112 | 0 | } | 1113 | 0 | return Status::OK(); | 1114 | 120 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEENS2_ILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 1017 | 408 | const NullMap::value_type* null_map = nullptr) const override { | 1018 | 408 | using FromFieldType = typename FromDataType::FieldType; | 1019 | 408 | using ToFieldType = typename ToDataType::FieldType; | 1020 | 408 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 1021 | 408 | const auto* col_from = | 1022 | 408 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 1023 | 408 | if (!col_from) { | 1024 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 1025 | 0 | named_from.column->get_name()); | 1026 | 0 | } | 1027 | | | 1028 | 408 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 1029 | 408 | UInt32 from_precision = from_decimal_type.get_precision(); | 1030 | 408 | UInt32 from_scale = from_decimal_type.get_scale(); | 1031 | | | 1032 | 408 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 1033 | 408 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 1034 | 408 | UInt32 to_precision = to_decimal_type.get_precision(); | 1035 | 408 | ToDataType::check_type_precision(to_precision); | 1036 | 408 | UInt32 to_scale = to_decimal_type.get_scale(); | 1037 | 408 | ToDataType::check_type_scale(to_scale); | 1038 | | | 1039 | 408 | auto from_max_int_digit_count = from_precision - from_scale; | 1040 | 408 | auto to_max_int_digit_count = to_precision - to_scale; | 1041 | 408 | bool narrow_integral = | 1042 | 408 | (to_max_int_digit_count < from_max_int_digit_count) || | 1043 | 408 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1044 | | // only in non-strict mode and may overflow, we set nullable | 1045 | 408 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1046 | | | 1047 | 408 | size_t size = col_from->size(); | 1048 | 408 | ColumnUInt8::MutablePtr col_null_map_to; | 1049 | 408 | NullMap::value_type* null_map_data = nullptr; | 1050 | 408 | if (narrow_integral) { | 1051 | 112 | col_null_map_to = ColumnUInt8::create(size, 0); | 1052 | 112 | null_map_data = col_null_map_to->get_data().data(); | 1053 | 112 | } | 1054 | 408 | CastParameters params; | 1055 | 408 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1056 | 408 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1057 | 408 | const auto& vec_from = col_from->get_data(); | 1058 | 408 | const auto* vec_from_data = vec_from.data(); | 1059 | 408 | auto& vec_to = col_to->get_data(); | 1060 | 408 | auto* vec_to_data = vec_to.data(); | 1061 | | | 1062 | 408 | using MaxFieldType = | 1063 | 408 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1064 | 408 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1065 | 408 | std::is_same_v<FromFieldType, Decimal128V3>), | 1066 | 408 | Decimal128V3, | 1067 | 408 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1068 | 408 | FromFieldType, ToFieldType>>; | 1069 | 408 | using MaxNativeType = typename MaxFieldType::NativeType; | 1070 | | | 1071 | 408 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1072 | 408 | bool multiply_may_overflow = false; | 1073 | 408 | if (to_scale > from_scale) { | 1074 | 200 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1075 | 200 | } | 1076 | | | 1077 | 408 | typename ToFieldType::NativeType max_result = | 1078 | 408 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1079 | 408 | typename ToFieldType::NativeType min_result = -max_result; | 1080 | | | 1081 | 408 | MaxNativeType multiplier {}; | 1082 | 408 | if (from_scale < to_scale) { | 1083 | 200 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1084 | 200 | from_scale); | 1085 | 208 | } else if (from_scale > to_scale) { | 1086 | 112 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1087 | 112 | to_scale); | 1088 | 112 | } | 1089 | 408 | RETURN_IF_ERROR(std::visit( | 1090 | 408 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1091 | 408 | for (size_t i = 0; i < size; i++) { | 1092 | 408 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1093 | 408 | multiply_may_overflow, narrow_integral>( | 1094 | 408 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1095 | 408 | to_precision, to_scale, min_result, max_result, multiplier, | 1096 | 408 | params)) { | 1097 | 408 | if (set_nullable) { | 1098 | 408 | null_map_data[i] = 1; | 1099 | 408 | } else { | 1100 | 408 | return params.status; | 1101 | 408 | } | 1102 | 408 | } | 1103 | 408 | } | 1104 | 408 | return Status::OK(); | 1105 | 408 | }, | 1106 | 408 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1107 | 408 | if (narrow_integral) { | 1108 | 112 | block.get_by_position(result).column = | 1109 | 112 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1110 | 296 | } else { | 1111 | 296 | block.get_by_position(result).column = std::move(col_to); | 1112 | 296 | } | 1113 | 408 | return Status::OK(); | 1114 | 408 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEENS2_ILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 1017 | 120 | const NullMap::value_type* null_map = nullptr) const override { | 1018 | 120 | using FromFieldType = typename FromDataType::FieldType; | 1019 | 120 | using ToFieldType = typename ToDataType::FieldType; | 1020 | 120 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 1021 | 120 | const auto* col_from = | 1022 | 120 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 1023 | 120 | if (!col_from) { | 1024 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 1025 | 0 | named_from.column->get_name()); | 1026 | 0 | } | 1027 | | | 1028 | 120 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 1029 | 120 | UInt32 from_precision = from_decimal_type.get_precision(); | 1030 | 120 | UInt32 from_scale = from_decimal_type.get_scale(); | 1031 | | | 1032 | 120 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 1033 | 120 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 1034 | 120 | UInt32 to_precision = to_decimal_type.get_precision(); | 1035 | 120 | ToDataType::check_type_precision(to_precision); | 1036 | 120 | UInt32 to_scale = to_decimal_type.get_scale(); | 1037 | 120 | ToDataType::check_type_scale(to_scale); | 1038 | | | 1039 | 120 | auto from_max_int_digit_count = from_precision - from_scale; | 1040 | 120 | auto to_max_int_digit_count = to_precision - to_scale; | 1041 | 120 | bool narrow_integral = | 1042 | 120 | (to_max_int_digit_count < from_max_int_digit_count) || | 1043 | 120 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1044 | | // only in non-strict mode and may overflow, we set nullable | 1045 | 120 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1046 | | | 1047 | 120 | size_t size = col_from->size(); | 1048 | 120 | ColumnUInt8::MutablePtr col_null_map_to; | 1049 | 120 | NullMap::value_type* null_map_data = nullptr; | 1050 | 120 | if (narrow_integral) { | 1051 | 120 | col_null_map_to = ColumnUInt8::create(size, 0); | 1052 | 120 | null_map_data = col_null_map_to->get_data().data(); | 1053 | 120 | } | 1054 | 120 | CastParameters params; | 1055 | 120 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1056 | 120 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1057 | 120 | const auto& vec_from = col_from->get_data(); | 1058 | 120 | const auto* vec_from_data = vec_from.data(); | 1059 | 120 | auto& vec_to = col_to->get_data(); | 1060 | 120 | auto* vec_to_data = vec_to.data(); | 1061 | | | 1062 | 120 | using MaxFieldType = | 1063 | 120 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1064 | 120 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1065 | 120 | std::is_same_v<FromFieldType, Decimal128V3>), | 1066 | 120 | Decimal128V3, | 1067 | 120 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1068 | 120 | FromFieldType, ToFieldType>>; | 1069 | 120 | using MaxNativeType = typename MaxFieldType::NativeType; | 1070 | | | 1071 | 120 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1072 | 120 | bool multiply_may_overflow = false; | 1073 | 120 | if (to_scale > from_scale) { | 1074 | 120 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1075 | 120 | } | 1076 | | | 1077 | 120 | typename ToFieldType::NativeType max_result = | 1078 | 120 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1079 | 120 | typename ToFieldType::NativeType min_result = -max_result; | 1080 | | | 1081 | 120 | MaxNativeType multiplier {}; | 1082 | 120 | if (from_scale < to_scale) { | 1083 | 120 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1084 | 120 | from_scale); | 1085 | 120 | } else if (from_scale > to_scale) { | 1086 | 0 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1087 | 0 | to_scale); | 1088 | 0 | } | 1089 | 120 | RETURN_IF_ERROR(std::visit( | 1090 | 120 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1091 | 120 | for (size_t i = 0; i < size; i++) { | 1092 | 120 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1093 | 120 | multiply_may_overflow, narrow_integral>( | 1094 | 120 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1095 | 120 | to_precision, to_scale, min_result, max_result, multiplier, | 1096 | 120 | params)) { | 1097 | 120 | if (set_nullable) { | 1098 | 120 | null_map_data[i] = 1; | 1099 | 120 | } else { | 1100 | 120 | return params.status; | 1101 | 120 | } | 1102 | 120 | } | 1103 | 120 | } | 1104 | 120 | return Status::OK(); | 1105 | 120 | }, | 1106 | 120 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1107 | 0 | if (narrow_integral) { | 1108 | 0 | block.get_by_position(result).column = | 1109 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1110 | 0 | } else { | 1111 | 0 | block.get_by_position(result).column = std::move(col_to); | 1112 | 0 | } | 1113 | 0 | return Status::OK(); | 1114 | 120 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEENS2_ILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 1017 | 408 | const NullMap::value_type* null_map = nullptr) const override { | 1018 | 408 | using FromFieldType = typename FromDataType::FieldType; | 1019 | 408 | using ToFieldType = typename ToDataType::FieldType; | 1020 | 408 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 1021 | 408 | const auto* col_from = | 1022 | 408 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 1023 | 408 | if (!col_from) { | 1024 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 1025 | 0 | named_from.column->get_name()); | 1026 | 0 | } | 1027 | | | 1028 | 408 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 1029 | 408 | UInt32 from_precision = from_decimal_type.get_precision(); | 1030 | 408 | UInt32 from_scale = from_decimal_type.get_scale(); | 1031 | | | 1032 | 408 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 1033 | 408 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 1034 | 408 | UInt32 to_precision = to_decimal_type.get_precision(); | 1035 | 408 | ToDataType::check_type_precision(to_precision); | 1036 | 408 | UInt32 to_scale = to_decimal_type.get_scale(); | 1037 | 408 | ToDataType::check_type_scale(to_scale); | 1038 | | | 1039 | 408 | auto from_max_int_digit_count = from_precision - from_scale; | 1040 | 408 | auto to_max_int_digit_count = to_precision - to_scale; | 1041 | 408 | bool narrow_integral = | 1042 | 408 | (to_max_int_digit_count < from_max_int_digit_count) || | 1043 | 408 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1044 | | // only in non-strict mode and may overflow, we set nullable | 1045 | 408 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1046 | | | 1047 | 408 | size_t size = col_from->size(); | 1048 | 408 | ColumnUInt8::MutablePtr col_null_map_to; | 1049 | 408 | NullMap::value_type* null_map_data = nullptr; | 1050 | 408 | if (narrow_integral) { | 1051 | 112 | col_null_map_to = ColumnUInt8::create(size, 0); | 1052 | 112 | null_map_data = col_null_map_to->get_data().data(); | 1053 | 112 | } | 1054 | 408 | CastParameters params; | 1055 | 408 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1056 | 408 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1057 | 408 | const auto& vec_from = col_from->get_data(); | 1058 | 408 | const auto* vec_from_data = vec_from.data(); | 1059 | 408 | auto& vec_to = col_to->get_data(); | 1060 | 408 | auto* vec_to_data = vec_to.data(); | 1061 | | | 1062 | 408 | using MaxFieldType = | 1063 | 408 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1064 | 408 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1065 | 408 | std::is_same_v<FromFieldType, Decimal128V3>), | 1066 | 408 | Decimal128V3, | 1067 | 408 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1068 | 408 | FromFieldType, ToFieldType>>; | 1069 | 408 | using MaxNativeType = typename MaxFieldType::NativeType; | 1070 | | | 1071 | 408 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1072 | 408 | bool multiply_may_overflow = false; | 1073 | 408 | if (to_scale > from_scale) { | 1074 | 198 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1075 | 198 | } | 1076 | | | 1077 | 408 | typename ToFieldType::NativeType max_result = | 1078 | 408 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1079 | 408 | typename ToFieldType::NativeType min_result = -max_result; | 1080 | | | 1081 | 408 | MaxNativeType multiplier {}; | 1082 | 408 | if (from_scale < to_scale) { | 1083 | 198 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1084 | 198 | from_scale); | 1085 | 210 | } else if (from_scale > to_scale) { | 1086 | 112 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1087 | 112 | to_scale); | 1088 | 112 | } | 1089 | 408 | RETURN_IF_ERROR(std::visit( | 1090 | 408 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1091 | 408 | for (size_t i = 0; i < size; i++) { | 1092 | 408 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1093 | 408 | multiply_may_overflow, narrow_integral>( | 1094 | 408 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1095 | 408 | to_precision, to_scale, min_result, max_result, multiplier, | 1096 | 408 | params)) { | 1097 | 408 | if (set_nullable) { | 1098 | 408 | null_map_data[i] = 1; | 1099 | 408 | } else { | 1100 | 408 | return params.status; | 1101 | 408 | } | 1102 | 408 | } | 1103 | 408 | } | 1104 | 408 | return Status::OK(); | 1105 | 408 | }, | 1106 | 408 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1107 | 408 | if (narrow_integral) { | 1108 | 112 | block.get_by_position(result).column = | 1109 | 112 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1110 | 296 | } else { | 1111 | 296 | block.get_by_position(result).column = std::move(col_to); | 1112 | 296 | } | 1113 | 408 | return Status::OK(); | 1114 | 408 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEES4_E12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 1017 | 184 | const NullMap::value_type* null_map = nullptr) const override { | 1018 | 184 | using FromFieldType = typename FromDataType::FieldType; | 1019 | 184 | using ToFieldType = typename ToDataType::FieldType; | 1020 | 184 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 1021 | 184 | const auto* col_from = | 1022 | 184 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 1023 | 184 | if (!col_from) { | 1024 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 1025 | 0 | named_from.column->get_name()); | 1026 | 0 | } | 1027 | | | 1028 | 184 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 1029 | 184 | UInt32 from_precision = from_decimal_type.get_precision(); | 1030 | 184 | UInt32 from_scale = from_decimal_type.get_scale(); | 1031 | | | 1032 | 184 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 1033 | 184 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 1034 | 184 | UInt32 to_precision = to_decimal_type.get_precision(); | 1035 | 184 | ToDataType::check_type_precision(to_precision); | 1036 | 184 | UInt32 to_scale = to_decimal_type.get_scale(); | 1037 | 184 | ToDataType::check_type_scale(to_scale); | 1038 | | | 1039 | 184 | auto from_max_int_digit_count = from_precision - from_scale; | 1040 | 184 | auto to_max_int_digit_count = to_precision - to_scale; | 1041 | 184 | bool narrow_integral = | 1042 | 184 | (to_max_int_digit_count < from_max_int_digit_count) || | 1043 | 184 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1044 | | // only in non-strict mode and may overflow, we set nullable | 1045 | 184 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1046 | | | 1047 | 184 | size_t size = col_from->size(); | 1048 | 184 | ColumnUInt8::MutablePtr col_null_map_to; | 1049 | 184 | NullMap::value_type* null_map_data = nullptr; | 1050 | 184 | if (narrow_integral) { | 1051 | 184 | col_null_map_to = ColumnUInt8::create(size, 0); | 1052 | 184 | null_map_data = col_null_map_to->get_data().data(); | 1053 | 184 | } | 1054 | 184 | CastParameters params; | 1055 | 184 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1056 | 184 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1057 | 184 | const auto& vec_from = col_from->get_data(); | 1058 | 184 | const auto* vec_from_data = vec_from.data(); | 1059 | 184 | auto& vec_to = col_to->get_data(); | 1060 | 184 | auto* vec_to_data = vec_to.data(); | 1061 | | | 1062 | 184 | using MaxFieldType = | 1063 | 184 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1064 | 184 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1065 | 184 | std::is_same_v<FromFieldType, Decimal128V3>), | 1066 | 184 | Decimal128V3, | 1067 | 184 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1068 | 184 | FromFieldType, ToFieldType>>; | 1069 | 184 | using MaxNativeType = typename MaxFieldType::NativeType; | 1070 | | | 1071 | 184 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1072 | 184 | bool multiply_may_overflow = false; | 1073 | 184 | if (to_scale > from_scale) { | 1074 | 132 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1075 | 132 | } | 1076 | | | 1077 | 184 | typename ToFieldType::NativeType max_result = | 1078 | 184 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1079 | 184 | typename ToFieldType::NativeType min_result = -max_result; | 1080 | | | 1081 | 184 | MaxNativeType multiplier {}; | 1082 | 184 | if (from_scale < to_scale) { | 1083 | 132 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1084 | 132 | from_scale); | 1085 | 132 | } else if (from_scale > to_scale) { | 1086 | 40 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1087 | 40 | to_scale); | 1088 | 40 | } | 1089 | 184 | RETURN_IF_ERROR(std::visit( | 1090 | 184 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1091 | 184 | for (size_t i = 0; i < size; i++) { | 1092 | 184 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1093 | 184 | multiply_may_overflow, narrow_integral>( | 1094 | 184 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1095 | 184 | to_precision, to_scale, min_result, max_result, multiplier, | 1096 | 184 | params)) { | 1097 | 184 | if (set_nullable) { | 1098 | 184 | null_map_data[i] = 1; | 1099 | 184 | } else { | 1100 | 184 | return params.status; | 1101 | 184 | } | 1102 | 184 | } | 1103 | 184 | } | 1104 | 184 | return Status::OK(); | 1105 | 184 | }, | 1106 | 184 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1107 | 0 | if (narrow_integral) { | 1108 | 0 | block.get_by_position(result).column = | 1109 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1110 | 0 | } else { | 1111 | 0 | block.get_by_position(result).column = std::move(col_to); | 1112 | 0 | } | 1113 | 0 | return Status::OK(); | 1114 | 184 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEES4_E12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 1017 | 360 | const NullMap::value_type* null_map = nullptr) const override { | 1018 | 360 | using FromFieldType = typename FromDataType::FieldType; | 1019 | 360 | using ToFieldType = typename ToDataType::FieldType; | 1020 | 360 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 1021 | 360 | const auto* col_from = | 1022 | 360 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 1023 | 360 | if (!col_from) { | 1024 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 1025 | 0 | named_from.column->get_name()); | 1026 | 0 | } | 1027 | | | 1028 | 360 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 1029 | 360 | UInt32 from_precision = from_decimal_type.get_precision(); | 1030 | 360 | UInt32 from_scale = from_decimal_type.get_scale(); | 1031 | | | 1032 | 360 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 1033 | 360 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 1034 | 360 | UInt32 to_precision = to_decimal_type.get_precision(); | 1035 | 360 | ToDataType::check_type_precision(to_precision); | 1036 | 360 | UInt32 to_scale = to_decimal_type.get_scale(); | 1037 | 360 | ToDataType::check_type_scale(to_scale); | 1038 | | | 1039 | 360 | auto from_max_int_digit_count = from_precision - from_scale; | 1040 | 360 | auto to_max_int_digit_count = to_precision - to_scale; | 1041 | 360 | bool narrow_integral = | 1042 | 360 | (to_max_int_digit_count < from_max_int_digit_count) || | 1043 | 360 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1044 | | // only in non-strict mode and may overflow, we set nullable | 1045 | 360 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1046 | | | 1047 | 360 | size_t size = col_from->size(); | 1048 | 360 | ColumnUInt8::MutablePtr col_null_map_to; | 1049 | 360 | NullMap::value_type* null_map_data = nullptr; | 1050 | 360 | if (narrow_integral) { | 1051 | 208 | col_null_map_to = ColumnUInt8::create(size, 0); | 1052 | 208 | null_map_data = col_null_map_to->get_data().data(); | 1053 | 208 | } | 1054 | 360 | CastParameters params; | 1055 | 360 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1056 | 360 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1057 | 360 | const auto& vec_from = col_from->get_data(); | 1058 | 360 | const auto* vec_from_data = vec_from.data(); | 1059 | 360 | auto& vec_to = col_to->get_data(); | 1060 | 360 | auto* vec_to_data = vec_to.data(); | 1061 | | | 1062 | 360 | using MaxFieldType = | 1063 | 360 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1064 | 360 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1065 | 360 | std::is_same_v<FromFieldType, Decimal128V3>), | 1066 | 360 | Decimal128V3, | 1067 | 360 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1068 | 360 | FromFieldType, ToFieldType>>; | 1069 | 360 | using MaxNativeType = typename MaxFieldType::NativeType; | 1070 | | | 1071 | 360 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1072 | 360 | bool multiply_may_overflow = false; | 1073 | 360 | if (to_scale > from_scale) { | 1074 | 172 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1075 | 172 | } | 1076 | | | 1077 | 360 | typename ToFieldType::NativeType max_result = | 1078 | 360 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1079 | 360 | typename ToFieldType::NativeType min_result = -max_result; | 1080 | | | 1081 | 360 | MaxNativeType multiplier {}; | 1082 | 360 | if (from_scale < to_scale) { | 1083 | 172 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1084 | 172 | from_scale); | 1085 | 188 | } else if (from_scale > to_scale) { | 1086 | 136 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1087 | 136 | to_scale); | 1088 | 136 | } | 1089 | 360 | RETURN_IF_ERROR(std::visit( | 1090 | 360 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1091 | 360 | for (size_t i = 0; i < size; i++) { | 1092 | 360 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1093 | 360 | multiply_may_overflow, narrow_integral>( | 1094 | 360 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1095 | 360 | to_precision, to_scale, min_result, max_result, multiplier, | 1096 | 360 | params)) { | 1097 | 360 | if (set_nullable) { | 1098 | 360 | null_map_data[i] = 1; | 1099 | 360 | } else { | 1100 | 360 | return params.status; | 1101 | 360 | } | 1102 | 360 | } | 1103 | 360 | } | 1104 | 360 | return Status::OK(); | 1105 | 360 | }, | 1106 | 360 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1107 | 360 | if (narrow_integral) { | 1108 | 208 | block.get_by_position(result).column = | 1109 | 208 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1110 | 208 | } else { | 1111 | 152 | block.get_by_position(result).column = std::move(col_to); | 1112 | 152 | } | 1113 | 360 | return Status::OK(); | 1114 | 360 | } |
|
1115 | | }; |
1116 | | } // namespace doris |