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 | 2.14k | Status(ErrorCode::ARITHMETIC_OVERFLOW_ERRROR, \ |
33 | 2.14k | fmt::format( \ |
34 | 2.14k | "Arithmetic overflow when converting value {} from type {} to decimal({}, {})", \ |
35 | 2.14k | 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 | 110k | UInt32 scale, CastParameters& params) { |
42 | 110k | if constexpr (IsDecimalV2<ToCppT>) { |
43 | 14 | StringParser::ParseResult result = StringParser::PARSE_SUCCESS; |
44 | 14 | to = DecimalV2Value(StringParser::string_to_decimal<TYPE_DECIMALV2>( |
45 | 14 | from.data, (int)from.size, DecimalV2Value::PRECISION, DecimalV2Value::SCALE, |
46 | 14 | &result)); |
47 | 14 | return result == StringParser::PARSE_SUCCESS; |
48 | 14 | } |
49 | | |
50 | 29.7k | if constexpr (IsDecimal32<ToCppT>) { |
51 | 29.7k | StringParser::ParseResult result = StringParser::PARSE_SUCCESS; |
52 | 29.7k | to.value = StringParser::string_to_decimal<TYPE_DECIMAL32>(from.data, (int)from.size, |
53 | 29.7k | precision, scale, &result); |
54 | 29.7k | return result == StringParser::PARSE_SUCCESS; |
55 | 29.7k | } |
56 | | |
57 | 26.9k | if constexpr (IsDecimal64<ToCppT>) { |
58 | 26.9k | StringParser::ParseResult result = StringParser::PARSE_SUCCESS; |
59 | 26.9k | to.value = StringParser::string_to_decimal<TYPE_DECIMAL64>(from.data, (int)from.size, |
60 | 26.9k | precision, scale, &result); |
61 | 26.9k | return result == StringParser::PARSE_SUCCESS; |
62 | 26.9k | } |
63 | | |
64 | 26.9k | if constexpr (IsDecimal128V3<ToCppT>) { |
65 | 26.9k | StringParser::ParseResult result = StringParser::PARSE_SUCCESS; |
66 | 26.9k | to.value = StringParser::string_to_decimal<TYPE_DECIMAL128I>(from.data, (int)from.size, |
67 | 26.9k | precision, scale, &result); |
68 | 26.9k | return result == StringParser::PARSE_SUCCESS; |
69 | 26.9k | } |
70 | | |
71 | 26.8k | if constexpr (IsDecimal256<ToCppT>) { |
72 | 26.8k | StringParser::ParseResult result = StringParser::PARSE_SUCCESS; |
73 | 26.8k | to.value = StringParser::string_to_decimal<TYPE_DECIMAL256>(from.data, (int)from.size, |
74 | 26.8k | precision, scale, &result); |
75 | 26.8k | return result == StringParser::PARSE_SUCCESS; |
76 | 26.8k | } |
77 | 110k | } _ZN5doris13CastToDecimal11from_stringINS_7DecimalIiEEQ15IsDecimalNumberIT_EEEbRKNS_9StringRefERS4_jjRNS_14CastParametersE Line | Count | Source | 41 | 29.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 | 29.7k | if constexpr (IsDecimal32<ToCppT>) { | 51 | 29.7k | StringParser::ParseResult result = StringParser::PARSE_SUCCESS; | 52 | 29.7k | to.value = StringParser::string_to_decimal<TYPE_DECIMAL32>(from.data, (int)from.size, | 53 | 29.7k | precision, scale, &result); | 54 | 29.7k | return result == StringParser::PARSE_SUCCESS; | 55 | 29.7k | } | 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 | 29.7k | } |
_ZN5doris13CastToDecimal11from_stringINS_7DecimalIlEEQ15IsDecimalNumberIT_EEEbRKNS_9StringRefERS4_jjRNS_14CastParametersE Line | Count | Source | 41 | 26.9k | 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 | 26.9k | if constexpr (IsDecimal64<ToCppT>) { | 58 | 26.9k | StringParser::ParseResult result = StringParser::PARSE_SUCCESS; | 59 | 26.9k | to.value = StringParser::string_to_decimal<TYPE_DECIMAL64>(from.data, (int)from.size, | 60 | 26.9k | precision, scale, &result); | 61 | 26.9k | return result == StringParser::PARSE_SUCCESS; | 62 | 26.9k | } | 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 | 26.9k | } |
_ZN5doris13CastToDecimal11from_stringINS_12Decimal128V3EQ15IsDecimalNumberIT_EEEbRKNS_9StringRefERS3_jjRNS_14CastParametersE Line | Count | Source | 41 | 26.9k | 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 | 26.9k | if constexpr (IsDecimal128V3<ToCppT>) { | 65 | 26.9k | StringParser::ParseResult result = StringParser::PARSE_SUCCESS; | 66 | 26.9k | to.value = StringParser::string_to_decimal<TYPE_DECIMAL128I>(from.data, (int)from.size, | 67 | 26.9k | precision, scale, &result); | 68 | 26.9k | return result == StringParser::PARSE_SUCCESS; | 69 | 26.9k | } | 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 | 26.9k | } |
_ZN5doris13CastToDecimal11from_stringINS_14DecimalV2ValueEQ15IsDecimalNumberIT_EEEbRKNS_9StringRefERS3_jjRNS_14CastParametersE Line | Count | Source | 41 | 14 | UInt32 scale, CastParameters& params) { | 42 | 14 | if constexpr (IsDecimalV2<ToCppT>) { | 43 | 14 | StringParser::ParseResult result = StringParser::PARSE_SUCCESS; | 44 | 14 | to = DecimalV2Value(StringParser::string_to_decimal<TYPE_DECIMALV2>( | 45 | 14 | from.data, (int)from.size, DecimalV2Value::PRECISION, DecimalV2Value::SCALE, | 46 | 14 | &result)); | 47 | 14 | return result == StringParser::PARSE_SUCCESS; | 48 | 14 | } | 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 | 14 | } |
_ZN5doris13CastToDecimal11from_stringINS_7DecimalIN4wide7integerILm256EiEEEEQ15IsDecimalNumberIT_EEEbRKNS_9StringRefERS7_jjRNS_14CastParametersE Line | Count | Source | 41 | 26.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 | | 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 | 26.8k | if constexpr (IsDecimal256<ToCppT>) { | 72 | 26.8k | StringParser::ParseResult result = StringParser::PARSE_SUCCESS; | 73 | 26.8k | to.value = StringParser::string_to_decimal<TYPE_DECIMAL256>(from.data, (int)from.size, | 74 | 26.8k | precision, scale, &result); | 75 | 26.8k | return result == StringParser::PARSE_SUCCESS; | 76 | 26.8k | } | 77 | 26.8k | } |
|
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 | 7 | UInt32 to_scale, CastParameters& params) { |
88 | 7 | MaxNativeType scale_multiplier = |
89 | 7 | DataTypeDecimal<ToCppT::PType>::get_scale_multiplier(to_scale); |
90 | 7 | typename ToCppT::NativeType max_result = |
91 | 7 | DataTypeDecimal<ToCppT::PType>::get_max_digits_number(to_precision); |
92 | 7 | typename ToCppT::NativeType min_result = -max_result; |
93 | | |
94 | 7 | UInt32 from_precision = NumberTraits::max_ascii_len<FromCppT>(); |
95 | 7 | constexpr UInt32 from_scale = 0; |
96 | 7 | constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToCppT::NativeType>(); |
97 | | |
98 | 7 | auto from_max_int_digit_count = from_precision - from_scale; |
99 | 7 | auto to_max_int_digit_count = to_precision - to_scale; |
100 | 7 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); |
101 | 7 | bool multiply_may_overflow = false; |
102 | 7 | if (to_scale > from_scale) { |
103 | 7 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; |
104 | 7 | } |
105 | 7 | return std::visit( |
106 | 7 | [&](auto multiply_may_overflow, auto narrow_integral) { |
107 | 7 | return _from_int<FromCppT, ToCppT, multiply_may_overflow, narrow_integral>( |
108 | 7 | from, to, to_precision, to_scale, scale_multiplier, min_result, |
109 | 7 | max_result, params); |
110 | 7 | }, _ZZN5doris13CastToDecimal8from_intIhNS_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_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 | 1 | [&](auto multiply_may_overflow, auto narrow_integral) { | 107 | 1 | return _from_int<FromCppT, ToCppT, multiply_may_overflow, narrow_integral>( | 108 | 1 | from, to, to_precision, to_scale, scale_multiplier, min_result, | 109 | 1 | max_result, params); | 110 | 1 | }, |
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 | 1 | [&](auto multiply_may_overflow, auto narrow_integral) { | 107 | 1 | return _from_int<FromCppT, ToCppT, multiply_may_overflow, narrow_integral>( | 108 | 1 | from, to, to_precision, to_scale, scale_multiplier, min_result, | 109 | 1 | max_result, params); | 110 | 1 | }, |
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 | 1 | [&](auto multiply_may_overflow, auto narrow_integral) { | 107 | 1 | return _from_int<FromCppT, ToCppT, multiply_may_overflow, narrow_integral>( | 108 | 1 | from, to, to_precision, to_scale, scale_multiplier, min_result, | 109 | 1 | max_result, params); | 110 | 1 | }, |
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 | 1 | [&](auto multiply_may_overflow, auto narrow_integral) { | 107 | 1 | return _from_int<FromCppT, ToCppT, multiply_may_overflow, narrow_integral>( | 108 | 1 | from, to, to_precision, to_scale, scale_multiplier, min_result, | 109 | 1 | max_result, params); | 110 | 1 | }, |
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 | 1 | [&](auto multiply_may_overflow, auto narrow_integral) { | 107 | 1 | return _from_int<FromCppT, ToCppT, multiply_may_overflow, narrow_integral>( | 108 | 1 | from, to, to_precision, to_scale, scale_multiplier, min_result, | 109 | 1 | max_result, params); | 110 | 1 | }, |
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 | 7 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral)); |
112 | 7 | } _ZN5doris13CastToDecimal8from_intIhNS_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_intIaNS_7DecimalIiEEiQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRNS_14CastParametersE Line | Count | Source | 87 | 1 | UInt32 to_scale, CastParameters& params) { | 88 | 1 | MaxNativeType scale_multiplier = | 89 | 1 | DataTypeDecimal<ToCppT::PType>::get_scale_multiplier(to_scale); | 90 | 1 | typename ToCppT::NativeType max_result = | 91 | 1 | DataTypeDecimal<ToCppT::PType>::get_max_digits_number(to_precision); | 92 | 1 | typename ToCppT::NativeType min_result = -max_result; | 93 | | | 94 | 1 | UInt32 from_precision = NumberTraits::max_ascii_len<FromCppT>(); | 95 | 1 | constexpr UInt32 from_scale = 0; | 96 | 1 | constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToCppT::NativeType>(); | 97 | | | 98 | 1 | auto from_max_int_digit_count = from_precision - from_scale; | 99 | 1 | auto to_max_int_digit_count = to_precision - to_scale; | 100 | 1 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 101 | 1 | bool multiply_may_overflow = false; | 102 | 1 | if (to_scale > from_scale) { | 103 | 1 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 104 | 1 | } | 105 | 1 | return std::visit( | 106 | 1 | [&](auto multiply_may_overflow, auto narrow_integral) { | 107 | 1 | return _from_int<FromCppT, ToCppT, multiply_may_overflow, narrow_integral>( | 108 | 1 | from, to, to_precision, to_scale, scale_multiplier, min_result, | 109 | 1 | max_result, params); | 110 | 1 | }, | 111 | 1 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral)); | 112 | 1 | } |
_ZN5doris13CastToDecimal8from_intIsNS_7DecimalIiEEiQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRNS_14CastParametersE Line | Count | Source | 87 | 1 | UInt32 to_scale, CastParameters& params) { | 88 | 1 | MaxNativeType scale_multiplier = | 89 | 1 | DataTypeDecimal<ToCppT::PType>::get_scale_multiplier(to_scale); | 90 | 1 | typename ToCppT::NativeType max_result = | 91 | 1 | DataTypeDecimal<ToCppT::PType>::get_max_digits_number(to_precision); | 92 | 1 | typename ToCppT::NativeType min_result = -max_result; | 93 | | | 94 | 1 | UInt32 from_precision = NumberTraits::max_ascii_len<FromCppT>(); | 95 | 1 | constexpr UInt32 from_scale = 0; | 96 | 1 | constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToCppT::NativeType>(); | 97 | | | 98 | 1 | auto from_max_int_digit_count = from_precision - from_scale; | 99 | 1 | auto to_max_int_digit_count = to_precision - to_scale; | 100 | 1 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 101 | 1 | bool multiply_may_overflow = false; | 102 | 1 | if (to_scale > from_scale) { | 103 | 1 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 104 | 1 | } | 105 | 1 | return std::visit( | 106 | 1 | [&](auto multiply_may_overflow, auto narrow_integral) { | 107 | 1 | return _from_int<FromCppT, ToCppT, multiply_may_overflow, narrow_integral>( | 108 | 1 | from, to, to_precision, to_scale, scale_multiplier, min_result, | 109 | 1 | max_result, params); | 110 | 1 | }, | 111 | 1 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral)); | 112 | 1 | } |
_ZN5doris13CastToDecimal8from_intIiNS_7DecimalIiEEiQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRNS_14CastParametersE Line | Count | Source | 87 | 1 | UInt32 to_scale, CastParameters& params) { | 88 | 1 | MaxNativeType scale_multiplier = | 89 | 1 | DataTypeDecimal<ToCppT::PType>::get_scale_multiplier(to_scale); | 90 | 1 | typename ToCppT::NativeType max_result = | 91 | 1 | DataTypeDecimal<ToCppT::PType>::get_max_digits_number(to_precision); | 92 | 1 | typename ToCppT::NativeType min_result = -max_result; | 93 | | | 94 | 1 | UInt32 from_precision = NumberTraits::max_ascii_len<FromCppT>(); | 95 | 1 | constexpr UInt32 from_scale = 0; | 96 | 1 | constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToCppT::NativeType>(); | 97 | | | 98 | 1 | auto from_max_int_digit_count = from_precision - from_scale; | 99 | 1 | auto to_max_int_digit_count = to_precision - to_scale; | 100 | 1 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 101 | 1 | bool multiply_may_overflow = false; | 102 | 1 | if (to_scale > from_scale) { | 103 | 1 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 104 | 1 | } | 105 | 1 | return std::visit( | 106 | 1 | [&](auto multiply_may_overflow, auto narrow_integral) { | 107 | 1 | return _from_int<FromCppT, ToCppT, multiply_may_overflow, narrow_integral>( | 108 | 1 | from, to, to_precision, to_scale, scale_multiplier, min_result, | 109 | 1 | max_result, params); | 110 | 1 | }, | 111 | 1 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral)); | 112 | 1 | } |
_ZN5doris13CastToDecimal8from_intIlNS_7DecimalIiEElQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRNS_14CastParametersE Line | Count | Source | 87 | 1 | UInt32 to_scale, CastParameters& params) { | 88 | 1 | MaxNativeType scale_multiplier = | 89 | 1 | DataTypeDecimal<ToCppT::PType>::get_scale_multiplier(to_scale); | 90 | 1 | typename ToCppT::NativeType max_result = | 91 | 1 | DataTypeDecimal<ToCppT::PType>::get_max_digits_number(to_precision); | 92 | 1 | typename ToCppT::NativeType min_result = -max_result; | 93 | | | 94 | 1 | UInt32 from_precision = NumberTraits::max_ascii_len<FromCppT>(); | 95 | 1 | constexpr UInt32 from_scale = 0; | 96 | 1 | constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToCppT::NativeType>(); | 97 | | | 98 | 1 | auto from_max_int_digit_count = from_precision - from_scale; | 99 | 1 | auto to_max_int_digit_count = to_precision - to_scale; | 100 | 1 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 101 | 1 | bool multiply_may_overflow = false; | 102 | 1 | if (to_scale > from_scale) { | 103 | 1 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 104 | 1 | } | 105 | 1 | return std::visit( | 106 | 1 | [&](auto multiply_may_overflow, auto narrow_integral) { | 107 | 1 | return _from_int<FromCppT, ToCppT, multiply_may_overflow, narrow_integral>( | 108 | 1 | from, to, to_precision, to_scale, scale_multiplier, min_result, | 109 | 1 | max_result, params); | 110 | 1 | }, | 111 | 1 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral)); | 112 | 1 | } |
_ZN5doris13CastToDecimal8from_intInNS_7DecimalIiEEnQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRNS_14CastParametersE Line | Count | Source | 87 | 1 | UInt32 to_scale, CastParameters& params) { | 88 | 1 | MaxNativeType scale_multiplier = | 89 | 1 | DataTypeDecimal<ToCppT::PType>::get_scale_multiplier(to_scale); | 90 | 1 | typename ToCppT::NativeType max_result = | 91 | 1 | DataTypeDecimal<ToCppT::PType>::get_max_digits_number(to_precision); | 92 | 1 | typename ToCppT::NativeType min_result = -max_result; | 93 | | | 94 | 1 | UInt32 from_precision = NumberTraits::max_ascii_len<FromCppT>(); | 95 | 1 | constexpr UInt32 from_scale = 0; | 96 | 1 | constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToCppT::NativeType>(); | 97 | | | 98 | 1 | auto from_max_int_digit_count = from_precision - from_scale; | 99 | 1 | auto to_max_int_digit_count = to_precision - to_scale; | 100 | 1 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 101 | 1 | bool multiply_may_overflow = false; | 102 | 1 | if (to_scale > from_scale) { | 103 | 1 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 104 | 1 | } | 105 | 1 | return std::visit( | 106 | 1 | [&](auto multiply_may_overflow, auto narrow_integral) { | 107 | 1 | return _from_int<FromCppT, ToCppT, multiply_may_overflow, narrow_integral>( | 108 | 1 | from, to, to_precision, to_scale, scale_multiplier, min_result, | 109 | 1 | max_result, params); | 110 | 1 | }, | 111 | 1 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral)); | 112 | 1 | } |
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 | 2 | UInt32 to_scale, CastParameters& params) { |
122 | 2 | return from_int<FromCppT, ToCppT, MaxNativeType>(from, to, to_precision, to_scale, params); |
123 | 2 | } _ZN5doris13CastToDecimal9from_boolIhNS_7DecimalIiEEiQaa15IsDecimalNumberIT0_Esr3stdE9is_same_vIT_hEEEbRKS5_RS4_jjRNS_14CastParametersE Line | Count | Source | 121 | 2 | UInt32 to_scale, CastParameters& params) { | 122 | 2 | return from_int<FromCppT, ToCppT, MaxNativeType>(from, to, to_precision, to_scale, params); | 123 | 2 | } |
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 | 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_floatIdNS_7DecimalIiEEQaa15IsDecimalNumberIT0_E14IsCppTypeFloatIT_EEEbRKS5_RS4_jjRNS_14CastParametersE Line | Count | Source | 128 | 1 | UInt32 to_scale, CastParameters& params) { | 129 | 1 | typename ToCppT::NativeType scale_multiplier = | 130 | 1 | DataTypeDecimal<ToCppT::PType>::get_scale_multiplier(to_scale); | 131 | 1 | typename ToCppT::NativeType max_result = | 132 | 1 | DataTypeDecimal<ToCppT::PType>::get_max_digits_number(to_precision); | 133 | 1 | typename ToCppT::NativeType min_result = -max_result; | 134 | | | 135 | 1 | return _from_float(from, to, to_precision, to_scale, scale_multiplier, min_result, | 136 | 1 | max_result, params); | 137 | 1 | } |
_ZN5doris13CastToDecimal10from_floatIfNS_7DecimalIiEEQaa15IsDecimalNumberIT0_E14IsCppTypeFloatIT_EEEbRKS5_RS4_jjRNS_14CastParametersE Line | Count | Source | 128 | 1 | UInt32 to_scale, CastParameters& params) { | 129 | 1 | typename ToCppT::NativeType scale_multiplier = | 130 | 1 | DataTypeDecimal<ToCppT::PType>::get_scale_multiplier(to_scale); | 131 | 1 | typename ToCppT::NativeType max_result = | 132 | 1 | DataTypeDecimal<ToCppT::PType>::get_max_digits_number(to_precision); | 133 | 1 | typename ToCppT::NativeType min_result = -max_result; | 134 | | | 135 | 1 | return _from_float(from, to, to_precision, to_scale, scale_multiplier, min_result, | 136 | 1 | max_result, params); | 137 | 1 | } |
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 | 5 | UInt32 to_scale, CastParameters& params) { |
150 | 5 | return _from_decimalv3<FromCppT, ToCppT, MaxFieldType>(from, from_precision, from_scale, to, |
151 | 5 | to_precision, to_scale, params); |
152 | 5 | } _ZN5doris13CastToDecimal12from_decimalINS_7DecimalIiEES3_S3_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRNS_14CastParametersE Line | Count | Source | 149 | 1 | UInt32 to_scale, CastParameters& params) { | 150 | 1 | return _from_decimalv3<FromCppT, ToCppT, MaxFieldType>(from, from_precision, from_scale, to, | 151 | 1 | to_precision, to_scale, params); | 152 | 1 | } |
_ZN5doris13CastToDecimal12from_decimalINS_7DecimalIlEENS2_IiEES3_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRNS_14CastParametersE Line | Count | Source | 149 | 1 | UInt32 to_scale, CastParameters& params) { | 150 | 1 | return _from_decimalv3<FromCppT, ToCppT, MaxFieldType>(from, from_precision, from_scale, to, | 151 | 1 | to_precision, to_scale, params); | 152 | 1 | } |
_ZN5doris13CastToDecimal12from_decimalINS_12Decimal128V3ENS_7DecimalIiEES2_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRNS_14CastParametersE Line | Count | Source | 149 | 1 | UInt32 to_scale, CastParameters& params) { | 150 | 1 | return _from_decimalv3<FromCppT, ToCppT, MaxFieldType>(from, from_precision, from_scale, to, | 151 | 1 | to_precision, to_scale, params); | 152 | 1 | } |
_ZN5doris13CastToDecimal12from_decimalINS_7DecimalIN4wide7integerILm256EiEEEENS2_IiEES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRNS_14CastParametersE Line | Count | Source | 149 | 1 | UInt32 to_scale, CastParameters& params) { | 150 | 1 | return _from_decimalv3<FromCppT, ToCppT, MaxFieldType>(from, from_precision, from_scale, to, | 151 | 1 | to_precision, to_scale, params); | 152 | 1 | } |
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 | 1 | UInt32 to_scale, CastParameters& params) { | 150 | 1 | return _from_decimalv3<FromCppT, ToCppT, MaxFieldType>(from, from_precision, from_scale, to, | 151 | 1 | to_precision, to_scale, params); | 152 | 1 | } |
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 | 5 | UInt32 to_scale, CastParameters& params) { |
165 | 5 | using MaxNativeType = typename MaxFieldType::NativeType; |
166 | | |
167 | 5 | auto from_max_int_digit_count = from_precision - from_scale; |
168 | 5 | auto to_max_int_digit_count = to_precision - to_scale; |
169 | 5 | bool narrow_integral = |
170 | 5 | (to_max_int_digit_count < from_max_int_digit_count) || |
171 | 5 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); |
172 | | |
173 | 5 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToCppT::NativeType>(); |
174 | 5 | bool multiply_may_overflow = false; |
175 | 5 | if (to_scale > from_scale) { |
176 | 0 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; |
177 | 0 | } |
178 | | |
179 | 5 | typename ToCppT::NativeType max_result = |
180 | 5 | DataTypeDecimal<ToCppT::PType>::get_max_digits_number(to_precision); |
181 | 5 | typename ToCppT::NativeType min_result = -max_result; |
182 | | |
183 | 5 | MaxNativeType multiplier {}; |
184 | 5 | if (from_scale < to_scale) { |
185 | 0 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - |
186 | 0 | from_scale); |
187 | 5 | } else if (from_scale > to_scale) { |
188 | 3 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - |
189 | 3 | to_scale); |
190 | 3 | } |
191 | | |
192 | 5 | return std::visit( |
193 | 5 | [&](auto multiply_may_overflow, auto narrow_integral) { |
194 | 5 | return _from_decimal<FromCppT, ToCppT, multiply_may_overflow, narrow_integral>( |
195 | 5 | from, from_precision, from_scale, to, to_precision, to_scale, |
196 | 5 | min_result, max_result, multiplier, params); |
197 | 5 | }, _ZZN5doris13CastToDecimal15_from_decimalv3INS_7DecimalIiEES3_S3_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRNS_14CastParametersEENKUlS5_S4_E_clISt17integral_constantIbLb0EESE_EEDaS5_S4_ Line | Count | Source | 193 | 1 | [&](auto multiply_may_overflow, auto narrow_integral) { | 194 | 1 | return _from_decimal<FromCppT, ToCppT, multiply_may_overflow, narrow_integral>( | 195 | 1 | from, from_precision, from_scale, to, to_precision, to_scale, | 196 | 1 | min_result, max_result, multiplier, params); | 197 | 1 | }, |
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 | 1 | [&](auto multiply_may_overflow, auto narrow_integral) { | 194 | 1 | return _from_decimal<FromCppT, ToCppT, multiply_may_overflow, narrow_integral>( | 195 | 1 | from, from_precision, from_scale, to, to_precision, to_scale, | 196 | 1 | min_result, max_result, multiplier, params); | 197 | 1 | }, |
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 | 1 | [&](auto multiply_may_overflow, auto narrow_integral) { | 194 | 1 | return _from_decimal<FromCppT, ToCppT, multiply_may_overflow, narrow_integral>( | 195 | 1 | from, from_precision, from_scale, to, to_precision, to_scale, | 196 | 1 | min_result, max_result, multiplier, params); | 197 | 1 | }, |
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 | 1 | [&](auto multiply_may_overflow, auto narrow_integral) { | 194 | 1 | return _from_decimal<FromCppT, ToCppT, multiply_may_overflow, narrow_integral>( | 195 | 1 | from, from_precision, from_scale, to, to_precision, to_scale, | 196 | 1 | min_result, max_result, multiplier, params); | 197 | 1 | }, |
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 | 1 | [&](auto multiply_may_overflow, auto narrow_integral) { | 194 | 1 | return _from_decimal<FromCppT, ToCppT, multiply_may_overflow, narrow_integral>( | 195 | 1 | from, from_precision, from_scale, to, to_precision, to_scale, | 196 | 1 | min_result, max_result, multiplier, params); | 197 | 1 | }, |
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 | 5 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral)); |
199 | 5 | } _ZN5doris13CastToDecimal15_from_decimalv3INS_7DecimalIiEES3_S3_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRNS_14CastParametersE Line | Count | Source | 164 | 1 | UInt32 to_scale, CastParameters& params) { | 165 | 1 | using MaxNativeType = typename MaxFieldType::NativeType; | 166 | | | 167 | 1 | auto from_max_int_digit_count = from_precision - from_scale; | 168 | 1 | auto to_max_int_digit_count = to_precision - to_scale; | 169 | 1 | bool narrow_integral = | 170 | 1 | (to_max_int_digit_count < from_max_int_digit_count) || | 171 | 1 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 172 | | | 173 | 1 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToCppT::NativeType>(); | 174 | 1 | bool multiply_may_overflow = false; | 175 | 1 | if (to_scale > from_scale) { | 176 | 0 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 177 | 0 | } | 178 | | | 179 | 1 | typename ToCppT::NativeType max_result = | 180 | 1 | DataTypeDecimal<ToCppT::PType>::get_max_digits_number(to_precision); | 181 | 1 | typename ToCppT::NativeType min_result = -max_result; | 182 | | | 183 | 1 | MaxNativeType multiplier {}; | 184 | 1 | if (from_scale < to_scale) { | 185 | 0 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 186 | 0 | from_scale); | 187 | 1 | } 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 | 1 | return std::visit( | 193 | 1 | [&](auto multiply_may_overflow, auto narrow_integral) { | 194 | 1 | return _from_decimal<FromCppT, ToCppT, multiply_may_overflow, narrow_integral>( | 195 | 1 | from, from_precision, from_scale, to, to_precision, to_scale, | 196 | 1 | min_result, max_result, multiplier, params); | 197 | 1 | }, | 198 | 1 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral)); | 199 | 1 | } |
_ZN5doris13CastToDecimal15_from_decimalv3INS_7DecimalIlEENS2_IiEES3_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRNS_14CastParametersE Line | Count | Source | 164 | 1 | UInt32 to_scale, CastParameters& params) { | 165 | 1 | using MaxNativeType = typename MaxFieldType::NativeType; | 166 | | | 167 | 1 | auto from_max_int_digit_count = from_precision - from_scale; | 168 | 1 | auto to_max_int_digit_count = to_precision - to_scale; | 169 | 1 | bool narrow_integral = | 170 | 1 | (to_max_int_digit_count < from_max_int_digit_count) || | 171 | 1 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 172 | | | 173 | 1 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToCppT::NativeType>(); | 174 | 1 | bool multiply_may_overflow = false; | 175 | 1 | if (to_scale > from_scale) { | 176 | 0 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 177 | 0 | } | 178 | | | 179 | 1 | typename ToCppT::NativeType max_result = | 180 | 1 | DataTypeDecimal<ToCppT::PType>::get_max_digits_number(to_precision); | 181 | 1 | typename ToCppT::NativeType min_result = -max_result; | 182 | | | 183 | 1 | MaxNativeType multiplier {}; | 184 | 1 | if (from_scale < to_scale) { | 185 | 0 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 186 | 0 | from_scale); | 187 | 1 | } else if (from_scale > to_scale) { | 188 | 1 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 189 | 1 | to_scale); | 190 | 1 | } | 191 | | | 192 | 1 | return std::visit( | 193 | 1 | [&](auto multiply_may_overflow, auto narrow_integral) { | 194 | 1 | return _from_decimal<FromCppT, ToCppT, multiply_may_overflow, narrow_integral>( | 195 | 1 | from, from_precision, from_scale, to, to_precision, to_scale, | 196 | 1 | min_result, max_result, multiplier, params); | 197 | 1 | }, | 198 | 1 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral)); | 199 | 1 | } |
_ZN5doris13CastToDecimal15_from_decimalv3INS_12Decimal128V3ENS_7DecimalIiEES2_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRNS_14CastParametersE Line | Count | Source | 164 | 1 | UInt32 to_scale, CastParameters& params) { | 165 | 1 | using MaxNativeType = typename MaxFieldType::NativeType; | 166 | | | 167 | 1 | auto from_max_int_digit_count = from_precision - from_scale; | 168 | 1 | auto to_max_int_digit_count = to_precision - to_scale; | 169 | 1 | bool narrow_integral = | 170 | 1 | (to_max_int_digit_count < from_max_int_digit_count) || | 171 | 1 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 172 | | | 173 | 1 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToCppT::NativeType>(); | 174 | 1 | bool multiply_may_overflow = false; | 175 | 1 | if (to_scale > from_scale) { | 176 | 0 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 177 | 0 | } | 178 | | | 179 | 1 | typename ToCppT::NativeType max_result = | 180 | 1 | DataTypeDecimal<ToCppT::PType>::get_max_digits_number(to_precision); | 181 | 1 | typename ToCppT::NativeType min_result = -max_result; | 182 | | | 183 | 1 | MaxNativeType multiplier {}; | 184 | 1 | if (from_scale < to_scale) { | 185 | 0 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 186 | 0 | from_scale); | 187 | 1 | } else if (from_scale > to_scale) { | 188 | 1 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 189 | 1 | to_scale); | 190 | 1 | } | 191 | | | 192 | 1 | return std::visit( | 193 | 1 | [&](auto multiply_may_overflow, auto narrow_integral) { | 194 | 1 | return _from_decimal<FromCppT, ToCppT, multiply_may_overflow, narrow_integral>( | 195 | 1 | from, from_precision, from_scale, to, to_precision, to_scale, | 196 | 1 | min_result, max_result, multiplier, params); | 197 | 1 | }, | 198 | 1 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral)); | 199 | 1 | } |
_ZN5doris13CastToDecimal15_from_decimalv3INS_7DecimalIN4wide7integerILm256EiEEEENS2_IiEES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRNS_14CastParametersE Line | Count | Source | 164 | 1 | UInt32 to_scale, CastParameters& params) { | 165 | 1 | using MaxNativeType = typename MaxFieldType::NativeType; | 166 | | | 167 | 1 | auto from_max_int_digit_count = from_precision - from_scale; | 168 | 1 | auto to_max_int_digit_count = to_precision - to_scale; | 169 | 1 | bool narrow_integral = | 170 | 1 | (to_max_int_digit_count < from_max_int_digit_count) || | 171 | 1 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 172 | | | 173 | 1 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToCppT::NativeType>(); | 174 | 1 | bool multiply_may_overflow = false; | 175 | 1 | if (to_scale > from_scale) { | 176 | 0 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 177 | 0 | } | 178 | | | 179 | 1 | typename ToCppT::NativeType max_result = | 180 | 1 | DataTypeDecimal<ToCppT::PType>::get_max_digits_number(to_precision); | 181 | 1 | typename ToCppT::NativeType min_result = -max_result; | 182 | | | 183 | 1 | MaxNativeType multiplier {}; | 184 | 1 | if (from_scale < to_scale) { | 185 | 0 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 186 | 0 | from_scale); | 187 | 1 | } else if (from_scale > to_scale) { | 188 | 1 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 189 | 1 | to_scale); | 190 | 1 | } | 191 | | | 192 | 1 | return std::visit( | 193 | 1 | [&](auto multiply_may_overflow, auto narrow_integral) { | 194 | 1 | return _from_decimal<FromCppT, ToCppT, multiply_may_overflow, narrow_integral>( | 195 | 1 | from, from_precision, from_scale, to, to_precision, to_scale, | 196 | 1 | min_result, max_result, multiplier, params); | 197 | 1 | }, | 198 | 1 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral)); | 199 | 1 | } |
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 | 1 | UInt32 to_scale, CastParameters& params) { | 165 | 1 | using MaxNativeType = typename MaxFieldType::NativeType; | 166 | | | 167 | 1 | auto from_max_int_digit_count = from_precision - from_scale; | 168 | 1 | auto to_max_int_digit_count = to_precision - to_scale; | 169 | 1 | bool narrow_integral = | 170 | 1 | (to_max_int_digit_count < from_max_int_digit_count) || | 171 | 1 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 172 | | | 173 | 1 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToCppT::NativeType>(); | 174 | 1 | bool multiply_may_overflow = false; | 175 | 1 | if (to_scale > from_scale) { | 176 | 0 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 177 | 0 | } | 178 | | | 179 | 1 | typename ToCppT::NativeType max_result = | 180 | 1 | DataTypeDecimal<ToCppT::PType>::get_max_digits_number(to_precision); | 181 | 1 | typename ToCppT::NativeType min_result = -max_result; | 182 | | | 183 | 1 | MaxNativeType multiplier {}; | 184 | 1 | if (from_scale < to_scale) { | 185 | 0 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 186 | 0 | from_scale); | 187 | 1 | } 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 | 1 | return std::visit( | 193 | 1 | [&](auto multiply_may_overflow, auto narrow_integral) { | 194 | 1 | return _from_decimal<FromCppT, ToCppT, multiply_may_overflow, narrow_integral>( | 195 | 1 | from, from_precision, from_scale, to, to_precision, to_scale, | 196 | 1 | min_result, max_result, multiplier, params); | 197 | 1 | }, | 198 | 1 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral)); | 199 | 1 | } |
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 | 14.8k | CastParameters& params) { |
215 | 14.8k | using MaxNativeType = typename MaxFieldType::NativeType; |
216 | | |
217 | 14.8k | if (from_scale < to_scale) { |
218 | 4.59k | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, |
219 | 4.59k | narrow_integral>( |
220 | 4.59k | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, |
221 | 4.59k | min_result, max_result, params); |
222 | 10.2k | } else if (from_scale == to_scale) { |
223 | 1.86k | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( |
224 | 1.86k | from, from_precision, from_scale, to, to_precision, to_scale, min_result, |
225 | 1.86k | max_result, params); |
226 | 8.38k | } else { |
227 | 8.38k | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, |
228 | 8.38k | narrow_integral>( |
229 | 8.38k | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, |
230 | 8.38k | min_result, max_result, params); |
231 | 8.38k | } |
232 | 0 | return true; |
233 | 14.8k | } _ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIiEES3_Lb0ELb0ES3_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKNS4_10NativeTypeESB_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 214 | 134 | CastParameters& params) { | 215 | 134 | using MaxNativeType = typename MaxFieldType::NativeType; | 216 | | | 217 | 134 | 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 | 120 | } 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 | 112 | } else { | 227 | 112 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 228 | 112 | narrow_integral>( | 229 | 112 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 230 | 112 | min_result, max_result, params); | 231 | 112 | } | 232 | 0 | return true; | 233 | 134 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIiEES3_Lb0ELb1ES3_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKNS4_10NativeTypeESB_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 214 | 108 | CastParameters& params) { | 215 | 108 | using MaxNativeType = typename MaxFieldType::NativeType; | 216 | | | 217 | 108 | if (from_scale < to_scale) { | 218 | 7 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 219 | 7 | narrow_integral>( | 220 | 7 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 221 | 7 | min_result, max_result, params); | 222 | 101 | } else if (from_scale == to_scale) { | 223 | 19 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 224 | 19 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 225 | 19 | max_result, params); | 226 | 82 | } else { | 227 | 82 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 228 | 82 | narrow_integral>( | 229 | 82 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 230 | 82 | min_result, max_result, params); | 231 | 82 | } | 232 | 0 | return true; | 233 | 108 | } |
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 | 84 | CastParameters& params) { | 215 | 84 | using MaxNativeType = typename MaxFieldType::NativeType; | 216 | | | 217 | 84 | if (from_scale < to_scale) { | 218 | 84 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 219 | 84 | narrow_integral>( | 220 | 84 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 221 | 84 | min_result, max_result, params); | 222 | 84 | } 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 | 84 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIlEENS2_IiEELb0ELb0ES3_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 214 | 160 | CastParameters& params) { | 215 | 160 | using MaxNativeType = typename MaxFieldType::NativeType; | 216 | | | 217 | 160 | 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 | 160 | } 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 | 160 | } else { | 227 | 160 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 228 | 160 | narrow_integral>( | 229 | 160 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 230 | 160 | min_result, max_result, params); | 231 | 160 | } | 232 | 0 | return true; | 233 | 160 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIlEENS2_IiEELb0ELb1ES3_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 214 | 459 | CastParameters& params) { | 215 | 459 | using MaxNativeType = typename MaxFieldType::NativeType; | 216 | | | 217 | 459 | 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 | 459 | } else if (from_scale == to_scale) { | 223 | 136 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 224 | 136 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 225 | 136 | max_result, params); | 226 | 323 | } else { | 227 | 323 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 228 | 323 | narrow_integral>( | 229 | 323 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 230 | 323 | min_result, max_result, params); | 231 | 323 | } | 232 | 0 | return true; | 233 | 459 | } |
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 | 126 | CastParameters& params) { | 215 | 126 | using MaxNativeType = typename MaxFieldType::NativeType; | 216 | | | 217 | 126 | if (from_scale < to_scale) { | 218 | 126 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 219 | 126 | narrow_integral>( | 220 | 126 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 221 | 126 | min_result, max_result, params); | 222 | 126 | } 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 | 126 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_12Decimal128V3ENS_7DecimalIiEELb0ELb0ES2_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 214 | 160 | CastParameters& params) { | 215 | 160 | using MaxNativeType = typename MaxFieldType::NativeType; | 216 | | | 217 | 160 | 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 | 160 | } 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 | 160 | } else { | 227 | 160 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 228 | 160 | narrow_integral>( | 229 | 160 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 230 | 160 | min_result, max_result, params); | 231 | 160 | } | 232 | 0 | return true; | 233 | 160 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_12Decimal128V3ENS_7DecimalIiEELb0ELb1ES2_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 214 | 479 | CastParameters& params) { | 215 | 479 | using MaxNativeType = typename MaxFieldType::NativeType; | 216 | | | 217 | 479 | 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 | 479 | } else if (from_scale == to_scale) { | 223 | 122 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 224 | 122 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 225 | 122 | max_result, params); | 226 | 357 | } else { | 227 | 357 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 228 | 357 | narrow_integral>( | 229 | 357 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 230 | 357 | min_result, max_result, params); | 231 | 357 | } | 232 | 0 | return true; | 233 | 479 | } |
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 | 126 | CastParameters& params) { | 215 | 126 | using MaxNativeType = typename MaxFieldType::NativeType; | 216 | | | 217 | 126 | if (from_scale < to_scale) { | 218 | 126 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 219 | 126 | narrow_integral>( | 220 | 126 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 221 | 126 | min_result, max_result, params); | 222 | 126 | } 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 | 126 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIN4wide7integerILm256EiEEEENS2_IiEELb0ELb0ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKNS8_10NativeTypeESF_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 214 | 160 | CastParameters& params) { | 215 | 160 | using MaxNativeType = typename MaxFieldType::NativeType; | 216 | | | 217 | 160 | 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 | 160 | } 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 | 160 | } else { | 227 | 160 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 228 | 160 | narrow_integral>( | 229 | 160 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 230 | 160 | min_result, max_result, params); | 231 | 160 | } | 232 | 0 | return true; | 233 | 160 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIN4wide7integerILm256EiEEEENS2_IiEELb0ELb1ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKNS8_10NativeTypeESF_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 214 | 479 | CastParameters& params) { | 215 | 479 | using MaxNativeType = typename MaxFieldType::NativeType; | 216 | | | 217 | 479 | 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 | 479 | } else if (from_scale == to_scale) { | 223 | 122 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 224 | 122 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 225 | 122 | max_result, params); | 226 | 357 | } else { | 227 | 357 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 228 | 357 | narrow_integral>( | 229 | 357 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 230 | 357 | min_result, max_result, params); | 231 | 357 | } | 232 | 0 | return true; | 233 | 479 | } |
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 | 126 | CastParameters& params) { | 215 | 126 | using MaxNativeType = typename MaxFieldType::NativeType; | 216 | | | 217 | 126 | if (from_scale < to_scale) { | 218 | 126 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 219 | 126 | narrow_integral>( | 220 | 126 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 221 | 126 | min_result, max_result, params); | 222 | 126 | } 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 | 126 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIiEENS2_IlEELb0ELb0ES4_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 214 | 378 | CastParameters& params) { | 215 | 378 | using MaxNativeType = typename MaxFieldType::NativeType; | 216 | | | 217 | 378 | if (from_scale < to_scale) { | 218 | 112 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 219 | 112 | narrow_integral>( | 220 | 112 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 221 | 112 | min_result, max_result, params); | 222 | 266 | } else if (from_scale == to_scale) { | 223 | 82 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 224 | 82 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 225 | 82 | max_result, params); | 226 | 184 | } else { | 227 | 184 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 228 | 184 | narrow_integral>( | 229 | 184 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 230 | 184 | min_result, max_result, params); | 231 | 184 | } | 232 | 0 | return true; | 233 | 378 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIiEENS2_IlEELb0ELb1ES4_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 214 | 58 | CastParameters& params) { | 215 | 58 | using MaxNativeType = typename MaxFieldType::NativeType; | 216 | | | 217 | 58 | if (from_scale < to_scale) { | 218 | 58 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 219 | 58 | narrow_integral>( | 220 | 58 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 221 | 58 | min_result, max_result, params); | 222 | 58 | } 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 | 58 | } |
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 | 72 | CastParameters& params) { | 215 | 72 | using MaxNativeType = typename MaxFieldType::NativeType; | 216 | | | 217 | 72 | if (from_scale < to_scale) { | 218 | 72 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 219 | 72 | narrow_integral>( | 220 | 72 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 221 | 72 | min_result, max_result, params); | 222 | 72 | } 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 | 72 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIlEES3_Lb0ELb0ES3_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKNS4_10NativeTypeESB_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 214 | 428 | CastParameters& params) { | 215 | 428 | using MaxNativeType = typename MaxFieldType::NativeType; | 216 | | | 217 | 428 | if (from_scale < to_scale) { | 218 | 46 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 219 | 46 | narrow_integral>( | 220 | 46 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 221 | 46 | min_result, max_result, params); | 222 | 382 | } else if (from_scale == to_scale) { | 223 | 30 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 224 | 30 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 225 | 30 | max_result, params); | 226 | 352 | } else { | 227 | 352 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 228 | 352 | narrow_integral>( | 229 | 352 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 230 | 352 | min_result, max_result, params); | 231 | 352 | } | 232 | 0 | return true; | 233 | 428 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIlEES3_Lb0ELb1ES3_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKNS4_10NativeTypeESB_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 214 | 182 | CastParameters& params) { | 215 | 182 | using MaxNativeType = typename MaxFieldType::NativeType; | 216 | | | 217 | 182 | if (from_scale < to_scale) { | 218 | 44 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 219 | 44 | narrow_integral>( | 220 | 44 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 221 | 44 | min_result, max_result, params); | 222 | 138 | } else if (from_scale == to_scale) { | 223 | 42 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 224 | 42 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 225 | 42 | max_result, params); | 226 | 96 | } else { | 227 | 96 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 228 | 96 | narrow_integral>( | 229 | 96 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 230 | 96 | min_result, max_result, params); | 231 | 96 | } | 232 | 0 | return true; | 233 | 182 | } |
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 | 210 | CastParameters& params) { | 215 | 210 | using MaxNativeType = typename MaxFieldType::NativeType; | 216 | | | 217 | 210 | if (from_scale < to_scale) { | 218 | 210 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 219 | 210 | narrow_integral>( | 220 | 210 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 221 | 210 | min_result, max_result, params); | 222 | 210 | } 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 | 210 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_12Decimal128V3ENS_7DecimalIlEELb0ELb0ES2_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 214 | 288 | CastParameters& params) { | 215 | 288 | using MaxNativeType = typename MaxFieldType::NativeType; | 216 | | | 217 | 288 | 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 | 288 | } 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 | 288 | } else { | 227 | 288 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 228 | 288 | narrow_integral>( | 229 | 288 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 230 | 288 | min_result, max_result, params); | 231 | 288 | } | 232 | 0 | return true; | 233 | 288 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_12Decimal128V3ENS_7DecimalIlEELb0ELb1ES2_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 214 | 532 | CastParameters& params) { | 215 | 532 | using MaxNativeType = typename MaxFieldType::NativeType; | 216 | | | 217 | 532 | 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 | 532 | } else if (from_scale == to_scale) { | 223 | 182 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 224 | 182 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 225 | 182 | max_result, params); | 226 | 350 | } else { | 227 | 350 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 228 | 350 | narrow_integral>( | 229 | 350 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 230 | 350 | min_result, max_result, params); | 231 | 350 | } | 232 | 0 | return true; | 233 | 532 | } |
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 | 224 | CastParameters& params) { | 215 | 224 | using MaxNativeType = typename MaxFieldType::NativeType; | 216 | | | 217 | 224 | 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 | 224 | } 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 | 224 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIN4wide7integerILm256EiEEEENS2_IlEELb0ELb0ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKNS8_10NativeTypeESF_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 214 | 288 | CastParameters& params) { | 215 | 288 | using MaxNativeType = typename MaxFieldType::NativeType; | 216 | | | 217 | 288 | 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 | 288 | } 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 | 288 | } else { | 227 | 288 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 228 | 288 | narrow_integral>( | 229 | 288 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 230 | 288 | min_result, max_result, params); | 231 | 288 | } | 232 | 0 | return true; | 233 | 288 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIN4wide7integerILm256EiEEEENS2_IlEELb0ELb1ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKNS8_10NativeTypeESF_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 214 | 552 | CastParameters& params) { | 215 | 552 | using MaxNativeType = typename MaxFieldType::NativeType; | 216 | | | 217 | 552 | 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 | 552 | } else if (from_scale == to_scale) { | 223 | 168 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 224 | 168 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 225 | 168 | max_result, params); | 226 | 384 | } else { | 227 | 384 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 228 | 384 | narrow_integral>( | 229 | 384 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 230 | 384 | min_result, max_result, params); | 231 | 384 | } | 232 | 0 | return true; | 233 | 552 | } |
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 | 224 | CastParameters& params) { | 215 | 224 | using MaxNativeType = typename MaxFieldType::NativeType; | 216 | | | 217 | 224 | 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 | 224 | } 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 | 224 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIiEENS_12Decimal128V3ELb0ELb0ES4_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 214 | 378 | CastParameters& params) { | 215 | 378 | using MaxNativeType = typename MaxFieldType::NativeType; | 216 | | | 217 | 378 | if (from_scale < to_scale) { | 218 | 120 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 219 | 120 | narrow_integral>( | 220 | 120 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 221 | 120 | min_result, max_result, params); | 222 | 258 | } else if (from_scale == to_scale) { | 223 | 74 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 224 | 74 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 225 | 74 | max_result, params); | 226 | 184 | } else { | 227 | 184 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 228 | 184 | narrow_integral>( | 229 | 184 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 230 | 184 | min_result, max_result, params); | 231 | 184 | } | 232 | 0 | return true; | 233 | 378 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIiEENS_12Decimal128V3ELb0ELb1ES4_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 214 | 65 | CastParameters& params) { | 215 | 65 | using MaxNativeType = typename MaxFieldType::NativeType; | 216 | | | 217 | 65 | if (from_scale < to_scale) { | 218 | 65 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 219 | 65 | narrow_integral>( | 220 | 65 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 221 | 65 | min_result, max_result, params); | 222 | 65 | } 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 | 65 | } |
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 | 65 | CastParameters& params) { | 215 | 65 | using MaxNativeType = typename MaxFieldType::NativeType; | 216 | | | 217 | 65 | if (from_scale < to_scale) { | 218 | 65 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 219 | 65 | narrow_integral>( | 220 | 65 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 221 | 65 | min_result, max_result, params); | 222 | 65 | } 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 | 65 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIlEENS_12Decimal128V3ELb0ELb0ES4_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 214 | 656 | CastParameters& params) { | 215 | 656 | using MaxNativeType = typename MaxFieldType::NativeType; | 216 | | | 217 | 656 | if (from_scale < to_scale) { | 218 | 176 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 219 | 176 | narrow_integral>( | 220 | 176 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 221 | 176 | min_result, max_result, params); | 222 | 480 | } else if (from_scale == to_scale) { | 223 | 128 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 224 | 128 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 225 | 128 | max_result, params); | 226 | 352 | } else { | 227 | 352 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 228 | 352 | narrow_integral>( | 229 | 352 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 230 | 352 | min_result, max_result, params); | 231 | 352 | } | 232 | 0 | return true; | 233 | 656 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIlEENS_12Decimal128V3ELb0ELb1ES4_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_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 | 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 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_12Decimal128V3ES2_Lb0ELb0ES2_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS4_jjRS3_jjRKNS3_10NativeTypeESA_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 214 | 429 | CastParameters& params) { | 215 | 429 | using MaxNativeType = typename MaxFieldType::NativeType; | 216 | | | 217 | 429 | if (from_scale < to_scale) { | 218 | 46 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 219 | 46 | narrow_integral>( | 220 | 46 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 221 | 46 | min_result, max_result, params); | 222 | 383 | } else if (from_scale == to_scale) { | 223 | 31 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 224 | 31 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 225 | 31 | max_result, params); | 226 | 352 | } else { | 227 | 352 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 228 | 352 | narrow_integral>( | 229 | 352 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 230 | 352 | min_result, max_result, params); | 231 | 352 | } | 232 | 0 | return true; | 233 | 429 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_12Decimal128V3ES2_Lb0ELb1ES2_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS4_jjRS3_jjRKNS3_10NativeTypeESA_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 214 | 208 | CastParameters& params) { | 215 | 208 | using MaxNativeType = typename MaxFieldType::NativeType; | 216 | | | 217 | 208 | if (from_scale < to_scale) { | 218 | 70 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 219 | 70 | narrow_integral>( | 220 | 70 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 221 | 70 | min_result, max_result, params); | 222 | 138 | } else if (from_scale == to_scale) { | 223 | 42 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 224 | 42 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 225 | 42 | max_result, params); | 226 | 96 | } else { | 227 | 96 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 228 | 96 | narrow_integral>( | 229 | 96 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 230 | 96 | min_result, max_result, params); | 231 | 96 | } | 232 | 0 | return true; | 233 | 208 | } |
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 | 184 | CastParameters& params) { | 215 | 184 | using MaxNativeType = typename MaxFieldType::NativeType; | 216 | | | 217 | 184 | if (from_scale < to_scale) { | 218 | 184 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 219 | 184 | narrow_integral>( | 220 | 184 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 221 | 184 | min_result, max_result, params); | 222 | 184 | } 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 | 184 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIN4wide7integerILm256EiEEEENS_12Decimal128V3ELb0ELb0ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKNS8_10NativeTypeESF_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 214 | 288 | CastParameters& params) { | 215 | 288 | using MaxNativeType = typename MaxFieldType::NativeType; | 216 | | | 217 | 288 | 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 | 288 | } 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 | 288 | } else { | 227 | 288 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 228 | 288 | narrow_integral>( | 229 | 288 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 230 | 288 | min_result, max_result, params); | 231 | 288 | } | 232 | 0 | return true; | 233 | 288 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIN4wide7integerILm256EiEEEENS_12Decimal128V3ELb0ELb1ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKNS8_10NativeTypeESF_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 214 | 532 | CastParameters& params) { | 215 | 532 | using MaxNativeType = typename MaxFieldType::NativeType; | 216 | | | 217 | 532 | 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 | 532 | } else if (from_scale == to_scale) { | 223 | 182 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 224 | 182 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 225 | 182 | max_result, params); | 226 | 350 | } else { | 227 | 350 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 228 | 350 | narrow_integral>( | 229 | 350 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 230 | 350 | min_result, max_result, params); | 231 | 350 | } | 232 | 0 | return true; | 233 | 532 | } |
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 | 224 | CastParameters& params) { | 215 | 224 | using MaxNativeType = typename MaxFieldType::NativeType; | 216 | | | 217 | 224 | 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 | 224 | } 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 | 224 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIiEENS2_IN4wide7integerILm256EiEEEELb0ELb0ES7_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKNS8_10NativeTypeESF_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 214 | 378 | CastParameters& params) { | 215 | 378 | using MaxNativeType = typename MaxFieldType::NativeType; | 216 | | | 217 | 378 | if (from_scale < to_scale) { | 218 | 120 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 219 | 120 | narrow_integral>( | 220 | 120 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 221 | 120 | min_result, max_result, params); | 222 | 258 | } else if (from_scale == to_scale) { | 223 | 74 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 224 | 74 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 225 | 74 | max_result, params); | 226 | 184 | } else { | 227 | 184 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 228 | 184 | narrow_integral>( | 229 | 184 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 230 | 184 | min_result, max_result, params); | 231 | 184 | } | 232 | 0 | return true; | 233 | 378 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIiEENS2_IN4wide7integerILm256EiEEEELb0ELb1ES7_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKNS8_10NativeTypeESF_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 214 | 65 | CastParameters& params) { | 215 | 65 | using MaxNativeType = typename MaxFieldType::NativeType; | 216 | | | 217 | 65 | if (from_scale < to_scale) { | 218 | 65 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 219 | 65 | narrow_integral>( | 220 | 65 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 221 | 65 | min_result, max_result, params); | 222 | 65 | } 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 | 65 | } |
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 | 65 | CastParameters& params) { | 215 | 65 | using MaxNativeType = typename MaxFieldType::NativeType; | 216 | | | 217 | 65 | if (from_scale < to_scale) { | 218 | 65 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 219 | 65 | narrow_integral>( | 220 | 65 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 221 | 65 | min_result, max_result, params); | 222 | 65 | } 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 | 65 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIlEENS2_IN4wide7integerILm256EiEEEELb0ELb0ES7_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKNS8_10NativeTypeESF_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 214 | 656 | CastParameters& params) { | 215 | 656 | using MaxNativeType = typename MaxFieldType::NativeType; | 216 | | | 217 | 656 | if (from_scale < to_scale) { | 218 | 184 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 219 | 184 | narrow_integral>( | 220 | 184 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 221 | 184 | min_result, max_result, params); | 222 | 472 | } 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 | 352 | } else { | 227 | 352 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 228 | 352 | narrow_integral>( | 229 | 352 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 230 | 352 | min_result, max_result, params); | 231 | 352 | } | 232 | 0 | return true; | 233 | 656 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIlEENS2_IN4wide7integerILm256EiEEEELb0ELb1ES7_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKNS8_10NativeTypeESF_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_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 | 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 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_12Decimal128V3ENS_7DecimalIN4wide7integerILm256EiEEEELb0ELb0ES7_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKNS8_10NativeTypeESF_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 214 | 656 | CastParameters& params) { | 215 | 656 | using MaxNativeType = typename MaxFieldType::NativeType; | 216 | | | 217 | 656 | if (from_scale < to_scale) { | 218 | 176 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 219 | 176 | narrow_integral>( | 220 | 176 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 221 | 176 | min_result, max_result, params); | 222 | 480 | } else if (from_scale == to_scale) { | 223 | 128 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 224 | 128 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 225 | 128 | max_result, params); | 226 | 352 | } else { | 227 | 352 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 228 | 352 | narrow_integral>( | 229 | 352 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 230 | 352 | min_result, max_result, params); | 231 | 352 | } | 232 | 0 | return true; | 233 | 656 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_12Decimal128V3ENS_7DecimalIN4wide7integerILm256EiEEEELb0ELb1ES7_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKNS8_10NativeTypeESF_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 214 | 109 | CastParameters& params) { | 215 | 109 | using MaxNativeType = typename MaxFieldType::NativeType; | 216 | | | 217 | 109 | if (from_scale < to_scale) { | 218 | 109 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 219 | 109 | narrow_integral>( | 220 | 109 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 221 | 109 | min_result, max_result, params); | 222 | 109 | } 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 | 109 | } |
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 | 123 | CastParameters& params) { | 215 | 123 | using MaxNativeType = typename MaxFieldType::NativeType; | 216 | | | 217 | 123 | if (from_scale < to_scale) { | 218 | 123 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 219 | 123 | narrow_integral>( | 220 | 123 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 221 | 123 | min_result, max_result, params); | 222 | 123 | } 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 | 123 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIN4wide7integerILm256EiEEEES6_Lb0ELb0ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS8_jjRS7_jjRKNS7_10NativeTypeESE_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 214 | 428 | CastParameters& params) { | 215 | 428 | using MaxNativeType = typename MaxFieldType::NativeType; | 216 | | | 217 | 428 | if (from_scale < to_scale) { | 218 | 46 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 219 | 46 | narrow_integral>( | 220 | 46 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 221 | 46 | min_result, max_result, params); | 222 | 382 | } else if (from_scale == to_scale) { | 223 | 30 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 224 | 30 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 225 | 30 | max_result, params); | 226 | 352 | } else { | 227 | 352 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 228 | 352 | narrow_integral>( | 229 | 352 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 230 | 352 | min_result, max_result, params); | 231 | 352 | } | 232 | 0 | return true; | 233 | 428 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIN4wide7integerILm256EiEEEES6_Lb0ELb1ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS8_jjRS7_jjRKNS7_10NativeTypeESE_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 214 | 182 | CastParameters& params) { | 215 | 182 | using MaxNativeType = typename MaxFieldType::NativeType; | 216 | | | 217 | 182 | if (from_scale < to_scale) { | 218 | 44 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 219 | 44 | narrow_integral>( | 220 | 44 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 221 | 44 | min_result, max_result, params); | 222 | 138 | } else if (from_scale == to_scale) { | 223 | 42 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 224 | 42 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 225 | 42 | max_result, params); | 226 | 96 | } else { | 227 | 96 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 228 | 96 | narrow_integral>( | 229 | 96 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 230 | 96 | min_result, max_result, params); | 231 | 96 | } | 232 | 0 | return true; | 233 | 182 | } |
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 | 210 | CastParameters& params) { | 215 | 210 | using MaxNativeType = typename MaxFieldType::NativeType; | 216 | | | 217 | 210 | if (from_scale < to_scale) { | 218 | 210 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 219 | 210 | narrow_integral>( | 220 | 210 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 221 | 210 | min_result, max_result, params); | 222 | 210 | } 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 | 210 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_14DecimalV2ValueENS_7DecimalIiEELb0ELb0ES2_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 214 | 36 | CastParameters& params) { | 215 | 36 | using MaxNativeType = typename MaxFieldType::NativeType; | 216 | | | 217 | 36 | 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 | 36 | } else if (from_scale == to_scale) { | 223 | 4 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 224 | 4 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 225 | 4 | max_result, params); | 226 | 32 | } else { | 227 | 32 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 228 | 32 | narrow_integral>( | 229 | 32 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 230 | 32 | min_result, max_result, params); | 231 | 32 | } | 232 | 0 | return true; | 233 | 36 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_14DecimalV2ValueENS_7DecimalIiEELb0ELb1ES2_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 214 | 470 | CastParameters& params) { | 215 | 470 | using MaxNativeType = typename MaxFieldType::NativeType; | 216 | | | 217 | 470 | 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 | 470 | } else if (from_scale == to_scale) { | 223 | 35 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 224 | 35 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 225 | 35 | max_result, params); | 226 | 435 | } else { | 227 | 435 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 228 | 435 | narrow_integral>( | 229 | 435 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 230 | 435 | min_result, max_result, params); | 231 | 435 | } | 232 | 0 | return true; | 233 | 470 | } |
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 | 131 | CastParameters& params) { | 215 | 131 | using MaxNativeType = typename MaxFieldType::NativeType; | 216 | | | 217 | 131 | 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 | 131 | } else if (from_scale == to_scale) { | 223 | 7 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 224 | 7 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 225 | 7 | max_result, params); | 226 | 124 | } else { | 227 | 124 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 228 | 124 | narrow_integral>( | 229 | 124 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 230 | 124 | min_result, max_result, params); | 231 | 124 | } | 232 | 0 | return true; | 233 | 131 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_14DecimalV2ValueENS_7DecimalIlEELb0ELb1ES2_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 214 | 414 | CastParameters& params) { | 215 | 414 | using MaxNativeType = typename MaxFieldType::NativeType; | 216 | | | 217 | 414 | 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 | 414 | } 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 | 354 | } else { | 227 | 354 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 228 | 354 | narrow_integral>( | 229 | 354 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 230 | 354 | min_result, max_result, params); | 231 | 354 | } | 232 | 0 | return true; | 233 | 414 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_14DecimalV2ValueENS_7DecimalIlEELb1ELb0ES2_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 214 | 15 | CastParameters& params) { | 215 | 15 | using MaxNativeType = typename MaxFieldType::NativeType; | 216 | | | 217 | 15 | if (from_scale < to_scale) { | 218 | 15 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 219 | 15 | narrow_integral>( | 220 | 15 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 221 | 15 | min_result, max_result, params); | 222 | 15 | } 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 | 15 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_14DecimalV2ValueENS_7DecimalIlEELb1ELb1ES2_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_14DecimalV2ValueENS_12Decimal128V3ELb0ELb0ES3_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKNS4_10NativeTypeESB_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 214 | 375 | CastParameters& params) { | 215 | 375 | using MaxNativeType = typename MaxFieldType::NativeType; | 216 | | | 217 | 375 | if (from_scale < to_scale) { | 218 | 11 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 219 | 11 | narrow_integral>( | 220 | 11 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 221 | 11 | min_result, max_result, params); | 222 | 364 | } 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 | 364 | } else { | 227 | 364 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 228 | 364 | narrow_integral>( | 229 | 364 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 230 | 364 | min_result, max_result, params); | 231 | 364 | } | 232 | 0 | return true; | 233 | 375 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_14DecimalV2ValueENS_12Decimal128V3ELb0ELb1ES3_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKNS4_10NativeTypeESB_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 214 | 145 | CastParameters& params) { | 215 | 145 | using MaxNativeType = typename MaxFieldType::NativeType; | 216 | | | 217 | 145 | if (from_scale < to_scale) { | 218 | 95 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 219 | 95 | narrow_integral>( | 220 | 95 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 221 | 95 | min_result, max_result, params); | 222 | 95 | } 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 | 50 | } else { | 227 | 50 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 228 | 50 | narrow_integral>( | 229 | 50 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 230 | 50 | min_result, max_result, params); | 231 | 50 | } | 232 | 0 | return true; | 233 | 145 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_14DecimalV2ValueENS_12Decimal128V3ELb1ELb0ES3_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKNS4_10NativeTypeESB_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 214 | 11 | CastParameters& params) { | 215 | 11 | using MaxNativeType = typename MaxFieldType::NativeType; | 216 | | | 217 | 11 | if (from_scale < to_scale) { | 218 | 11 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 219 | 11 | narrow_integral>( | 220 | 11 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 221 | 11 | min_result, max_result, params); | 222 | 11 | } 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 | 11 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_14DecimalV2ValueENS_12Decimal128V3ELb1ELb1ES3_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKNS4_10NativeTypeESB_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 214 | 95 | CastParameters& params) { | 215 | 95 | using MaxNativeType = typename MaxFieldType::NativeType; | 216 | | | 217 | 95 | if (from_scale < to_scale) { | 218 | 95 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 219 | 95 | narrow_integral>( | 220 | 95 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 221 | 95 | min_result, max_result, params); | 222 | 95 | } 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 | 95 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_14DecimalV2ValueENS_7DecimalIN4wide7integerILm256EiEEEELb0ELb0ES7_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKNS8_10NativeTypeESF_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 214 | 423 | CastParameters& params) { | 215 | 423 | using MaxNativeType = typename MaxFieldType::NativeType; | 216 | | | 217 | 423 | if (from_scale < to_scale) { | 218 | 11 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 219 | 11 | narrow_integral>( | 220 | 11 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 221 | 11 | min_result, max_result, params); | 222 | 412 | } 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 | 412 | } else { | 227 | 412 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 228 | 412 | narrow_integral>( | 229 | 412 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 230 | 412 | min_result, max_result, params); | 231 | 412 | } | 232 | 0 | return true; | 233 | 423 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_14DecimalV2ValueENS_7DecimalIN4wide7integerILm256EiEEEELb0ELb1ES7_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKNS8_10NativeTypeESF_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 214 | 95 | CastParameters& params) { | 215 | 95 | using MaxNativeType = typename MaxFieldType::NativeType; | 216 | | | 217 | 95 | if (from_scale < to_scale) { | 218 | 95 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 219 | 95 | narrow_integral>( | 220 | 95 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 221 | 95 | min_result, max_result, params); | 222 | 95 | } 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 | 95 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_14DecimalV2ValueENS_7DecimalIN4wide7integerILm256EiEEEELb1ELb0ES7_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKNS8_10NativeTypeESF_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 214 | 11 | CastParameters& params) { | 215 | 11 | using MaxNativeType = typename MaxFieldType::NativeType; | 216 | | | 217 | 11 | if (from_scale < to_scale) { | 218 | 11 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 219 | 11 | narrow_integral>( | 220 | 11 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 221 | 11 | min_result, max_result, params); | 222 | 11 | } 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 | 11 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_14DecimalV2ValueENS_7DecimalIN4wide7integerILm256EiEEEELb1ELb1ES7_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKNS8_10NativeTypeESF_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 214 | 95 | CastParameters& params) { | 215 | 95 | using MaxNativeType = typename MaxFieldType::NativeType; | 216 | | | 217 | 95 | if (from_scale < to_scale) { | 218 | 95 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 219 | 95 | narrow_integral>( | 220 | 95 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 221 | 95 | min_result, max_result, params); | 222 | 95 | } 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 | 95 | } |
|
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 | 3.35k | CastParameters& params) { |
243 | 3.35k | if (!std::isfinite(from)) { |
244 | 196 | params.status = Status(ErrorCode::ARITHMETIC_OVERFLOW_ERRROR, |
245 | 196 | "Decimal convert overflow. Cannot convert infinity or NaN " |
246 | 196 | "to decimal"); |
247 | 196 | return false; |
248 | 196 | } |
249 | 3.15k | using DoubleType = std::conditional_t<IsDecimal256<ToCppT>, long double, double>; |
250 | 3.15k | DoubleType tmp = from * static_cast<DoubleType>(scale_multiplier); |
251 | 3.15k | if (tmp <= DoubleType(min_result) || tmp >= DoubleType(max_result)) { |
252 | 92 | if (params.is_strict) { |
253 | 46 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, "float/double", to_precision, |
254 | 46 | to_scale); |
255 | 46 | } |
256 | 92 | return false; |
257 | 92 | } |
258 | 3.06k | to.value = static_cast<typename ToCppT::NativeType>(static_cast<double>( |
259 | 3.06k | from * static_cast<DoubleType>(scale_multiplier) + ((from >= 0) ? 0.5 : -0.5))); |
260 | 3.06k | return true; |
261 | 3.15k | } _ZN5doris13CastToDecimal11_from_floatIdNS_7DecimalIiEEQaaaa15IsDecimalNumberIT0_E14IsCppTypeFloatIT_Ent14IsDecimal128V2IS4_EEEbRKS5_RS4_jjRKNS4_10NativeTypeESB_SB_RNS_14CastParametersE Line | Count | Source | 242 | 441 | CastParameters& params) { | 243 | 441 | if (!std::isfinite(from)) { | 244 | 24 | params.status = Status(ErrorCode::ARITHMETIC_OVERFLOW_ERRROR, | 245 | 24 | "Decimal convert overflow. Cannot convert infinity or NaN " | 246 | 24 | "to decimal"); | 247 | 24 | return false; | 248 | 24 | } | 249 | 417 | using DoubleType = std::conditional_t<IsDecimal256<ToCppT>, long double, double>; | 250 | 417 | DoubleType tmp = from * static_cast<DoubleType>(scale_multiplier); | 251 | 417 | if (tmp <= DoubleType(min_result) || tmp >= DoubleType(max_result)) { | 252 | 12 | if (params.is_strict) { | 253 | 6 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, "float/double", to_precision, | 254 | 6 | to_scale); | 255 | 6 | } | 256 | 12 | return false; | 257 | 12 | } | 258 | 405 | to.value = static_cast<typename ToCppT::NativeType>(static_cast<double>( | 259 | 405 | from * static_cast<DoubleType>(scale_multiplier) + ((from >= 0) ? 0.5 : -0.5))); | 260 | 405 | return true; | 261 | 417 | } |
_ZN5doris13CastToDecimal11_from_floatIfNS_7DecimalIiEEQaaaa15IsDecimalNumberIT0_E14IsCppTypeFloatIT_Ent14IsDecimal128V2IS4_EEEbRKS5_RS4_jjRKNS4_10NativeTypeESB_SB_RNS_14CastParametersE Line | Count | Source | 242 | 429 | CastParameters& params) { | 243 | 429 | if (!std::isfinite(from)) { | 244 | 24 | params.status = Status(ErrorCode::ARITHMETIC_OVERFLOW_ERRROR, | 245 | 24 | "Decimal convert overflow. Cannot convert infinity or NaN " | 246 | 24 | "to decimal"); | 247 | 24 | return false; | 248 | 24 | } | 249 | 405 | using DoubleType = std::conditional_t<IsDecimal256<ToCppT>, long double, double>; | 250 | 405 | DoubleType tmp = from * static_cast<DoubleType>(scale_multiplier); | 251 | 405 | if (tmp <= DoubleType(min_result) || tmp >= DoubleType(max_result)) { | 252 | 12 | if (params.is_strict) { | 253 | 6 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, "float/double", to_precision, | 254 | 6 | to_scale); | 255 | 6 | } | 256 | 12 | return false; | 257 | 12 | } | 258 | 393 | to.value = static_cast<typename ToCppT::NativeType>(static_cast<double>( | 259 | 393 | from * static_cast<DoubleType>(scale_multiplier) + ((from >= 0) ? 0.5 : -0.5))); | 260 | 393 | return true; | 261 | 405 | } |
_ZN5doris13CastToDecimal11_from_floatIdNS_7DecimalIlEEQaaaa15IsDecimalNumberIT0_E14IsCppTypeFloatIT_Ent14IsDecimal128V2IS4_EEEbRKS5_RS4_jjRKNS4_10NativeTypeESB_SB_RNS_14CastParametersE Line | Count | Source | 242 | 428 | CastParameters& params) { | 243 | 428 | if (!std::isfinite(from)) { | 244 | 24 | params.status = Status(ErrorCode::ARITHMETIC_OVERFLOW_ERRROR, | 245 | 24 | "Decimal convert overflow. Cannot convert infinity or NaN " | 246 | 24 | "to decimal"); | 247 | 24 | return false; | 248 | 24 | } | 249 | 404 | using DoubleType = std::conditional_t<IsDecimal256<ToCppT>, long double, double>; | 250 | 404 | DoubleType tmp = from * static_cast<DoubleType>(scale_multiplier); | 251 | 404 | if (tmp <= DoubleType(min_result) || tmp >= DoubleType(max_result)) { | 252 | 12 | if (params.is_strict) { | 253 | 6 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, "float/double", to_precision, | 254 | 6 | to_scale); | 255 | 6 | } | 256 | 12 | return false; | 257 | 12 | } | 258 | 392 | to.value = static_cast<typename ToCppT::NativeType>(static_cast<double>( | 259 | 392 | from * static_cast<DoubleType>(scale_multiplier) + ((from >= 0) ? 0.5 : -0.5))); | 260 | 392 | return true; | 261 | 404 | } |
_ZN5doris13CastToDecimal11_from_floatIfNS_7DecimalIlEEQaaaa15IsDecimalNumberIT0_E14IsCppTypeFloatIT_Ent14IsDecimal128V2IS4_EEEbRKS5_RS4_jjRKNS4_10NativeTypeESB_SB_RNS_14CastParametersE Line | Count | Source | 242 | 380 | CastParameters& params) { | 243 | 380 | if (!std::isfinite(from)) { | 244 | 24 | params.status = Status(ErrorCode::ARITHMETIC_OVERFLOW_ERRROR, | 245 | 24 | "Decimal convert overflow. Cannot convert infinity or NaN " | 246 | 24 | "to decimal"); | 247 | 24 | return false; | 248 | 24 | } | 249 | 356 | using DoubleType = std::conditional_t<IsDecimal256<ToCppT>, long double, double>; | 250 | 356 | DoubleType tmp = from * static_cast<DoubleType>(scale_multiplier); | 251 | 356 | if (tmp <= DoubleType(min_result) || tmp >= DoubleType(max_result)) { | 252 | 12 | if (params.is_strict) { | 253 | 6 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, "float/double", to_precision, | 254 | 6 | to_scale); | 255 | 6 | } | 256 | 12 | return false; | 257 | 12 | } | 258 | 344 | to.value = static_cast<typename ToCppT::NativeType>(static_cast<double>( | 259 | 344 | from * static_cast<DoubleType>(scale_multiplier) + ((from >= 0) ? 0.5 : -0.5))); | 260 | 344 | return true; | 261 | 356 | } |
_ZN5doris13CastToDecimal11_from_floatIdNS_12Decimal128V3EQaaaa15IsDecimalNumberIT0_E14IsCppTypeFloatIT_Ent14IsDecimal128V2IS3_EEEbRKS4_RS3_jjRKNS3_10NativeTypeESA_SA_RNS_14CastParametersE Line | Count | Source | 242 | 372 | CastParameters& params) { | 243 | 372 | if (!std::isfinite(from)) { | 244 | 24 | params.status = Status(ErrorCode::ARITHMETIC_OVERFLOW_ERRROR, | 245 | 24 | "Decimal convert overflow. Cannot convert infinity or NaN " | 246 | 24 | "to decimal"); | 247 | 24 | return false; | 248 | 24 | } | 249 | 348 | using DoubleType = std::conditional_t<IsDecimal256<ToCppT>, long double, double>; | 250 | 348 | DoubleType tmp = from * static_cast<DoubleType>(scale_multiplier); | 251 | 348 | if (tmp <= DoubleType(min_result) || tmp >= DoubleType(max_result)) { | 252 | 12 | if (params.is_strict) { | 253 | 6 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, "float/double", to_precision, | 254 | 6 | to_scale); | 255 | 6 | } | 256 | 12 | return false; | 257 | 12 | } | 258 | 336 | to.value = static_cast<typename ToCppT::NativeType>(static_cast<double>( | 259 | 336 | from * static_cast<DoubleType>(scale_multiplier) + ((from >= 0) ? 0.5 : -0.5))); | 260 | 336 | return true; | 261 | 348 | } |
_ZN5doris13CastToDecimal11_from_floatIfNS_12Decimal128V3EQaaaa15IsDecimalNumberIT0_E14IsCppTypeFloatIT_Ent14IsDecimal128V2IS3_EEEbRKS4_RS3_jjRKNS3_10NativeTypeESA_SA_RNS_14CastParametersE Line | Count | Source | 242 | 444 | CastParameters& params) { | 243 | 444 | if (!std::isfinite(from)) { | 244 | 24 | params.status = Status(ErrorCode::ARITHMETIC_OVERFLOW_ERRROR, | 245 | 24 | "Decimal convert overflow. Cannot convert infinity or NaN " | 246 | 24 | "to decimal"); | 247 | 24 | return false; | 248 | 24 | } | 249 | 420 | using DoubleType = std::conditional_t<IsDecimal256<ToCppT>, long double, double>; | 250 | 420 | DoubleType tmp = from * static_cast<DoubleType>(scale_multiplier); | 251 | 420 | if (tmp <= DoubleType(min_result) || tmp >= DoubleType(max_result)) { | 252 | 12 | if (params.is_strict) { | 253 | 6 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, "float/double", to_precision, | 254 | 6 | to_scale); | 255 | 6 | } | 256 | 12 | return false; | 257 | 12 | } | 258 | 408 | to.value = static_cast<typename ToCppT::NativeType>(static_cast<double>( | 259 | 408 | from * static_cast<DoubleType>(scale_multiplier) + ((from >= 0) ? 0.5 : -0.5))); | 260 | 408 | return true; | 261 | 420 | } |
_ZN5doris13CastToDecimal11_from_floatIdNS_7DecimalIN4wide7integerILm256EiEEEEQaaaa15IsDecimalNumberIT0_E14IsCppTypeFloatIT_Ent14IsDecimal128V2IS7_EEEbRKS8_RS7_jjRKNS7_10NativeTypeESE_SE_RNS_14CastParametersE Line | Count | Source | 242 | 436 | CastParameters& params) { | 243 | 436 | if (!std::isfinite(from)) { | 244 | 24 | params.status = Status(ErrorCode::ARITHMETIC_OVERFLOW_ERRROR, | 245 | 24 | "Decimal convert overflow. Cannot convert infinity or NaN " | 246 | 24 | "to decimal"); | 247 | 24 | return false; | 248 | 24 | } | 249 | 412 | using DoubleType = std::conditional_t<IsDecimal256<ToCppT>, long double, double>; | 250 | 412 | DoubleType tmp = from * static_cast<DoubleType>(scale_multiplier); | 251 | 412 | if (tmp <= DoubleType(min_result) || tmp >= DoubleType(max_result)) { | 252 | 12 | if (params.is_strict) { | 253 | 6 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, "float/double", to_precision, | 254 | 6 | to_scale); | 255 | 6 | } | 256 | 12 | return false; | 257 | 12 | } | 258 | 400 | to.value = static_cast<typename ToCppT::NativeType>(static_cast<double>( | 259 | 400 | from * static_cast<DoubleType>(scale_multiplier) + ((from >= 0) ? 0.5 : -0.5))); | 260 | 400 | return true; | 261 | 412 | } |
_ZN5doris13CastToDecimal11_from_floatIfNS_7DecimalIN4wide7integerILm256EiEEEEQaaaa15IsDecimalNumberIT0_E14IsCppTypeFloatIT_Ent14IsDecimal128V2IS7_EEEbRKS8_RS7_jjRKNS7_10NativeTypeESE_SE_RNS_14CastParametersE Line | Count | Source | 242 | 424 | CastParameters& params) { | 243 | 424 | if (!std::isfinite(from)) { | 244 | 28 | params.status = Status(ErrorCode::ARITHMETIC_OVERFLOW_ERRROR, | 245 | 28 | "Decimal convert overflow. Cannot convert infinity or NaN " | 246 | 28 | "to decimal"); | 247 | 28 | return false; | 248 | 28 | } | 249 | 396 | using DoubleType = std::conditional_t<IsDecimal256<ToCppT>, long double, double>; | 250 | 396 | DoubleType tmp = from * static_cast<DoubleType>(scale_multiplier); | 251 | 396 | if (tmp <= DoubleType(min_result) || tmp >= DoubleType(max_result)) { | 252 | 8 | if (params.is_strict) { | 253 | 4 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, "float/double", to_precision, | 254 | 4 | to_scale); | 255 | 4 | } | 256 | 8 | return false; | 257 | 8 | } | 258 | 388 | to.value = static_cast<typename ToCppT::NativeType>(static_cast<double>( | 259 | 388 | from * static_cast<DoubleType>(scale_multiplier) + ((from >= 0) ? 0.5 : -0.5))); | 260 | 388 | return true; | 261 | 396 | } |
|
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 | 3.33k | CastParameters& params) { |
378 | 3.33k | MaxNativeType tmp; |
379 | 3.33k | if constexpr (multiply_may_overflow) { |
380 | 1.05k | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { |
381 | 154 | if (params.is_strict) { |
382 | 76 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, |
383 | 76 | precision, scale); |
384 | 76 | } |
385 | 154 | return false; |
386 | 154 | } |
387 | 901 | if constexpr (narrow_integral) { |
388 | 901 | if (tmp < min_result || tmp > max_result) { |
389 | 177 | if (params.is_strict) { |
390 | 88 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( |
391 | 88 | from, int_type_name<FromCppT>, precision, scale); |
392 | 88 | } |
393 | 177 | return false; |
394 | 177 | } |
395 | 901 | } |
396 | 724 | to.value = static_cast<typename ToCppT::NativeType>(tmp); |
397 | 2.28k | } else { |
398 | 2.28k | tmp = scale_multiplier * from; |
399 | 2.28k | if constexpr (narrow_integral) { |
400 | 1.42k | if (tmp < min_result || tmp > max_result) { |
401 | 433 | if (params.is_strict) { |
402 | 216 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( |
403 | 216 | from, int_type_name<FromCppT>, precision, scale); |
404 | 216 | } |
405 | 433 | return false; |
406 | 433 | } |
407 | 1.42k | } |
408 | 988 | to.value = static_cast<typename ToCppT::NativeType>(tmp); |
409 | 2.28k | } |
410 | | |
411 | 0 | return true; |
412 | 3.33k | } _ZN5doris13CastToDecimal9_from_intIhNS_7DecimalIiEELb0ELb0EiQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS4_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 377 | 10 | CastParameters& params) { | 378 | 10 | 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 | 10 | } else { | 398 | 10 | 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 | 10 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 409 | 10 | } | 410 | | | 411 | 10 | return true; | 412 | 10 | } |
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 | 4 | CastParameters& params) { | 378 | 4 | MaxNativeType tmp; | 379 | 4 | if constexpr (multiply_may_overflow) { | 380 | 4 | 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 | 4 | if constexpr (narrow_integral) { | 388 | 4 | if (tmp < min_result || tmp > max_result) { | 389 | 2 | if (params.is_strict) { | 390 | 1 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 391 | 1 | from, int_type_name<FromCppT>, precision, scale); | 392 | 1 | } | 393 | 2 | return false; | 394 | 2 | } | 395 | 4 | } | 396 | 2 | 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 | 4 | } |
_ZN5doris13CastToDecimal9_from_intIaNS_7DecimalIiEELb0ELb0EiQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS4_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 377 | 55 | CastParameters& params) { | 378 | 55 | 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 | 55 | } else { | 398 | 55 | 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 | 55 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 409 | 55 | } | 410 | | | 411 | 55 | return true; | 412 | 55 | } |
_ZN5doris13CastToDecimal9_from_intIaNS_7DecimalIiEELb0ELb1EiQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS4_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 377 | 74 | CastParameters& params) { | 378 | 74 | 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 | 74 | } else { | 398 | 74 | tmp = scale_multiplier * from; | 399 | 74 | if constexpr (narrow_integral) { | 400 | 74 | if (tmp < min_result || tmp > max_result) { | 401 | 24 | if (params.is_strict) { | 402 | 12 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 403 | 12 | from, int_type_name<FromCppT>, precision, scale); | 404 | 12 | } | 405 | 24 | return false; | 406 | 24 | } | 407 | 74 | } | 408 | 50 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 409 | 74 | } | 410 | | | 411 | 0 | return true; | 412 | 74 | } |
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 | 22 | CastParameters& params) { | 378 | 22 | MaxNativeType tmp; | 379 | 22 | if constexpr (multiply_may_overflow) { | 380 | 22 | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 381 | 4 | if (params.is_strict) { | 382 | 2 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 383 | 2 | precision, scale); | 384 | 2 | } | 385 | 4 | return false; | 386 | 4 | } | 387 | 18 | if constexpr (narrow_integral) { | 388 | 18 | 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 | 18 | } | 396 | 14 | 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 | 22 | } |
_ZN5doris13CastToDecimal9_from_intIsNS_7DecimalIiEELb0ELb0EiQaaaa15IsDecimalNumberIT0_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_intIsNS_7DecimalIiEELb0ELb1EiQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS4_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 377 | 109 | CastParameters& params) { | 378 | 109 | 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 | 109 | } else { | 398 | 109 | tmp = scale_multiplier * from; | 399 | 109 | if constexpr (narrow_integral) { | 400 | 109 | if (tmp < min_result || tmp > max_result) { | 401 | 33 | if (params.is_strict) { | 402 | 16 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 403 | 16 | from, int_type_name<FromCppT>, precision, scale); | 404 | 16 | } | 405 | 33 | return false; | 406 | 33 | } | 407 | 109 | } | 408 | 76 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 409 | 109 | } | 410 | | | 411 | 0 | return true; | 412 | 109 | } |
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 | 22 | CastParameters& params) { | 378 | 22 | MaxNativeType tmp; | 379 | 22 | if constexpr (multiply_may_overflow) { | 380 | 22 | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 381 | 4 | if (params.is_strict) { | 382 | 2 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 383 | 2 | precision, scale); | 384 | 2 | } | 385 | 4 | return false; | 386 | 4 | } | 387 | 18 | if constexpr (narrow_integral) { | 388 | 18 | 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 | 18 | } | 396 | 14 | 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 | 22 | } |
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 | 90 | CastParameters& params) { | 378 | 90 | 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 | 90 | } else { | 398 | 90 | tmp = scale_multiplier * from; | 399 | 90 | if constexpr (narrow_integral) { | 400 | 90 | if (tmp < min_result || tmp > max_result) { | 401 | 24 | if (params.is_strict) { | 402 | 12 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 403 | 12 | from, int_type_name<FromCppT>, precision, scale); | 404 | 12 | } | 405 | 24 | return false; | 406 | 24 | } | 407 | 90 | } | 408 | 66 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 409 | 90 | } | 410 | | | 411 | 0 | return true; | 412 | 90 | } |
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 | 109 | CastParameters& params) { | 378 | 109 | MaxNativeType tmp; | 379 | 109 | if constexpr (multiply_may_overflow) { | 380 | 109 | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 381 | 17 | if (params.is_strict) { | 382 | 8 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 383 | 8 | precision, scale); | 384 | 8 | } | 385 | 17 | return false; | 386 | 17 | } | 387 | 92 | if constexpr (narrow_integral) { | 388 | 92 | if (tmp < min_result || tmp > max_result) { | 389 | 16 | if (params.is_strict) { | 390 | 8 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 391 | 8 | from, int_type_name<FromCppT>, precision, scale); | 392 | 8 | } | 393 | 16 | return false; | 394 | 16 | } | 395 | 92 | } | 396 | 76 | 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 | 109 | } |
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 | 90 | CastParameters& params) { | 378 | 90 | 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 | 90 | } else { | 398 | 90 | tmp = scale_multiplier * from; | 399 | 90 | if constexpr (narrow_integral) { | 400 | 90 | if (tmp < min_result || tmp > max_result) { | 401 | 24 | if (params.is_strict) { | 402 | 12 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 403 | 12 | from, int_type_name<FromCppT>, precision, scale); | 404 | 12 | } | 405 | 24 | return false; | 406 | 24 | } | 407 | 90 | } | 408 | 66 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 409 | 90 | } | 410 | | | 411 | 0 | return true; | 412 | 90 | } |
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 | 109 | CastParameters& params) { | 378 | 109 | MaxNativeType tmp; | 379 | 109 | if constexpr (multiply_may_overflow) { | 380 | 109 | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 381 | 17 | if (params.is_strict) { | 382 | 8 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 383 | 8 | precision, scale); | 384 | 8 | } | 385 | 17 | return false; | 386 | 17 | } | 387 | 92 | if constexpr (narrow_integral) { | 388 | 92 | if (tmp < min_result || tmp > max_result) { | 389 | 16 | if (params.is_strict) { | 390 | 8 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 391 | 8 | from, int_type_name<FromCppT>, precision, scale); | 392 | 8 | } | 393 | 16 | return false; | 394 | 16 | } | 395 | 92 | } | 396 | 76 | 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 | 109 | } |
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 | 90 | CastParameters& params) { | 378 | 90 | 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 | 90 | } else { | 398 | 90 | tmp = scale_multiplier * from; | 399 | 90 | if constexpr (narrow_integral) { | 400 | 90 | if (tmp < min_result || tmp > max_result) { | 401 | 24 | if (params.is_strict) { | 402 | 12 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 403 | 12 | from, int_type_name<FromCppT>, precision, scale); | 404 | 12 | } | 405 | 24 | return false; | 406 | 24 | } | 407 | 90 | } | 408 | 66 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 409 | 90 | } | 410 | | | 411 | 0 | return true; | 412 | 90 | } |
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 | 109 | CastParameters& params) { | 378 | 109 | MaxNativeType tmp; | 379 | 109 | if constexpr (multiply_may_overflow) { | 380 | 109 | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 381 | 16 | if (params.is_strict) { | 382 | 8 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 383 | 8 | precision, scale); | 384 | 8 | } | 385 | 16 | return false; | 386 | 16 | } | 387 | 93 | if constexpr (narrow_integral) { | 388 | 93 | if (tmp < min_result || tmp > max_result) { | 389 | 17 | if (params.is_strict) { | 390 | 8 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 391 | 8 | from, int_type_name<FromCppT>, precision, scale); | 392 | 8 | } | 393 | 17 | return false; | 394 | 17 | } | 395 | 93 | } | 396 | 76 | 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 | 109 | } |
_ZN5doris13CastToDecimal9_from_intIhNS_7DecimalIlEELb0ELb0ElQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS4_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 377 | 8 | CastParameters& params) { | 378 | 8 | 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 | 8 | } else { | 398 | 8 | 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 | 8 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 409 | 8 | } | 410 | | | 411 | 8 | return true; | 412 | 8 | } |
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 | 4 | CastParameters& params) { | 378 | 4 | MaxNativeType tmp; | 379 | 4 | if constexpr (multiply_may_overflow) { | 380 | 4 | 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 | 4 | if constexpr (narrow_integral) { | 388 | 4 | if (tmp < min_result || tmp > max_result) { | 389 | 2 | if (params.is_strict) { | 390 | 1 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 391 | 1 | from, int_type_name<FromCppT>, precision, scale); | 392 | 1 | } | 393 | 2 | return false; | 394 | 2 | } | 395 | 4 | } | 396 | 2 | 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 | 4 | } |
_ZN5doris13CastToDecimal9_from_intIaNS_7DecimalIlEELb0ELb0ElQaaaa15IsDecimalNumberIT0_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_intIaNS_7DecimalIlEELb0ELb1ElQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS4_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 377 | 44 | CastParameters& params) { | 378 | 44 | 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 | 44 | } else { | 398 | 44 | tmp = scale_multiplier * from; | 399 | 44 | if constexpr (narrow_integral) { | 400 | 44 | if (tmp < min_result || tmp > max_result) { | 401 | 16 | if (params.is_strict) { | 402 | 8 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 403 | 8 | from, int_type_name<FromCppT>, precision, scale); | 404 | 8 | } | 405 | 16 | return false; | 406 | 16 | } | 407 | 44 | } | 408 | 28 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 409 | 44 | } | 410 | | | 411 | 0 | return true; | 412 | 44 | } |
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 | 22 | CastParameters& params) { | 378 | 22 | MaxNativeType tmp; | 379 | 22 | if constexpr (multiply_may_overflow) { | 380 | 22 | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 381 | 4 | if (params.is_strict) { | 382 | 2 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 383 | 2 | precision, scale); | 384 | 2 | } | 385 | 4 | return false; | 386 | 4 | } | 387 | 18 | if constexpr (narrow_integral) { | 388 | 18 | 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 | 18 | } | 396 | 14 | 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 | 22 | } |
_ZN5doris13CastToDecimal9_from_intIsNS_7DecimalIlEELb0ELb0ElQaaaa15IsDecimalNumberIT0_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_7DecimalIlEELb0ELb1ElQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS4_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 377 | 44 | CastParameters& params) { | 378 | 44 | 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 | 44 | } else { | 398 | 44 | tmp = scale_multiplier * from; | 399 | 44 | if constexpr (narrow_integral) { | 400 | 44 | if (tmp < min_result || tmp > max_result) { | 401 | 16 | if (params.is_strict) { | 402 | 8 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 403 | 8 | from, int_type_name<FromCppT>, precision, scale); | 404 | 8 | } | 405 | 16 | return false; | 406 | 16 | } | 407 | 44 | } | 408 | 28 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 409 | 44 | } | 410 | | | 411 | 0 | return true; | 412 | 44 | } |
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 | 22 | CastParameters& params) { | 378 | 22 | MaxNativeType tmp; | 379 | 22 | if constexpr (multiply_may_overflow) { | 380 | 22 | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 381 | 4 | if (params.is_strict) { | 382 | 2 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 383 | 2 | precision, scale); | 384 | 2 | } | 385 | 4 | return false; | 386 | 4 | } | 387 | 18 | if constexpr (narrow_integral) { | 388 | 18 | 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 | 18 | } | 396 | 14 | 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 | 22 | } |
_ZN5doris13CastToDecimal9_from_intIiNS_7DecimalIlEELb0ELb0ElQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS4_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 377 | 18 | CastParameters& params) { | 378 | 18 | 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 | 18 | } else { | 398 | 18 | 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 | 18 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 409 | 18 | } | 410 | | | 411 | 18 | return true; | 412 | 18 | } |
_ZN5doris13CastToDecimal9_from_intIiNS_7DecimalIlEELb0ELb1ElQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS4_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 377 | 112 | CastParameters& params) { | 378 | 112 | 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 | 112 | } else { | 398 | 112 | tmp = scale_multiplier * from; | 399 | 112 | if constexpr (narrow_integral) { | 400 | 112 | 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 | 112 | } | 408 | 80 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 409 | 112 | } | 410 | | | 411 | 0 | return true; | 412 | 112 | } |
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 | 56 | CastParameters& params) { | 378 | 56 | MaxNativeType tmp; | 379 | 56 | if constexpr (multiply_may_overflow) { | 380 | 56 | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 381 | 4 | if (params.is_strict) { | 382 | 2 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 383 | 2 | precision, scale); | 384 | 2 | } | 385 | 4 | return false; | 386 | 4 | } | 387 | 52 | if constexpr (narrow_integral) { | 388 | 52 | if (tmp < min_result || tmp > max_result) { | 389 | 12 | if (params.is_strict) { | 390 | 6 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 391 | 6 | from, int_type_name<FromCppT>, precision, scale); | 392 | 6 | } | 393 | 12 | return false; | 394 | 12 | } | 395 | 52 | } | 396 | 40 | 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 | 56 | } |
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 | 90 | CastParameters& params) { | 378 | 90 | 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 | 90 | } else { | 398 | 90 | tmp = scale_multiplier * from; | 399 | 90 | if constexpr (narrow_integral) { | 400 | 90 | if (tmp < min_result || tmp > max_result) { | 401 | 24 | if (params.is_strict) { | 402 | 12 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 403 | 12 | from, int_type_name<FromCppT>, precision, scale); | 404 | 12 | } | 405 | 24 | return false; | 406 | 24 | } | 407 | 90 | } | 408 | 66 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 409 | 90 | } | 410 | | | 411 | 0 | return true; | 412 | 90 | } |
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 | 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 | 16 | if (params.is_strict) { | 382 | 8 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 383 | 8 | precision, scale); | 384 | 8 | } | 385 | 16 | return false; | 386 | 16 | } | 387 | 96 | if constexpr (narrow_integral) { | 388 | 96 | if (tmp < min_result || tmp > max_result) { | 389 | 16 | if (params.is_strict) { | 390 | 8 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 391 | 8 | from, int_type_name<FromCppT>, precision, scale); | 392 | 8 | } | 393 | 16 | return false; | 394 | 16 | } | 395 | 96 | } | 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_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 | 90 | CastParameters& params) { | 378 | 90 | 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 | 90 | } else { | 398 | 90 | tmp = scale_multiplier * from; | 399 | 90 | if constexpr (narrow_integral) { | 400 | 90 | if (tmp < min_result || tmp > max_result) { | 401 | 24 | if (params.is_strict) { | 402 | 12 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 403 | 12 | from, int_type_name<FromCppT>, precision, scale); | 404 | 12 | } | 405 | 24 | return false; | 406 | 24 | } | 407 | 90 | } | 408 | 66 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 409 | 90 | } | 410 | | | 411 | 0 | return true; | 412 | 90 | } |
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 | 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 | 16 | if (params.is_strict) { | 382 | 8 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 383 | 8 | precision, scale); | 384 | 8 | } | 385 | 16 | return false; | 386 | 16 | } | 387 | 96 | if constexpr (narrow_integral) { | 388 | 96 | if (tmp < min_result || tmp > max_result) { | 389 | 16 | if (params.is_strict) { | 390 | 8 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 391 | 8 | from, int_type_name<FromCppT>, precision, scale); | 392 | 8 | } | 393 | 16 | return false; | 394 | 16 | } | 395 | 96 | } | 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 | } |
_ZN5doris13CastToDecimal9_from_intIhNS_12Decimal128V3ELb0ELb0EnQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS3_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRKT3_RKNS3_10NativeTypeESD_RNS_14CastParametersE Line | Count | Source | 377 | 8 | CastParameters& params) { | 378 | 8 | 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 | 8 | } else { | 398 | 8 | 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 | 8 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 409 | 8 | } | 410 | | | 411 | 8 | return true; | 412 | 8 | } |
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 | 4 | CastParameters& params) { | 378 | 4 | MaxNativeType tmp; | 379 | 4 | if constexpr (multiply_may_overflow) { | 380 | 4 | 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 | 4 | if constexpr (narrow_integral) { | 388 | 4 | if (tmp < min_result || tmp > max_result) { | 389 | 2 | if (params.is_strict) { | 390 | 1 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 391 | 1 | from, int_type_name<FromCppT>, precision, scale); | 392 | 1 | } | 393 | 2 | return false; | 394 | 2 | } | 395 | 4 | } | 396 | 2 | 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 | 4 | } |
_ZN5doris13CastToDecimal9_from_intIaNS_12Decimal128V3ELb0ELb0EnQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS3_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRKT3_RKNS3_10NativeTypeESD_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_intIaNS_12Decimal128V3ELb0ELb1EnQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS3_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRKT3_RKNS3_10NativeTypeESD_RNS_14CastParametersE Line | Count | Source | 377 | 44 | CastParameters& params) { | 378 | 44 | 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 | 44 | } else { | 398 | 44 | tmp = scale_multiplier * from; | 399 | 44 | if constexpr (narrow_integral) { | 400 | 44 | if (tmp < min_result || tmp > max_result) { | 401 | 16 | if (params.is_strict) { | 402 | 8 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 403 | 8 | from, int_type_name<FromCppT>, precision, scale); | 404 | 8 | } | 405 | 16 | return false; | 406 | 16 | } | 407 | 44 | } | 408 | 28 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 409 | 44 | } | 410 | | | 411 | 0 | return true; | 412 | 44 | } |
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 | 22 | CastParameters& params) { | 378 | 22 | MaxNativeType tmp; | 379 | 22 | if constexpr (multiply_may_overflow) { | 380 | 22 | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 381 | 4 | if (params.is_strict) { | 382 | 2 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 383 | 2 | precision, scale); | 384 | 2 | } | 385 | 4 | return false; | 386 | 4 | } | 387 | 18 | if constexpr (narrow_integral) { | 388 | 18 | 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 | 18 | } | 396 | 14 | 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 | 22 | } |
_ZN5doris13CastToDecimal9_from_intIsNS_12Decimal128V3ELb0ELb0EnQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS3_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRKT3_RKNS3_10NativeTypeESD_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_12Decimal128V3ELb0ELb1EnQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS3_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRKT3_RKNS3_10NativeTypeESD_RNS_14CastParametersE Line | Count | Source | 377 | 44 | CastParameters& params) { | 378 | 44 | 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 | 44 | } else { | 398 | 44 | tmp = scale_multiplier * from; | 399 | 44 | if constexpr (narrow_integral) { | 400 | 44 | if (tmp < min_result || tmp > max_result) { | 401 | 16 | if (params.is_strict) { | 402 | 8 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 403 | 8 | from, int_type_name<FromCppT>, precision, scale); | 404 | 8 | } | 405 | 16 | return false; | 406 | 16 | } | 407 | 44 | } | 408 | 28 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 409 | 44 | } | 410 | | | 411 | 0 | return true; | 412 | 44 | } |
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 | 22 | CastParameters& params) { | 378 | 22 | MaxNativeType tmp; | 379 | 22 | if constexpr (multiply_may_overflow) { | 380 | 22 | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 381 | 4 | if (params.is_strict) { | 382 | 2 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 383 | 2 | precision, scale); | 384 | 2 | } | 385 | 4 | return false; | 386 | 4 | } | 387 | 18 | if constexpr (narrow_integral) { | 388 | 18 | 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 | 18 | } | 396 | 14 | 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 | 22 | } |
_ZN5doris13CastToDecimal9_from_intIiNS_12Decimal128V3ELb0ELb0EnQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS3_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRKT3_RKNS3_10NativeTypeESD_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_intIiNS_12Decimal128V3ELb0ELb1EnQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS3_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRKT3_RKNS3_10NativeTypeESD_RNS_14CastParametersE Line | Count | Source | 377 | 44 | CastParameters& params) { | 378 | 44 | 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 | 44 | } else { | 398 | 44 | tmp = scale_multiplier * from; | 399 | 44 | if constexpr (narrow_integral) { | 400 | 44 | if (tmp < min_result || tmp > max_result) { | 401 | 16 | if (params.is_strict) { | 402 | 8 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 403 | 8 | from, int_type_name<FromCppT>, precision, scale); | 404 | 8 | } | 405 | 16 | return false; | 406 | 16 | } | 407 | 44 | } | 408 | 28 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 409 | 44 | } | 410 | | | 411 | 0 | return true; | 412 | 44 | } |
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 | 22 | CastParameters& params) { | 378 | 22 | MaxNativeType tmp; | 379 | 22 | if constexpr (multiply_may_overflow) { | 380 | 22 | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 381 | 4 | if (params.is_strict) { | 382 | 2 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 383 | 2 | precision, scale); | 384 | 2 | } | 385 | 4 | return false; | 386 | 4 | } | 387 | 18 | if constexpr (narrow_integral) { | 388 | 18 | 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 | 18 | } | 396 | 14 | 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 | 22 | } |
_ZN5doris13CastToDecimal9_from_intIlNS_12Decimal128V3ELb0ELb0EnQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS3_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRKT3_RKNS3_10NativeTypeESD_RNS_14CastParametersE Line | Count | Source | 377 | 54 | CastParameters& params) { | 378 | 54 | 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 | 54 | } else { | 398 | 54 | 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 | 54 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 409 | 54 | } | 410 | | | 411 | 54 | return true; | 412 | 54 | } |
_ZN5doris13CastToDecimal9_from_intIlNS_12Decimal128V3ELb0ELb1EnQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS3_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRKT3_RKNS3_10NativeTypeESD_RNS_14CastParametersE Line | Count | Source | 377 | 78 | CastParameters& params) { | 378 | 78 | 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 | 78 | } else { | 398 | 78 | tmp = scale_multiplier * from; | 399 | 78 | if constexpr (narrow_integral) { | 400 | 78 | if (tmp < min_result || tmp > max_result) { | 401 | 24 | if (params.is_strict) { | 402 | 12 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 403 | 12 | from, int_type_name<FromCppT>, precision, scale); | 404 | 12 | } | 405 | 24 | return false; | 406 | 24 | } | 407 | 78 | } | 408 | 54 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 409 | 78 | } | 410 | | | 411 | 0 | return true; | 412 | 78 | } |
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 | 22 | CastParameters& params) { | 378 | 22 | MaxNativeType tmp; | 379 | 22 | if constexpr (multiply_may_overflow) { | 380 | 22 | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 381 | 4 | if (params.is_strict) { | 382 | 2 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 383 | 2 | precision, scale); | 384 | 2 | } | 385 | 4 | return false; | 386 | 4 | } | 387 | 18 | if constexpr (narrow_integral) { | 388 | 18 | 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 | 18 | } | 396 | 14 | 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 | 22 | } |
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 | 90 | CastParameters& params) { | 378 | 90 | 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 | 90 | } else { | 398 | 90 | tmp = scale_multiplier * from; | 399 | 90 | if constexpr (narrow_integral) { | 400 | 90 | if (tmp < min_result || tmp > max_result) { | 401 | 24 | if (params.is_strict) { | 402 | 12 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 403 | 12 | from, int_type_name<FromCppT>, precision, scale); | 404 | 12 | } | 405 | 24 | return false; | 406 | 24 | } | 407 | 90 | } | 408 | 66 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 409 | 90 | } | 410 | | | 411 | 0 | return true; | 412 | 90 | } |
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 | 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 | 16 | if (params.is_strict) { | 382 | 8 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 383 | 8 | precision, scale); | 384 | 8 | } | 385 | 16 | return false; | 386 | 16 | } | 387 | 96 | if constexpr (narrow_integral) { | 388 | 96 | if (tmp < min_result || tmp > max_result) { | 389 | 16 | if (params.is_strict) { | 390 | 8 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 391 | 8 | from, int_type_name<FromCppT>, precision, scale); | 392 | 8 | } | 393 | 16 | return false; | 394 | 16 | } | 395 | 96 | } | 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 | } |
_ZN5doris13CastToDecimal9_from_intIhNS_7DecimalIN4wide7integerILm256EiEEEELb0ELb0ES5_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 | | 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 | 8 | } else { | 398 | 8 | 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 | 8 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 409 | 8 | } | 410 | | | 411 | 8 | return true; | 412 | 8 | } |
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 | 4 | CastParameters& params) { | 378 | 4 | MaxNativeType tmp; | 379 | 4 | if constexpr (multiply_may_overflow) { | 380 | 4 | 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 | 4 | if constexpr (narrow_integral) { | 388 | 4 | if (tmp < min_result || tmp > max_result) { | 389 | 2 | if (params.is_strict) { | 390 | 1 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 391 | 1 | from, int_type_name<FromCppT>, precision, scale); | 392 | 1 | } | 393 | 2 | return false; | 394 | 2 | } | 395 | 4 | } | 396 | 2 | 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 | 4 | } |
_ZN5doris13CastToDecimal9_from_intIaNS_7DecimalIN4wide7integerILm256EiEEEELb0ELb0ES5_Qaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS7_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS8_hEEEbRKS8_RS7_jjRKT3_RKNS7_10NativeTypeESH_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_intIaNS_7DecimalIN4wide7integerILm256EiEEEELb0ELb1ES5_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 | | 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 | 44 | } else { | 398 | 44 | tmp = scale_multiplier * from; | 399 | 44 | if constexpr (narrow_integral) { | 400 | 44 | if (tmp < min_result || tmp > max_result) { | 401 | 16 | if (params.is_strict) { | 402 | 8 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 403 | 8 | from, int_type_name<FromCppT>, precision, scale); | 404 | 8 | } | 405 | 16 | return false; | 406 | 16 | } | 407 | 44 | } | 408 | 28 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 409 | 44 | } | 410 | | | 411 | 0 | return true; | 412 | 44 | } |
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 | 22 | CastParameters& params) { | 378 | 22 | MaxNativeType tmp; | 379 | 22 | if constexpr (multiply_may_overflow) { | 380 | 22 | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 381 | 4 | if (params.is_strict) { | 382 | 2 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 383 | 2 | precision, scale); | 384 | 2 | } | 385 | 4 | return false; | 386 | 4 | } | 387 | 18 | if constexpr (narrow_integral) { | 388 | 18 | 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 | 18 | } | 396 | 14 | 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 | 22 | } |
_ZN5doris13CastToDecimal9_from_intIsNS_7DecimalIN4wide7integerILm256EiEEEELb0ELb0ES5_Qaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS7_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS8_hEEEbRKS8_RS7_jjRKT3_RKNS7_10NativeTypeESH_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_7DecimalIN4wide7integerILm256EiEEEELb0ELb1ES5_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 | | 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 | 44 | } else { | 398 | 44 | tmp = scale_multiplier * from; | 399 | 44 | if constexpr (narrow_integral) { | 400 | 44 | if (tmp < min_result || tmp > max_result) { | 401 | 16 | if (params.is_strict) { | 402 | 8 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 403 | 8 | from, int_type_name<FromCppT>, precision, scale); | 404 | 8 | } | 405 | 16 | return false; | 406 | 16 | } | 407 | 44 | } | 408 | 28 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 409 | 44 | } | 410 | | | 411 | 0 | return true; | 412 | 44 | } |
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 | 22 | CastParameters& params) { | 378 | 22 | MaxNativeType tmp; | 379 | 22 | if constexpr (multiply_may_overflow) { | 380 | 22 | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 381 | 4 | if (params.is_strict) { | 382 | 2 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 383 | 2 | precision, scale); | 384 | 2 | } | 385 | 4 | return false; | 386 | 4 | } | 387 | 18 | if constexpr (narrow_integral) { | 388 | 18 | 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 | 18 | } | 396 | 14 | 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 | 22 | } |
_ZN5doris13CastToDecimal9_from_intIiNS_7DecimalIN4wide7integerILm256EiEEEELb0ELb0ES5_Qaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS7_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS8_hEEEbRKS8_RS7_jjRKT3_RKNS7_10NativeTypeESH_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_intIiNS_7DecimalIN4wide7integerILm256EiEEEELb0ELb1ES5_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 | | 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 | 44 | } else { | 398 | 44 | tmp = scale_multiplier * from; | 399 | 44 | if constexpr (narrow_integral) { | 400 | 44 | if (tmp < min_result || tmp > max_result) { | 401 | 16 | if (params.is_strict) { | 402 | 8 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 403 | 8 | from, int_type_name<FromCppT>, precision, scale); | 404 | 8 | } | 405 | 16 | return false; | 406 | 16 | } | 407 | 44 | } | 408 | 28 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 409 | 44 | } | 410 | | | 411 | 0 | return true; | 412 | 44 | } |
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 | 22 | CastParameters& params) { | 378 | 22 | MaxNativeType tmp; | 379 | 22 | if constexpr (multiply_may_overflow) { | 380 | 22 | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 381 | 4 | if (params.is_strict) { | 382 | 2 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 383 | 2 | precision, scale); | 384 | 2 | } | 385 | 4 | return false; | 386 | 4 | } | 387 | 18 | if constexpr (narrow_integral) { | 388 | 18 | 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 | 18 | } | 396 | 14 | 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 | 22 | } |
_ZN5doris13CastToDecimal9_from_intIlNS_7DecimalIN4wide7integerILm256EiEEEELb0ELb0ES5_Qaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS7_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS8_hEEEbRKS8_RS7_jjRKT3_RKNS7_10NativeTypeESH_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_intIlNS_7DecimalIN4wide7integerILm256EiEEEELb0ELb1ES5_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 | | 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 | 44 | } else { | 398 | 44 | tmp = scale_multiplier * from; | 399 | 44 | if constexpr (narrow_integral) { | 400 | 44 | if (tmp < min_result || tmp > max_result) { | 401 | 16 | if (params.is_strict) { | 402 | 8 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 403 | 8 | from, int_type_name<FromCppT>, precision, scale); | 404 | 8 | } | 405 | 16 | return false; | 406 | 16 | } | 407 | 44 | } | 408 | 28 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 409 | 44 | } | 410 | | | 411 | 0 | return true; | 412 | 44 | } |
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 | 22 | CastParameters& params) { | 378 | 22 | MaxNativeType tmp; | 379 | 22 | if constexpr (multiply_may_overflow) { | 380 | 22 | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 381 | 4 | if (params.is_strict) { | 382 | 2 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 383 | 2 | precision, scale); | 384 | 2 | } | 385 | 4 | return false; | 386 | 4 | } | 387 | 18 | if constexpr (narrow_integral) { | 388 | 18 | 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 | 18 | } | 396 | 14 | 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 | 22 | } |
_ZN5doris13CastToDecimal9_from_intInNS_7DecimalIN4wide7integerILm256EiEEEELb0ELb0ES5_Qaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS7_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS8_hEEEbRKS8_RS7_jjRKT3_RKNS7_10NativeTypeESH_RNS_14CastParametersE Line | Count | Source | 377 | 18 | CastParameters& params) { | 378 | 18 | 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 | 18 | } else { | 398 | 18 | 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 | 18 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 409 | 18 | } | 410 | | | 411 | 18 | return true; | 412 | 18 | } |
_ZN5doris13CastToDecimal9_from_intInNS_7DecimalIN4wide7integerILm256EiEEEELb0ELb1ES5_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 | | 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 | 112 | } else { | 398 | 112 | tmp = scale_multiplier * from; | 399 | 112 | if constexpr (narrow_integral) { | 400 | 112 | 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 | 112 | } | 408 | 80 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 409 | 112 | } | 410 | | | 411 | 0 | return true; | 412 | 112 | } |
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 | 56 | CastParameters& params) { | 378 | 56 | MaxNativeType tmp; | 379 | 56 | if constexpr (multiply_may_overflow) { | 380 | 56 | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 381 | 4 | if (params.is_strict) { | 382 | 2 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 383 | 2 | precision, scale); | 384 | 2 | } | 385 | 4 | return false; | 386 | 4 | } | 387 | 52 | if constexpr (narrow_integral) { | 388 | 52 | if (tmp < min_result || tmp > max_result) { | 389 | 12 | if (params.is_strict) { | 390 | 6 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 391 | 6 | from, int_type_name<FromCppT>, precision, scale); | 392 | 6 | } | 393 | 12 | return false; | 394 | 12 | } | 395 | 52 | } | 396 | 40 | 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 | 56 | } |
|
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 | 6 | CastParameters& params) { |
424 | 6 | MaxNativeType tmp; |
425 | 6 | 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 | 6 | } else { |
444 | 6 | tmp = scale_multiplier * from; |
445 | 6 | if constexpr (narrow_integral) { |
446 | 4 | if (tmp < min_result || tmp > max_result) { |
447 | 2 | if (params.is_strict) { |
448 | 1 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( |
449 | 1 | from, int_type_name<FromCppT>, precision, scale); |
450 | 1 | } |
451 | 2 | return false; |
452 | 2 | } |
453 | 4 | } |
454 | 2 | to = DecimalV2Value(static_cast<typename ToCppT::NativeType>(tmp)); |
455 | 6 | } |
456 | | |
457 | 0 | return true; |
458 | 6 | } _ZN5doris13CastToDecimal9_from_intIhNS_14DecimalV2ValueELb0ELb0EnQaa11IsDecimalV2IT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRKT3_RKNS3_10NativeTypeESD_RNS_14CastParametersE Line | Count | Source | 423 | 2 | CastParameters& params) { | 424 | 2 | 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 | 2 | } else { | 444 | 2 | 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 | 2 | to = DecimalV2Value(static_cast<typename ToCppT::NativeType>(tmp)); | 455 | 2 | } | 456 | | | 457 | 2 | return true; | 458 | 2 | } |
_ZN5doris13CastToDecimal9_from_intIhNS_14DecimalV2ValueELb0ELb1EnQaa11IsDecimalV2IT0_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 | 4 | if constexpr (narrow_integral) { | 446 | 4 | if (tmp < min_result || tmp > max_result) { | 447 | 2 | if (params.is_strict) { | 448 | 1 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 449 | 1 | from, int_type_name<FromCppT>, precision, scale); | 450 | 1 | } | 451 | 2 | return false; | 452 | 2 | } | 453 | 4 | } | 454 | 2 | to = DecimalV2Value(static_cast<typename ToCppT::NativeType>(tmp)); | 455 | 4 | } | 456 | | | 457 | 0 | return true; | 458 | 4 | } |
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 | 4.59k | const typename ToCppT::NativeType& max_result, CastParameters& params) { |
475 | 4.59k | MaxNativeType res; |
476 | 4.59k | if constexpr (multiply_may_overflow) { |
477 | 2.65k | if constexpr (IsDecimal128V2<FromCppT>) { |
478 | 357 | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, |
479 | 357 | res)) { |
480 | 28 | if (params.is_strict) { |
481 | 6 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( |
482 | 6 | decimal_to_string(from.value(), scale_from), |
483 | 6 | fmt::format("decimal({}, {})", precision_from, scale_from), |
484 | 6 | precision_to, scale_to); |
485 | 6 | } |
486 | 28 | return false; |
487 | 329 | } else { |
488 | 329 | if (UNLIKELY(res > max_result || res < -max_result)) { |
489 | 80 | 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 | 80 | return false; |
496 | 249 | } else { |
497 | 249 | to = ToCppT(res); |
498 | 249 | } |
499 | 329 | } |
500 | 2.29k | } else { |
501 | 2.29k | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, |
502 | 2.29k | res)) { |
503 | 359 | if (params.is_strict) { |
504 | 30 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( |
505 | 30 | decimal_to_string(from.value, scale_from), |
506 | 30 | fmt::format("decimal({}, {})", precision_from, scale_from), |
507 | 30 | precision_to, scale_to); |
508 | 30 | } |
509 | 359 | return false; |
510 | 1.93k | } else { |
511 | 1.93k | if (UNLIKELY(res > max_result || res < -max_result)) { |
512 | 889 | if (params.is_strict) { |
513 | 594 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( |
514 | 594 | decimal_to_string(from.value, scale_from), |
515 | 594 | fmt::format("decimal({}, {})", precision_from, scale_from), |
516 | 594 | precision_to, scale_to); |
517 | 594 | } |
518 | 889 | return false; |
519 | 1.04k | } else { |
520 | 1.04k | to = ToCppT(res); |
521 | 1.04k | } |
522 | 1.93k | } |
523 | 2.29k | } |
524 | 2.65k | } else { |
525 | 1.94k | if constexpr (IsDecimal128V2<FromCppT>) { |
526 | 212 | res = from.value() * scale_multiplier; |
527 | 1.73k | } else { |
528 | 1.73k | res = from.value * scale_multiplier; |
529 | 1.73k | } |
530 | 1.94k | if constexpr (narrow_integral) { |
531 | 884 | if (UNLIKELY(res > max_result || res < -max_result)) { |
532 | 414 | 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 | 354 | } else { |
540 | 354 | if (params.is_strict) { |
541 | 177 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( |
542 | 177 | decimal_to_string(from.value, scale_from), |
543 | 177 | fmt::format("decimal({}, {})", precision_from, scale_from), |
544 | 177 | precision_to, scale_to); |
545 | 177 | } |
546 | 354 | } |
547 | 414 | return false; |
548 | 414 | } |
549 | 884 | } |
550 | 470 | to = ToCppT(res); |
551 | 1.94k | } |
552 | 1.29k | return true; |
553 | 4.59k | } _ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_7DecimalIiEES3_Lb0ELb0EiQaa15IsDecimalNumberIT0_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 | | 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 | 14 | to = ToCppT(res); | 551 | 14 | } | 552 | 14 | return true; | 553 | 14 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_7DecimalIiEES3_Lb0ELb1EiQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 474 | 7 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 475 | 7 | 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 | 7 | } else { | 525 | | if constexpr (IsDecimal128V2<FromCppT>) { | 526 | | res = from.value() * scale_multiplier; | 527 | 7 | } else { | 528 | 7 | res = from.value * scale_multiplier; | 529 | 7 | } | 530 | 7 | if constexpr (narrow_integral) { | 531 | 7 | 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 | 6 | } else { | 540 | 6 | if (params.is_strict) { | 541 | 3 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 542 | 3 | decimal_to_string(from.value, scale_from), | 543 | 3 | fmt::format("decimal({}, {})", precision_from, scale_from), | 544 | 3 | precision_to, scale_to); | 545 | 3 | } | 546 | 6 | } | 547 | 6 | return false; | 548 | 6 | } | 549 | 7 | } | 550 | 1 | to = ToCppT(res); | 551 | 7 | } | 552 | 0 | return true; | 553 | 7 | } |
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 | 84 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 475 | 84 | MaxNativeType res; | 476 | 84 | 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 | 84 | } else { | 501 | 84 | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 502 | 84 | res)) { | 503 | 16 | 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 | 16 | return false; | 510 | 68 | } else { | 511 | 68 | 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 | 36 | } else { | 520 | 36 | to = ToCppT(res); | 521 | 36 | } | 522 | 68 | } | 523 | 84 | } | 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 | 36 | return true; | 553 | 84 | } |
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 | 126 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 475 | 126 | MaxNativeType res; | 476 | 126 | 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 | 126 | } else { | 501 | 126 | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 502 | 126 | res)) { | 503 | 14 | 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 | 14 | return false; | 510 | 112 | } else { | 511 | 112 | if (UNLIKELY(res > max_result || res < -max_result)) { | 512 | 58 | 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 | 58 | return false; | 519 | 58 | } else { | 520 | 54 | to = ToCppT(res); | 521 | 54 | } | 522 | 112 | } | 523 | 126 | } | 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 | 54 | return true; | 553 | 126 | } |
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 | 126 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 475 | 126 | MaxNativeType res; | 476 | 126 | 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 | 126 | } else { | 501 | 126 | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 502 | 126 | res)) { | 503 | 12 | 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 | 12 | return false; | 510 | 114 | } else { | 511 | 114 | if (UNLIKELY(res > max_result || res < -max_result)) { | 512 | 60 | 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 | 60 | return false; | 519 | 60 | } else { | 520 | 54 | to = ToCppT(res); | 521 | 54 | } | 522 | 114 | } | 523 | 126 | } | 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 | 54 | return true; | 553 | 126 | } |
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 | 126 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 475 | 126 | MaxNativeType res; | 476 | 126 | 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 | 126 | } else { | 501 | 126 | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 502 | 126 | res)) { | 503 | 12 | 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 | 12 | return false; | 510 | 114 | } else { | 511 | 114 | if (UNLIKELY(res > max_result || res < -max_result)) { | 512 | 60 | 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 | 60 | return false; | 519 | 60 | } else { | 520 | 54 | to = ToCppT(res); | 521 | 54 | } | 522 | 114 | } | 523 | 126 | } | 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 | 54 | return true; | 553 | 126 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_7DecimalIiEENS2_IlEELb0ELb0ElQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKT3_RKNS5_10NativeTypeESF_RNS_14CastParametersE Line | Count | Source | 474 | 112 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 475 | 112 | 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 | 112 | } else { | 525 | | if constexpr (IsDecimal128V2<FromCppT>) { | 526 | | res = from.value() * scale_multiplier; | 527 | 112 | } else { | 528 | 112 | res = from.value * scale_multiplier; | 529 | 112 | } | 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 | 112 | to = ToCppT(res); | 551 | 112 | } | 552 | 112 | return true; | 553 | 112 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_7DecimalIiEENS2_IlEELb0ELb1ElQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKT3_RKNS5_10NativeTypeESF_RNS_14CastParametersE Line | Count | Source | 474 | 58 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 475 | 58 | 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 | 58 | } else { | 525 | | if constexpr (IsDecimal128V2<FromCppT>) { | 526 | | res = from.value() * scale_multiplier; | 527 | 58 | } else { | 528 | 58 | res = from.value * scale_multiplier; | 529 | 58 | } | 530 | 58 | if constexpr (narrow_integral) { | 531 | 58 | 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 | 30 | } else { | 540 | 30 | if (params.is_strict) { | 541 | 15 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 542 | 15 | decimal_to_string(from.value, scale_from), | 543 | 15 | fmt::format("decimal({}, {})", precision_from, scale_from), | 544 | 15 | precision_to, scale_to); | 545 | 15 | } | 546 | 30 | } | 547 | 30 | return false; | 548 | 30 | } | 549 | 58 | } | 550 | 28 | to = ToCppT(res); | 551 | 58 | } | 552 | 0 | return true; | 553 | 58 | } |
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 | 72 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 475 | 72 | MaxNativeType res; | 476 | 72 | 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 | 72 | } else { | 501 | 72 | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 502 | 72 | res)) { | 503 | 11 | 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 | 11 | return false; | 510 | 61 | } else { | 511 | 61 | if (UNLIKELY(res > max_result || res < -max_result)) { | 512 | 31 | if (params.is_strict) { | 513 | 21 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 514 | 21 | decimal_to_string(from.value, scale_from), | 515 | 21 | fmt::format("decimal({}, {})", precision_from, scale_from), | 516 | 21 | precision_to, scale_to); | 517 | 21 | } | 518 | 31 | return false; | 519 | 31 | } else { | 520 | 30 | to = ToCppT(res); | 521 | 30 | } | 522 | 61 | } | 523 | 72 | } | 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 | 72 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_7DecimalIlEES3_Lb0ELb0ElQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 474 | 46 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 475 | 46 | 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 | 46 | } else { | 525 | | if constexpr (IsDecimal128V2<FromCppT>) { | 526 | | res = from.value() * scale_multiplier; | 527 | 46 | } else { | 528 | 46 | res = from.value * scale_multiplier; | 529 | 46 | } | 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 | 46 | to = ToCppT(res); | 551 | 46 | } | 552 | 46 | return true; | 553 | 46 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_7DecimalIlEES3_Lb0ELb1ElQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 474 | 44 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 475 | 44 | 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 | 44 | } else { | 525 | | if constexpr (IsDecimal128V2<FromCppT>) { | 526 | | res = from.value() * scale_multiplier; | 527 | 44 | } else { | 528 | 44 | res = from.value * scale_multiplier; | 529 | 44 | } | 530 | 44 | if constexpr (narrow_integral) { | 531 | 44 | 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 | 18 | } else { | 540 | 18 | if (params.is_strict) { | 541 | 9 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 542 | 9 | decimal_to_string(from.value, scale_from), | 543 | 9 | fmt::format("decimal({}, {})", precision_from, scale_from), | 544 | 9 | precision_to, scale_to); | 545 | 9 | } | 546 | 18 | } | 547 | 18 | return false; | 548 | 18 | } | 549 | 44 | } | 550 | 26 | to = ToCppT(res); | 551 | 44 | } | 552 | 0 | return true; | 553 | 44 | } |
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 | 210 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 475 | 210 | MaxNativeType res; | 476 | 210 | 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 | 210 | } else { | 501 | 210 | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 502 | 210 | res)) { | 503 | 36 | 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 | 36 | return false; | 510 | 174 | } else { | 511 | 174 | if (UNLIKELY(res > max_result || res < -max_result)) { | 512 | 78 | if (params.is_strict) { | 513 | 57 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 514 | 57 | decimal_to_string(from.value, scale_from), | 515 | 57 | fmt::format("decimal({}, {})", precision_from, scale_from), | 516 | 57 | precision_to, scale_to); | 517 | 57 | } | 518 | 78 | return false; | 519 | 96 | } else { | 520 | 96 | to = ToCppT(res); | 521 | 96 | } | 522 | 174 | } | 523 | 210 | } | 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 | 96 | return true; | 553 | 210 | } |
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 | 224 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 475 | 224 | MaxNativeType res; | 476 | 224 | 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 | 224 | } else { | 501 | 224 | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 502 | 224 | res)) { | 503 | 20 | 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 | 20 | return false; | 510 | 204 | } else { | 511 | 204 | if (UNLIKELY(res > max_result || res < -max_result)) { | 512 | 100 | 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 | 100 | return false; | 519 | 104 | } else { | 520 | 104 | to = ToCppT(res); | 521 | 104 | } | 522 | 204 | } | 523 | 224 | } | 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 | 104 | return true; | 553 | 224 | } |
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 | 224 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 475 | 224 | MaxNativeType res; | 476 | 224 | 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 | 224 | } else { | 501 | 224 | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 502 | 224 | res)) { | 503 | 20 | 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 | 20 | return false; | 510 | 204 | } else { | 511 | 204 | if (UNLIKELY(res > max_result || res < -max_result)) { | 512 | 100 | 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 | 100 | return false; | 519 | 104 | } else { | 520 | 104 | to = ToCppT(res); | 521 | 104 | } | 522 | 204 | } | 523 | 224 | } | 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 | 104 | return true; | 553 | 224 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_7DecimalIiEENS_12Decimal128V3ELb0ELb0EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKT3_RKNS5_10NativeTypeESF_RNS_14CastParametersE Line | Count | Source | 474 | 120 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 475 | 120 | 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 | 120 | } else { | 525 | | if constexpr (IsDecimal128V2<FromCppT>) { | 526 | | res = from.value() * scale_multiplier; | 527 | 120 | } else { | 528 | 120 | res = from.value * scale_multiplier; | 529 | 120 | } | 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 | 120 | to = ToCppT(res); | 551 | 120 | } | 552 | 120 | return true; | 553 | 120 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_7DecimalIiEENS_12Decimal128V3ELb0ELb1EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKT3_RKNS5_10NativeTypeESF_RNS_14CastParametersE Line | Count | Source | 474 | 65 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 475 | 65 | 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 | 65 | } else { | 525 | | if constexpr (IsDecimal128V2<FromCppT>) { | 526 | | res = from.value() * scale_multiplier; | 527 | 65 | } else { | 528 | 65 | res = from.value * scale_multiplier; | 529 | 65 | } | 530 | 65 | if constexpr (narrow_integral) { | 531 | 65 | 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 | 65 | } | 550 | 29 | to = ToCppT(res); | 551 | 65 | } | 552 | 0 | return true; | 553 | 65 | } |
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 | 65 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 475 | 65 | MaxNativeType res; | 476 | 65 | 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 | 65 | } else { | 501 | 65 | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 502 | 65 | res)) { | 503 | 20 | if (params.is_strict) { | 504 | 6 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 505 | 6 | decimal_to_string(from.value, scale_from), | 506 | 6 | fmt::format("decimal({}, {})", precision_from, scale_from), | 507 | 6 | precision_to, scale_to); | 508 | 6 | } | 509 | 20 | return false; | 510 | 45 | } else { | 511 | 45 | if (UNLIKELY(res > max_result || res < -max_result)) { | 512 | 16 | if (params.is_strict) { | 513 | 12 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 514 | 12 | decimal_to_string(from.value, scale_from), | 515 | 12 | fmt::format("decimal({}, {})", precision_from, scale_from), | 516 | 12 | precision_to, scale_to); | 517 | 12 | } | 518 | 16 | return false; | 519 | 29 | } else { | 520 | 29 | to = ToCppT(res); | 521 | 29 | } | 522 | 45 | } | 523 | 65 | } | 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 | 29 | return true; | 553 | 65 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_7DecimalIlEENS_12Decimal128V3ELb0ELb0EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKT3_RKNS5_10NativeTypeESF_RNS_14CastParametersE Line | Count | Source | 474 | 176 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 475 | 176 | 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 | 176 | } else { | 525 | | if constexpr (IsDecimal128V2<FromCppT>) { | 526 | | res = from.value() * scale_multiplier; | 527 | 176 | } else { | 528 | 176 | res = from.value * scale_multiplier; | 529 | 176 | } | 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 | 176 | to = ToCppT(res); | 551 | 176 | } | 552 | 176 | return true; | 553 | 176 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_7DecimalIlEENS_12Decimal128V3ELb0ELb1EnQaa15IsDecimalNumberIT0_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_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 | 116 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 475 | 116 | MaxNativeType res; | 476 | 116 | 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 | 116 | } else { | 501 | 116 | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 502 | 116 | res)) { | 503 | 36 | 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 | 36 | return false; | 510 | 80 | } else { | 511 | 80 | if (UNLIKELY(res > max_result || res < -max_result)) { | 512 | 24 | if (params.is_strict) { | 513 | 18 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 514 | 18 | decimal_to_string(from.value, scale_from), | 515 | 18 | fmt::format("decimal({}, {})", precision_from, scale_from), | 516 | 18 | precision_to, scale_to); | 517 | 18 | } | 518 | 24 | return false; | 519 | 56 | } else { | 520 | 56 | to = ToCppT(res); | 521 | 56 | } | 522 | 80 | } | 523 | 116 | } | 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 | 56 | return true; | 553 | 116 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_12Decimal128V3ES2_Lb0ELb0EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS4_jjRS3_jjRKT3_RKNS3_10NativeTypeESD_RNS_14CastParametersE Line | Count | Source | 474 | 46 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 475 | 46 | 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 | 46 | } else { | 525 | | if constexpr (IsDecimal128V2<FromCppT>) { | 526 | | res = from.value() * scale_multiplier; | 527 | 46 | } else { | 528 | 46 | res = from.value * scale_multiplier; | 529 | 46 | } | 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 | 46 | to = ToCppT(res); | 551 | 46 | } | 552 | 46 | return true; | 553 | 46 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_12Decimal128V3ES2_Lb0ELb1EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS4_jjRS3_jjRKT3_RKNS3_10NativeTypeESD_RNS_14CastParametersE Line | Count | Source | 474 | 70 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 475 | 70 | 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 | 70 | } else { | 525 | | if constexpr (IsDecimal128V2<FromCppT>) { | 526 | | res = from.value() * scale_multiplier; | 527 | 70 | } else { | 528 | 70 | res = from.value * scale_multiplier; | 529 | 70 | } | 530 | 70 | if constexpr (narrow_integral) { | 531 | 70 | 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 | 70 | } | 550 | 34 | to = ToCppT(res); | 551 | 70 | } | 552 | 0 | return true; | 553 | 70 | } |
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 | 184 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 475 | 184 | MaxNativeType res; | 476 | 184 | 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 | 184 | } else { | 501 | 184 | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 502 | 184 | res)) { | 503 | 48 | 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 | 48 | return false; | 510 | 136 | } else { | 511 | 136 | 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 | 88 | } else { | 520 | 88 | to = ToCppT(res); | 521 | 88 | } | 522 | 136 | } | 523 | 184 | } | 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 | 88 | return true; | 553 | 184 | } |
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 | 224 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 475 | 224 | MaxNativeType res; | 476 | 224 | 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 | 224 | } else { | 501 | 224 | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 502 | 224 | 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 | 202 | } else { | 511 | 202 | if (UNLIKELY(res > max_result || res < -max_result)) { | 512 | 98 | 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 | 98 | return false; | 519 | 104 | } else { | 520 | 104 | to = ToCppT(res); | 521 | 104 | } | 522 | 202 | } | 523 | 224 | } | 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 | 104 | return true; | 553 | 224 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_7DecimalIiEENS2_IN4wide7integerILm256EiEEEELb0ELb0ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKT3_RKNS8_10NativeTypeESI_RNS_14CastParametersE Line | Count | Source | 474 | 120 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 475 | 120 | 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 | 120 | } else { | 525 | | if constexpr (IsDecimal128V2<FromCppT>) { | 526 | | res = from.value() * scale_multiplier; | 527 | 120 | } else { | 528 | 120 | res = from.value * scale_multiplier; | 529 | 120 | } | 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 | 120 | to = ToCppT(res); | 551 | 120 | } | 552 | 120 | return true; | 553 | 120 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_7DecimalIiEENS2_IN4wide7integerILm256EiEEEELb0ELb1ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKT3_RKNS8_10NativeTypeESI_RNS_14CastParametersE Line | Count | Source | 474 | 65 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 475 | 65 | 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 | 65 | } else { | 525 | | if constexpr (IsDecimal128V2<FromCppT>) { | 526 | | res = from.value() * scale_multiplier; | 527 | 65 | } else { | 528 | 65 | res = from.value * scale_multiplier; | 529 | 65 | } | 530 | 65 | if constexpr (narrow_integral) { | 531 | 65 | 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 | 65 | } | 550 | 29 | to = ToCppT(res); | 551 | 65 | } | 552 | 0 | return true; | 553 | 65 | } |
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 | 65 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 475 | 65 | MaxNativeType res; | 476 | 65 | 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 | 65 | } else { | 501 | 65 | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 502 | 65 | res)) { | 503 | 12 | 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 | 12 | return false; | 510 | 53 | } else { | 511 | 53 | if (UNLIKELY(res > max_result || res < -max_result)) { | 512 | 24 | if (params.is_strict) { | 513 | 18 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 514 | 18 | decimal_to_string(from.value, scale_from), | 515 | 18 | fmt::format("decimal({}, {})", precision_from, scale_from), | 516 | 18 | precision_to, scale_to); | 517 | 18 | } | 518 | 24 | return false; | 519 | 29 | } else { | 520 | 29 | to = ToCppT(res); | 521 | 29 | } | 522 | 53 | } | 523 | 65 | } | 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 | 29 | return true; | 553 | 65 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_7DecimalIlEENS2_IN4wide7integerILm256EiEEEELb0ELb0ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKT3_RKNS8_10NativeTypeESI_RNS_14CastParametersE Line | Count | Source | 474 | 184 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 475 | 184 | 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 | 184 | } else { | 525 | | if constexpr (IsDecimal128V2<FromCppT>) { | 526 | | res = from.value() * scale_multiplier; | 527 | 184 | } else { | 528 | 184 | res = from.value * scale_multiplier; | 529 | 184 | } | 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 | 184 | to = ToCppT(res); | 551 | 184 | } | 552 | 184 | return true; | 553 | 184 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_7DecimalIlEENS2_IN4wide7integerILm256EiEEEELb0ELb1ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKT3_RKNS8_10NativeTypeESI_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_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 | 116 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 475 | 116 | MaxNativeType res; | 476 | 116 | 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 | 116 | } else { | 501 | 116 | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 502 | 116 | res)) { | 503 | 20 | 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 | 20 | return false; | 510 | 96 | } else { | 511 | 96 | if (UNLIKELY(res > max_result || res < -max_result)) { | 512 | 40 | if (params.is_strict) { | 513 | 30 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 514 | 30 | decimal_to_string(from.value, scale_from), | 515 | 30 | fmt::format("decimal({}, {})", precision_from, scale_from), | 516 | 30 | precision_to, scale_to); | 517 | 30 | } | 518 | 40 | return false; | 519 | 56 | } else { | 520 | 56 | to = ToCppT(res); | 521 | 56 | } | 522 | 96 | } | 523 | 116 | } | 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 | 56 | return true; | 553 | 116 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_12Decimal128V3ENS_7DecimalIN4wide7integerILm256EiEEEELb0ELb0ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKT3_RKNS8_10NativeTypeESI_RNS_14CastParametersE Line | Count | Source | 474 | 176 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 475 | 176 | 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 | 176 | } else { | 525 | | if constexpr (IsDecimal128V2<FromCppT>) { | 526 | | res = from.value() * scale_multiplier; | 527 | 176 | } else { | 528 | 176 | res = from.value * scale_multiplier; | 529 | 176 | } | 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 | 176 | to = ToCppT(res); | 551 | 176 | } | 552 | 176 | return true; | 553 | 176 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_12Decimal128V3ENS_7DecimalIN4wide7integerILm256EiEEEELb0ELb1ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKT3_RKNS8_10NativeTypeESI_RNS_14CastParametersE Line | Count | Source | 474 | 109 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 475 | 109 | 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 | 109 | } else { | 525 | | if constexpr (IsDecimal128V2<FromCppT>) { | 526 | | res = from.value() * scale_multiplier; | 527 | 109 | } else { | 528 | 109 | res = from.value * scale_multiplier; | 529 | 109 | } | 530 | 109 | if constexpr (narrow_integral) { | 531 | 109 | 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 | 54 | } else { | 540 | 54 | if (params.is_strict) { | 541 | 27 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 542 | 27 | decimal_to_string(from.value, scale_from), | 543 | 27 | fmt::format("decimal({}, {})", precision_from, scale_from), | 544 | 27 | precision_to, scale_to); | 545 | 27 | } | 546 | 54 | } | 547 | 54 | return false; | 548 | 54 | } | 549 | 109 | } | 550 | 55 | to = ToCppT(res); | 551 | 109 | } | 552 | 0 | return true; | 553 | 109 | } |
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 | 123 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 475 | 123 | MaxNativeType res; | 476 | 123 | 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 | 123 | } else { | 501 | 123 | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 502 | 123 | 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 | 101 | } else { | 511 | 101 | if (UNLIKELY(res > max_result || res < -max_result)) { | 512 | 44 | if (params.is_strict) { | 513 | 33 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 514 | 33 | decimal_to_string(from.value, scale_from), | 515 | 33 | fmt::format("decimal({}, {})", precision_from, scale_from), | 516 | 33 | precision_to, scale_to); | 517 | 33 | } | 518 | 44 | return false; | 519 | 57 | } else { | 520 | 57 | to = ToCppT(res); | 521 | 57 | } | 522 | 101 | } | 523 | 123 | } | 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 | 57 | return true; | 553 | 123 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_7DecimalIN4wide7integerILm256EiEEEES6_Lb0ELb0ES5_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS8_jjRS7_jjRKT3_RKNS7_10NativeTypeESH_RNS_14CastParametersE Line | Count | Source | 474 | 46 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 475 | 46 | 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 | 46 | } else { | 525 | | if constexpr (IsDecimal128V2<FromCppT>) { | 526 | | res = from.value() * scale_multiplier; | 527 | 46 | } else { | 528 | 46 | res = from.value * scale_multiplier; | 529 | 46 | } | 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 | 46 | to = ToCppT(res); | 551 | 46 | } | 552 | 46 | return true; | 553 | 46 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_7DecimalIN4wide7integerILm256EiEEEES6_Lb0ELb1ES5_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS8_jjRS7_jjRKT3_RKNS7_10NativeTypeESH_RNS_14CastParametersE Line | Count | Source | 474 | 44 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 475 | 44 | 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 | 44 | } else { | 525 | | if constexpr (IsDecimal128V2<FromCppT>) { | 526 | | res = from.value() * scale_multiplier; | 527 | 44 | } else { | 528 | 44 | res = from.value * scale_multiplier; | 529 | 44 | } | 530 | 44 | if constexpr (narrow_integral) { | 531 | 44 | 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 | 18 | } else { | 540 | 18 | if (params.is_strict) { | 541 | 9 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 542 | 9 | decimal_to_string(from.value, scale_from), | 543 | 9 | fmt::format("decimal({}, {})", precision_from, scale_from), | 544 | 9 | precision_to, scale_to); | 545 | 9 | } | 546 | 18 | } | 547 | 18 | return false; | 548 | 18 | } | 549 | 44 | } | 550 | 26 | to = ToCppT(res); | 551 | 44 | } | 552 | 0 | return true; | 553 | 44 | } |
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 | 210 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 475 | 210 | MaxNativeType res; | 476 | 210 | 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 | 210 | } else { | 501 | 210 | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 502 | 210 | res)) { | 503 | 38 | 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 | 38 | return false; | 510 | 172 | } else { | 511 | 172 | if (UNLIKELY(res > max_result || res < -max_result)) { | 512 | 76 | if (params.is_strict) { | 513 | 57 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 514 | 57 | decimal_to_string(from.value, scale_from), | 515 | 57 | fmt::format("decimal({}, {})", precision_from, scale_from), | 516 | 57 | precision_to, scale_to); | 517 | 57 | } | 518 | 76 | return false; | 519 | 96 | } else { | 520 | 96 | to = ToCppT(res); | 521 | 96 | } | 522 | 172 | } | 523 | 210 | } | 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 | 96 | return true; | 553 | 210 | } |
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 | 15 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 475 | 15 | MaxNativeType res; | 476 | 15 | if constexpr (multiply_may_overflow) { | 477 | 15 | if constexpr (IsDecimal128V2<FromCppT>) { | 478 | 15 | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 479 | 15 | 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 | 15 | } else { | 488 | 15 | 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 | 15 | } else { | 497 | 15 | to = ToCppT(res); | 498 | 15 | } | 499 | 15 | } | 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 | 15 | return true; | 553 | 15 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_14DecimalV2ValueENS_7DecimalIlEELb1ELb1EnQaa15IsDecimalNumberIT0_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 | 130 | if constexpr (IsDecimal128V2<FromCppT>) { | 478 | 130 | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 479 | 130 | 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 | 130 | } else { | 488 | 130 | if (UNLIKELY(res > max_result || res < -max_result)) { | 489 | 48 | if (params.is_strict) { | 490 | 24 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 491 | 24 | decimal_to_string(from.value(), scale_from), | 492 | 24 | fmt::format("decimal({}, {})", precision_from, scale_from), | 493 | 24 | precision_to, scale_to); | 494 | 24 | } | 495 | 48 | return false; | 496 | 82 | } else { | 497 | 82 | to = ToCppT(res); | 498 | 82 | } | 499 | 130 | } | 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 | 82 | return true; | 553 | 130 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_14DecimalV2ValueENS_12Decimal128V3ELb0ELb0EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 474 | 11 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 475 | 11 | 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 | 11 | } else { | 525 | 11 | if constexpr (IsDecimal128V2<FromCppT>) { | 526 | 11 | 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 | 11 | to = ToCppT(res); | 551 | 11 | } | 552 | 11 | return true; | 553 | 11 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_14DecimalV2ValueENS_12Decimal128V3ELb0ELb1EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 474 | 95 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 475 | 95 | 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 | 95 | } else { | 525 | 95 | if constexpr (IsDecimal128V2<FromCppT>) { | 526 | 95 | res = from.value() * scale_multiplier; | 527 | | } else { | 528 | | res = from.value * scale_multiplier; | 529 | | } | 530 | 95 | if constexpr (narrow_integral) { | 531 | 95 | if (UNLIKELY(res > max_result || res < -max_result)) { | 532 | 30 | if constexpr (IsDecimal128V2<FromCppT>) { | 533 | 30 | if (params.is_strict) { | 534 | 15 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 535 | 15 | decimal_to_string(from.value(), scale_from), | 536 | 15 | fmt::format("decimal({}, {})", precision_from, scale_from), | 537 | 15 | precision_to, scale_to); | 538 | 15 | } | 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 | 30 | return false; | 548 | 30 | } | 549 | 95 | } | 550 | 65 | to = ToCppT(res); | 551 | 95 | } | 552 | 0 | return true; | 553 | 95 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_14DecimalV2ValueENS_12Decimal128V3ELb1ELb0EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 474 | 11 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 475 | 11 | MaxNativeType res; | 476 | 11 | if constexpr (multiply_may_overflow) { | 477 | 11 | if constexpr (IsDecimal128V2<FromCppT>) { | 478 | 11 | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 479 | 11 | 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 | 11 | } else { | 488 | 11 | 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 | 11 | } else { | 497 | 11 | to = ToCppT(res); | 498 | 11 | } | 499 | 11 | } | 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 | 11 | return true; | 553 | 11 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_14DecimalV2ValueENS_12Decimal128V3ELb1ELb1EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 474 | 95 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 475 | 95 | MaxNativeType res; | 476 | 95 | if constexpr (multiply_may_overflow) { | 477 | 95 | if constexpr (IsDecimal128V2<FromCppT>) { | 478 | 95 | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 479 | 95 | res)) { | 480 | 18 | if (params.is_strict) { | 481 | 6 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 482 | 6 | decimal_to_string(from.value(), scale_from), | 483 | 6 | fmt::format("decimal({}, {})", precision_from, scale_from), | 484 | 6 | precision_to, scale_to); | 485 | 6 | } | 486 | 18 | return false; | 487 | 77 | } else { | 488 | 77 | if (UNLIKELY(res > max_result || res < -max_result)) { | 489 | 12 | if (params.is_strict) { | 490 | 9 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 491 | 9 | decimal_to_string(from.value(), scale_from), | 492 | 9 | fmt::format("decimal({}, {})", precision_from, scale_from), | 493 | 9 | precision_to, scale_to); | 494 | 9 | } | 495 | 12 | return false; | 496 | 65 | } else { | 497 | 65 | to = ToCppT(res); | 498 | 65 | } | 499 | 77 | } | 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 | 65 | return true; | 553 | 95 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_14DecimalV2ValueENS_7DecimalIN4wide7integerILm256EiEEEELb0ELb0ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKT3_RKNS8_10NativeTypeESI_RNS_14CastParametersE Line | Count | Source | 474 | 11 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 475 | 11 | 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 | 11 | } else { | 525 | 11 | if constexpr (IsDecimal128V2<FromCppT>) { | 526 | 11 | 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 | 11 | to = ToCppT(res); | 551 | 11 | } | 552 | 11 | return true; | 553 | 11 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_14DecimalV2ValueENS_7DecimalIN4wide7integerILm256EiEEEELb0ELb1ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKT3_RKNS8_10NativeTypeESI_RNS_14CastParametersE Line | Count | Source | 474 | 95 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 475 | 95 | 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 | 95 | } else { | 525 | 95 | if constexpr (IsDecimal128V2<FromCppT>) { | 526 | 95 | res = from.value() * scale_multiplier; | 527 | | } else { | 528 | | res = from.value * scale_multiplier; | 529 | | } | 530 | 95 | if constexpr (narrow_integral) { | 531 | 95 | if (UNLIKELY(res > max_result || res < -max_result)) { | 532 | 30 | if constexpr (IsDecimal128V2<FromCppT>) { | 533 | 30 | if (params.is_strict) { | 534 | 15 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 535 | 15 | decimal_to_string(from.value(), scale_from), | 536 | 15 | fmt::format("decimal({}, {})", precision_from, scale_from), | 537 | 15 | precision_to, scale_to); | 538 | 15 | } | 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 | 30 | return false; | 548 | 30 | } | 549 | 95 | } | 550 | 65 | to = ToCppT(res); | 551 | 95 | } | 552 | 0 | return true; | 553 | 95 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_14DecimalV2ValueENS_7DecimalIN4wide7integerILm256EiEEEELb1ELb0ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKT3_RKNS8_10NativeTypeESI_RNS_14CastParametersE Line | Count | Source | 474 | 11 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 475 | 11 | MaxNativeType res; | 476 | 11 | if constexpr (multiply_may_overflow) { | 477 | 11 | if constexpr (IsDecimal128V2<FromCppT>) { | 478 | 11 | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 479 | 11 | 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 | 11 | } else { | 488 | 11 | 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 | 11 | } else { | 497 | 11 | to = ToCppT(res); | 498 | 11 | } | 499 | 11 | } | 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 | 11 | return true; | 553 | 11 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_14DecimalV2ValueENS_7DecimalIN4wide7integerILm256EiEEEELb1ELb1ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKT3_RKNS8_10NativeTypeESI_RNS_14CastParametersE Line | Count | Source | 474 | 95 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 475 | 95 | MaxNativeType res; | 476 | 95 | if constexpr (multiply_may_overflow) { | 477 | 95 | if constexpr (IsDecimal128V2<FromCppT>) { | 478 | 95 | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 479 | 95 | res)) { | 480 | 10 | 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 | 10 | return false; | 487 | 85 | } else { | 488 | 85 | if (UNLIKELY(res > max_result || res < -max_result)) { | 489 | 20 | if (params.is_strict) { | 490 | 15 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 491 | 15 | decimal_to_string(from.value(), scale_from), | 492 | 15 | fmt::format("decimal({}, {})", precision_from, scale_from), | 493 | 15 | precision_to, scale_to); | 494 | 15 | } | 495 | 20 | return false; | 496 | 65 | } else { | 497 | 65 | to = ToCppT(res); | 498 | 65 | } | 499 | 85 | } | 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 | 65 | return true; | 553 | 95 | } |
|
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 | 1.86k | CastParameters& params) { |
563 | 1.86k | if constexpr (IsDecimal128V2<FromCppT>) { |
564 | 106 | if constexpr (narrow_integral) { |
565 | 95 | if (UNLIKELY(from.value() > max_result || from.value() < -max_result)) { |
566 | 30 | if (params.is_strict) { |
567 | 15 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( |
568 | 15 | decimal_to_string(from.value(), scale_from), |
569 | 15 | fmt::format("decimal({}, {})", precision_from, scale_from), |
570 | 15 | precision_to, scale_to); |
571 | 15 | } |
572 | 30 | return false; |
573 | 30 | } |
574 | 95 | } |
575 | 65 | to = ToCppT(from.value()); |
576 | 1.76k | } else { |
577 | 1.76k | if constexpr (narrow_integral) { |
578 | 1.05k | if (UNLIKELY(from.value > max_result || from.value < -max_result)) { |
579 | 354 | if (params.is_strict) { |
580 | 177 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( |
581 | 177 | decimal_to_string(from.value, scale_from), |
582 | 177 | fmt::format("decimal({}, {})", precision_from, scale_from), |
583 | 177 | precision_to, scale_to); |
584 | 177 | } |
585 | 354 | return false; |
586 | 354 | } |
587 | 1.05k | } |
588 | 703 | to = ToCppT(from.value); |
589 | 1.76k | } |
590 | 0 | return true; |
591 | 1.86k | } _ZN5doris13CastToDecimal24_from_decimal_same_scaleINS_7DecimalIiEES3_iLb0EQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKNS4_10NativeTypeESB_RNS_14CastParametersE Line | Count | Source | 562 | 8 | 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 | 8 | } 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 | 8 | to = ToCppT(from.value); | 589 | 8 | } | 590 | 8 | return true; | 591 | 8 | } |
_ZN5doris13CastToDecimal24_from_decimal_same_scaleINS_7DecimalIiEES3_iLb1EQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKNS4_10NativeTypeESB_RNS_14CastParametersE Line | Count | Source | 562 | 19 | 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 | 19 | } else { | 577 | 19 | if constexpr (narrow_integral) { | 578 | 19 | if (UNLIKELY(from.value > max_result || from.value < -max_result)) { | 579 | 12 | if (params.is_strict) { | 580 | 6 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 581 | 6 | decimal_to_string(from.value, scale_from), | 582 | 6 | fmt::format("decimal({}, {})", precision_from, scale_from), | 583 | 6 | precision_to, scale_to); | 584 | 6 | } | 585 | 12 | return false; | 586 | 12 | } | 587 | 19 | } | 588 | 7 | to = ToCppT(from.value); | 589 | 19 | } | 590 | 0 | return true; | 591 | 19 | } |
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 | 136 | 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 | 136 | } else { | 577 | 136 | if constexpr (narrow_integral) { | 578 | 136 | if (UNLIKELY(from.value > max_result || from.value < -max_result)) { | 579 | 54 | if (params.is_strict) { | 580 | 27 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 581 | 27 | decimal_to_string(from.value, scale_from), | 582 | 27 | fmt::format("decimal({}, {})", precision_from, scale_from), | 583 | 27 | precision_to, scale_to); | 584 | 27 | } | 585 | 54 | return false; | 586 | 54 | } | 587 | 136 | } | 588 | 82 | to = ToCppT(from.value); | 589 | 136 | } | 590 | 0 | return true; | 591 | 136 | } |
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 | 122 | 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 | 122 | } else { | 577 | 122 | if constexpr (narrow_integral) { | 578 | 122 | if (UNLIKELY(from.value > max_result || from.value < -max_result)) { | 579 | 48 | if (params.is_strict) { | 580 | 24 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 581 | 24 | decimal_to_string(from.value, scale_from), | 582 | 24 | fmt::format("decimal({}, {})", precision_from, scale_from), | 583 | 24 | precision_to, scale_to); | 584 | 24 | } | 585 | 48 | return false; | 586 | 48 | } | 587 | 122 | } | 588 | 74 | to = ToCppT(from.value); | 589 | 122 | } | 590 | 0 | return true; | 591 | 122 | } |
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 | 122 | 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 | 122 | } else { | 577 | 122 | if constexpr (narrow_integral) { | 578 | 122 | if (UNLIKELY(from.value > max_result || from.value < -max_result)) { | 579 | 48 | if (params.is_strict) { | 580 | 24 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 581 | 24 | decimal_to_string(from.value, scale_from), | 582 | 24 | fmt::format("decimal({}, {})", precision_from, scale_from), | 583 | 24 | precision_to, scale_to); | 584 | 24 | } | 585 | 48 | return false; | 586 | 48 | } | 587 | 122 | } | 588 | 74 | to = ToCppT(from.value); | 589 | 122 | } | 590 | 0 | return true; | 591 | 122 | } |
_ZN5doris13CastToDecimal24_from_decimal_same_scaleINS_7DecimalIiEENS2_IlEElLb0EQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RNS_14CastParametersE Line | Count | Source | 562 | 82 | 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 | 82 | } 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 | 82 | to = ToCppT(from.value); | 589 | 82 | } | 590 | 82 | return true; | 591 | 82 | } |
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 | 30 | 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 | 30 | } 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 | 30 | to = ToCppT(from.value); | 589 | 30 | } | 590 | 30 | return true; | 591 | 30 | } |
_ZN5doris13CastToDecimal24_from_decimal_same_scaleINS_7DecimalIlEES3_lLb1EQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKNS4_10NativeTypeESB_RNS_14CastParametersE Line | Count | Source | 562 | 42 | 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 | 42 | } else { | 577 | 42 | if constexpr (narrow_integral) { | 578 | 42 | if (UNLIKELY(from.value > max_result || from.value < -max_result)) { | 579 | 12 | if (params.is_strict) { | 580 | 6 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 581 | 6 | decimal_to_string(from.value, scale_from), | 582 | 6 | fmt::format("decimal({}, {})", precision_from, scale_from), | 583 | 6 | precision_to, scale_to); | 584 | 6 | } | 585 | 12 | return false; | 586 | 12 | } | 587 | 42 | } | 588 | 30 | to = ToCppT(from.value); | 589 | 42 | } | 590 | 0 | return true; | 591 | 42 | } |
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 | 182 | 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 | 182 | } else { | 577 | 182 | if constexpr (narrow_integral) { | 578 | 182 | if (UNLIKELY(from.value > max_result || from.value < -max_result)) { | 579 | 54 | if (params.is_strict) { | 580 | 27 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 581 | 27 | decimal_to_string(from.value, scale_from), | 582 | 27 | fmt::format("decimal({}, {})", precision_from, scale_from), | 583 | 27 | precision_to, scale_to); | 584 | 27 | } | 585 | 54 | return false; | 586 | 54 | } | 587 | 182 | } | 588 | 128 | to = ToCppT(from.value); | 589 | 182 | } | 590 | 0 | return true; | 591 | 182 | } |
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 | 168 | 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 | 168 | } else { | 577 | 168 | if constexpr (narrow_integral) { | 578 | 168 | if (UNLIKELY(from.value > max_result || from.value < -max_result)) { | 579 | 48 | if (params.is_strict) { | 580 | 24 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 581 | 24 | decimal_to_string(from.value, scale_from), | 582 | 24 | fmt::format("decimal({}, {})", precision_from, scale_from), | 583 | 24 | precision_to, scale_to); | 584 | 24 | } | 585 | 48 | return false; | 586 | 48 | } | 587 | 168 | } | 588 | 120 | to = ToCppT(from.value); | 589 | 168 | } | 590 | 0 | return true; | 591 | 168 | } |
_ZN5doris13CastToDecimal24_from_decimal_same_scaleINS_7DecimalIiEENS_12Decimal128V3EnLb0EQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RNS_14CastParametersE Line | Count | Source | 562 | 74 | 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 | 74 | } 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 | 74 | to = ToCppT(from.value); | 589 | 74 | } | 590 | 74 | return true; | 591 | 74 | } |
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 | 128 | 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 | 128 | } 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 | 128 | to = ToCppT(from.value); | 589 | 128 | } | 590 | 128 | return true; | 591 | 128 | } |
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 | 31 | 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 | 31 | } 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 | 31 | to = ToCppT(from.value); | 589 | 31 | } | 590 | 31 | return true; | 591 | 31 | } |
_ZN5doris13CastToDecimal24_from_decimal_same_scaleINS_12Decimal128V3ES2_nLb1EQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS4_jjRS3_jjRKNS3_10NativeTypeESA_RNS_14CastParametersE Line | Count | Source | 562 | 42 | 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 | 42 | } else { | 577 | 42 | if constexpr (narrow_integral) { | 578 | 42 | if (UNLIKELY(from.value > max_result || from.value < -max_result)) { | 579 | 12 | if (params.is_strict) { | 580 | 6 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 581 | 6 | decimal_to_string(from.value, scale_from), | 582 | 6 | fmt::format("decimal({}, {})", precision_from, scale_from), | 583 | 6 | precision_to, scale_to); | 584 | 6 | } | 585 | 12 | return false; | 586 | 12 | } | 587 | 42 | } | 588 | 30 | to = ToCppT(from.value); | 589 | 42 | } | 590 | 0 | return true; | 591 | 42 | } |
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 | 182 | 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 | 182 | } else { | 577 | 182 | if constexpr (narrow_integral) { | 578 | 182 | if (UNLIKELY(from.value > max_result || from.value < -max_result)) { | 579 | 54 | if (params.is_strict) { | 580 | 27 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 581 | 27 | decimal_to_string(from.value, scale_from), | 582 | 27 | fmt::format("decimal({}, {})", precision_from, scale_from), | 583 | 27 | precision_to, scale_to); | 584 | 27 | } | 585 | 54 | return false; | 586 | 54 | } | 587 | 182 | } | 588 | 128 | to = ToCppT(from.value); | 589 | 182 | } | 590 | 0 | return true; | 591 | 182 | } |
_ZN5doris13CastToDecimal24_from_decimal_same_scaleINS_7DecimalIiEENS2_IN4wide7integerILm256EiEEEES6_Lb0EQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKNS8_10NativeTypeESF_RNS_14CastParametersE Line | Count | Source | 562 | 74 | 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 | 74 | } 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 | 74 | to = ToCppT(from.value); | 589 | 74 | } | 590 | 74 | return true; | 591 | 74 | } |
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 | 120 | 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 | 120 | } 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 | 120 | to = ToCppT(from.value); | 589 | 120 | } | 590 | 120 | return true; | 591 | 120 | } |
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 | 128 | 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 | 128 | } 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 | 128 | to = ToCppT(from.value); | 589 | 128 | } | 590 | 128 | return true; | 591 | 128 | } |
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 | 30 | 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 | 30 | } 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 | 30 | to = ToCppT(from.value); | 589 | 30 | } | 590 | 30 | return true; | 591 | 30 | } |
_ZN5doris13CastToDecimal24_from_decimal_same_scaleINS_7DecimalIN4wide7integerILm256EiEEEES6_S5_Lb1EQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS8_jjRS7_jjRKNS7_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 562 | 42 | 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 | 42 | } else { | 577 | 42 | if constexpr (narrow_integral) { | 578 | 42 | if (UNLIKELY(from.value > max_result || from.value < -max_result)) { | 579 | 12 | if (params.is_strict) { | 580 | 6 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 581 | 6 | decimal_to_string(from.value, scale_from), | 582 | 6 | fmt::format("decimal({}, {})", precision_from, scale_from), | 583 | 6 | precision_to, scale_to); | 584 | 6 | } | 585 | 12 | return false; | 586 | 12 | } | 587 | 42 | } | 588 | 30 | to = ToCppT(from.value); | 589 | 42 | } | 590 | 0 | return true; | 591 | 42 | } |
_ZN5doris13CastToDecimal24_from_decimal_same_scaleINS_14DecimalV2ValueENS_7DecimalIiEEnLb0EQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RNS_14CastParametersE Line | Count | Source | 562 | 4 | CastParameters& params) { | 563 | 4 | 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 | 4 | 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 | 4 | return true; | 591 | 4 | } |
_ZN5doris13CastToDecimal24_from_decimal_same_scaleINS_14DecimalV2ValueENS_7DecimalIiEEnLb1EQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RNS_14CastParametersE Line | Count | Source | 562 | 35 | CastParameters& params) { | 563 | 35 | if constexpr (IsDecimal128V2<FromCppT>) { | 564 | 35 | if constexpr (narrow_integral) { | 565 | 35 | if (UNLIKELY(from.value() > max_result || from.value() < -max_result)) { | 566 | 18 | if (params.is_strict) { | 567 | 9 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 568 | 9 | decimal_to_string(from.value(), scale_from), | 569 | 9 | fmt::format("decimal({}, {})", precision_from, scale_from), | 570 | 9 | precision_to, scale_to); | 571 | 9 | } | 572 | 18 | return false; | 573 | 18 | } | 574 | 35 | } | 575 | 17 | 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 | 35 | } |
_ZN5doris13CastToDecimal24_from_decimal_same_scaleINS_14DecimalV2ValueENS_7DecimalIlEEnLb0EQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RNS_14CastParametersE Line | Count | Source | 562 | 7 | CastParameters& params) { | 563 | 7 | 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 | 7 | 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 | 7 | return true; | 591 | 7 | } |
_ZN5doris13CastToDecimal24_from_decimal_same_scaleINS_14DecimalV2ValueENS_7DecimalIlEEnLb1EQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RNS_14CastParametersE Line | Count | Source | 562 | 60 | CastParameters& params) { | 563 | 60 | if constexpr (IsDecimal128V2<FromCppT>) { | 564 | 60 | if constexpr (narrow_integral) { | 565 | 60 | if (UNLIKELY(from.value() > max_result || from.value() < -max_result)) { | 566 | 12 | if (params.is_strict) { | 567 | 6 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 568 | 6 | decimal_to_string(from.value(), scale_from), | 569 | 6 | fmt::format("decimal({}, {})", precision_from, scale_from), | 570 | 6 | precision_to, scale_to); | 571 | 6 | } | 572 | 12 | return false; | 573 | 12 | } | 574 | 60 | } | 575 | 48 | 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 | 60 | } |
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 | 8.38k | CastParameters& params) { |
610 | 8.38k | MaxNativeType res; |
611 | 8.38k | if (from >= FromCppT(0)) { |
612 | 8.38k | if constexpr (narrow_integral) { |
613 | 3.33k | if constexpr (IsDecimal128V2<FromCppT>) { |
614 | 839 | res = (from.value() + scale_multiplier / 2) / scale_multiplier; |
615 | 839 | if (UNLIKELY(res > max_result)) { |
616 | 244 | if (params.is_strict) { |
617 | 122 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( |
618 | 122 | decimal_to_string(from.value(), scale_from), |
619 | 122 | fmt::format("decimal({}, {})", precision_from, scale_from), |
620 | 122 | precision_to, scale_to); |
621 | 122 | } |
622 | 244 | return false; |
623 | 244 | } |
624 | 2.49k | } else { |
625 | 2.49k | res = (from.value + scale_multiplier / 2) / scale_multiplier; |
626 | 2.49k | if (UNLIKELY(res > max_result)) { |
627 | 1.03k | if (params.is_strict) { |
628 | 518 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( |
629 | 518 | decimal_to_string(from.value, scale_from), |
630 | 518 | fmt::format("decimal({}, {})", precision_from, scale_from), |
631 | 518 | precision_to, scale_to); |
632 | 518 | } |
633 | 1.03k | return false; |
634 | 1.03k | } |
635 | 2.49k | } |
636 | 2.04k | to = ToCppT(res); |
637 | 5.05k | } else { |
638 | 5.05k | if constexpr (IsDecimal128V2<FromCppT>) { |
639 | 932 | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); |
640 | 4.12k | } else { |
641 | 4.12k | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); |
642 | 4.12k | } |
643 | 5.05k | } |
644 | 8.38k | } 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 | 8.38k | } _ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_7DecimalIiEES3_Lb0ELb0EiQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 609 | 112 | CastParameters& params) { | 610 | 112 | MaxNativeType res; | 611 | 112 | 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 | 112 | } else { | 638 | | if constexpr (IsDecimal128V2<FromCppT>) { | 639 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 640 | 112 | } else { | 641 | 112 | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 642 | 112 | } | 643 | 112 | } | 644 | 112 | } 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 | 112 | return true; | 679 | 112 | } |
_ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_7DecimalIiEES3_Lb0ELb1EiQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 609 | 82 | CastParameters& params) { | 610 | 82 | MaxNativeType res; | 611 | 82 | if (from >= FromCppT(0)) { | 612 | 82 | 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 | 82 | } else { | 625 | 82 | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 626 | 82 | if (UNLIKELY(res > max_result)) { | 627 | 40 | if (params.is_strict) { | 628 | 20 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 629 | 20 | decimal_to_string(from.value, scale_from), | 630 | 20 | fmt::format("decimal({}, {})", precision_from, scale_from), | 631 | 20 | precision_to, scale_to); | 632 | 20 | } | 633 | 40 | return false; | 634 | 40 | } | 635 | 82 | } | 636 | 42 | 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 | 82 | } 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 | 82 | } |
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 | 160 | CastParameters& params) { | 610 | 160 | MaxNativeType res; | 611 | 160 | 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 | 160 | } else { | 638 | | if constexpr (IsDecimal128V2<FromCppT>) { | 639 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 640 | 160 | } else { | 641 | 160 | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 642 | 160 | } | 643 | 160 | } | 644 | 160 | } 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 | 160 | return true; | 679 | 160 | } |
_ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_7DecimalIlEENS2_IiEELb0ELb1ElQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKT3_RKNS5_10NativeTypeESF_RNS_14CastParametersE Line | Count | Source | 609 | 323 | CastParameters& params) { | 610 | 323 | MaxNativeType res; | 611 | 323 | if (from >= FromCppT(0)) { | 612 | 323 | 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 | 323 | } else { | 625 | 323 | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 626 | 323 | if (UNLIKELY(res > max_result)) { | 627 | 133 | if (params.is_strict) { | 628 | 66 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 629 | 66 | decimal_to_string(from.value, scale_from), | 630 | 66 | fmt::format("decimal({}, {})", precision_from, scale_from), | 631 | 66 | precision_to, scale_to); | 632 | 66 | } | 633 | 133 | return false; | 634 | 133 | } | 635 | 323 | } | 636 | 190 | 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 | 323 | } 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 | 323 | } |
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 | 160 | CastParameters& params) { | 610 | 160 | MaxNativeType res; | 611 | 160 | 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 | 160 | } else { | 638 | | if constexpr (IsDecimal128V2<FromCppT>) { | 639 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 640 | 160 | } else { | 641 | 160 | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 642 | 160 | } | 643 | 160 | } | 644 | 160 | } 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 | 160 | return true; | 679 | 160 | } |
_ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_12Decimal128V3ENS_7DecimalIiEELb0ELb1EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKT3_RKNS5_10NativeTypeESF_RNS_14CastParametersE Line | Count | Source | 609 | 357 | CastParameters& params) { | 610 | 357 | MaxNativeType res; | 611 | 357 | if (from >= FromCppT(0)) { | 612 | 357 | 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 | 357 | } else { | 625 | 357 | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 626 | 357 | if (UNLIKELY(res > max_result)) { | 627 | 161 | if (params.is_strict) { | 628 | 80 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 629 | 80 | decimal_to_string(from.value, scale_from), | 630 | 80 | fmt::format("decimal({}, {})", precision_from, scale_from), | 631 | 80 | precision_to, scale_to); | 632 | 80 | } | 633 | 161 | return false; | 634 | 161 | } | 635 | 357 | } | 636 | 196 | 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 | 357 | } 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 | 357 | } |
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 | 160 | CastParameters& params) { | 610 | 160 | MaxNativeType res; | 611 | 160 | 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 | 160 | } else { | 638 | | if constexpr (IsDecimal128V2<FromCppT>) { | 639 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 640 | 160 | } else { | 641 | 160 | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 642 | 160 | } | 643 | 160 | } | 644 | 160 | } 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 | 160 | return true; | 679 | 160 | } |
_ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_7DecimalIN4wide7integerILm256EiEEEENS2_IiEELb0ELb1ES5_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKT3_RKNS8_10NativeTypeESI_RNS_14CastParametersE Line | Count | Source | 609 | 357 | CastParameters& params) { | 610 | 357 | MaxNativeType res; | 611 | 357 | if (from >= FromCppT(0)) { | 612 | 357 | 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 | 357 | } else { | 625 | 357 | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 626 | 357 | if (UNLIKELY(res > max_result)) { | 627 | 161 | if (params.is_strict) { | 628 | 80 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 629 | 80 | decimal_to_string(from.value, scale_from), | 630 | 80 | fmt::format("decimal({}, {})", precision_from, scale_from), | 631 | 80 | precision_to, scale_to); | 632 | 80 | } | 633 | 161 | return false; | 634 | 161 | } | 635 | 357 | } | 636 | 196 | 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 | 357 | } 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 | 357 | } |
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 | 184 | CastParameters& params) { | 610 | 184 | MaxNativeType res; | 611 | 184 | 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 | 184 | } else { | 638 | | if constexpr (IsDecimal128V2<FromCppT>) { | 639 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 640 | 184 | } else { | 641 | 184 | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 642 | 184 | } | 643 | 184 | } | 644 | 184 | } 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 | 184 | return true; | 679 | 184 | } |
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 | 352 | CastParameters& params) { | 610 | 352 | MaxNativeType res; | 611 | 352 | 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 | 352 | } else { | 638 | | if constexpr (IsDecimal128V2<FromCppT>) { | 639 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 640 | 352 | } else { | 641 | 352 | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 642 | 352 | } | 643 | 352 | } | 644 | 352 | } 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 | 352 | return true; | 679 | 352 | } |
_ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_7DecimalIlEES3_Lb0ELb1ElQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 609 | 96 | CastParameters& params) { | 610 | 96 | MaxNativeType res; | 611 | 96 | if (from >= FromCppT(0)) { | 612 | 96 | 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 | 96 | } else { | 625 | 96 | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 626 | 96 | if (UNLIKELY(res > max_result)) { | 627 | 40 | if (params.is_strict) { | 628 | 20 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 629 | 20 | decimal_to_string(from.value, scale_from), | 630 | 20 | fmt::format("decimal({}, {})", precision_from, scale_from), | 631 | 20 | precision_to, scale_to); | 632 | 20 | } | 633 | 40 | return false; | 634 | 40 | } | 635 | 96 | } | 636 | 56 | 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 | 96 | } 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 | 96 | } |
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 | 288 | CastParameters& params) { | 610 | 288 | MaxNativeType res; | 611 | 288 | 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 | 288 | } else { | 638 | | if constexpr (IsDecimal128V2<FromCppT>) { | 639 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 640 | 288 | } else { | 641 | 288 | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 642 | 288 | } | 643 | 288 | } | 644 | 288 | } 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 | 288 | return true; | 679 | 288 | } |
_ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_12Decimal128V3ENS_7DecimalIlEELb0ELb1EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKT3_RKNS5_10NativeTypeESF_RNS_14CastParametersE Line | Count | Source | 609 | 350 | CastParameters& params) { | 610 | 350 | MaxNativeType res; | 611 | 350 | if (from >= FromCppT(0)) { | 612 | 350 | 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 | 350 | } else { | 625 | 350 | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 626 | 350 | if (UNLIKELY(res > max_result)) { | 627 | 132 | if (params.is_strict) { | 628 | 66 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 629 | 66 | decimal_to_string(from.value, scale_from), | 630 | 66 | fmt::format("decimal({}, {})", precision_from, scale_from), | 631 | 66 | precision_to, scale_to); | 632 | 66 | } | 633 | 132 | return false; | 634 | 132 | } | 635 | 350 | } | 636 | 218 | 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 | 350 | } 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 | 350 | } |
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 | 288 | CastParameters& params) { | 610 | 288 | MaxNativeType res; | 611 | 288 | 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 | 288 | } else { | 638 | | if constexpr (IsDecimal128V2<FromCppT>) { | 639 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 640 | 288 | } else { | 641 | 288 | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 642 | 288 | } | 643 | 288 | } | 644 | 288 | } 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 | 288 | return true; | 679 | 288 | } |
_ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_7DecimalIN4wide7integerILm256EiEEEENS2_IlEELb0ELb1ES5_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKT3_RKNS8_10NativeTypeESI_RNS_14CastParametersE Line | Count | Source | 609 | 384 | CastParameters& params) { | 610 | 384 | MaxNativeType res; | 611 | 384 | if (from >= FromCppT(0)) { | 612 | 384 | 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 | 384 | } else { | 625 | 384 | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 626 | 384 | if (UNLIKELY(res > max_result)) { | 627 | 160 | if (params.is_strict) { | 628 | 80 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 629 | 80 | decimal_to_string(from.value, scale_from), | 630 | 80 | fmt::format("decimal({}, {})", precision_from, scale_from), | 631 | 80 | precision_to, scale_to); | 632 | 80 | } | 633 | 160 | return false; | 634 | 160 | } | 635 | 384 | } | 636 | 224 | 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 | 384 | } 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 | 384 | } |
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 | 184 | CastParameters& params) { | 610 | 184 | MaxNativeType res; | 611 | 184 | 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 | 184 | } else { | 638 | | if constexpr (IsDecimal128V2<FromCppT>) { | 639 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 640 | 184 | } else { | 641 | 184 | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 642 | 184 | } | 643 | 184 | } | 644 | 184 | } 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 | 184 | return true; | 679 | 184 | } |
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 | 352 | CastParameters& params) { | 610 | 352 | MaxNativeType res; | 611 | 352 | 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 | 352 | } else { | 638 | | if constexpr (IsDecimal128V2<FromCppT>) { | 639 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 640 | 352 | } else { | 641 | 352 | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 642 | 352 | } | 643 | 352 | } | 644 | 352 | } 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 | 352 | return true; | 679 | 352 | } |
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 | 352 | CastParameters& params) { | 610 | 352 | MaxNativeType res; | 611 | 352 | 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 | 352 | } else { | 638 | | if constexpr (IsDecimal128V2<FromCppT>) { | 639 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 640 | 352 | } else { | 641 | 352 | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 642 | 352 | } | 643 | 352 | } | 644 | 352 | } 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 | 352 | return true; | 679 | 352 | } |
_ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_12Decimal128V3ES2_Lb0ELb1EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS4_jjRS3_jjRKT3_RKNS3_10NativeTypeESD_RNS_14CastParametersE Line | Count | Source | 609 | 96 | CastParameters& params) { | 610 | 96 | MaxNativeType res; | 611 | 96 | if (from >= FromCppT(0)) { | 612 | 96 | 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 | 96 | } else { | 625 | 96 | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 626 | 96 | if (UNLIKELY(res > max_result)) { | 627 | 40 | if (params.is_strict) { | 628 | 20 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 629 | 20 | decimal_to_string(from.value, scale_from), | 630 | 20 | fmt::format("decimal({}, {})", precision_from, scale_from), | 631 | 20 | precision_to, scale_to); | 632 | 20 | } | 633 | 40 | return false; | 634 | 40 | } | 635 | 96 | } | 636 | 56 | 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 | 96 | } 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 | 96 | } |
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 | 288 | CastParameters& params) { | 610 | 288 | MaxNativeType res; | 611 | 288 | 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 | 288 | } else { | 638 | | if constexpr (IsDecimal128V2<FromCppT>) { | 639 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 640 | 288 | } else { | 641 | 288 | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 642 | 288 | } | 643 | 288 | } | 644 | 288 | } 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 | 288 | return true; | 679 | 288 | } |
_ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_7DecimalIN4wide7integerILm256EiEEEENS_12Decimal128V3ELb0ELb1ES5_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKT3_RKNS8_10NativeTypeESI_RNS_14CastParametersE Line | Count | Source | 609 | 350 | CastParameters& params) { | 610 | 350 | MaxNativeType res; | 611 | 350 | if (from >= FromCppT(0)) { | 612 | 350 | 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 | 350 | } else { | 625 | 350 | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 626 | 350 | if (UNLIKELY(res > max_result)) { | 627 | 132 | if (params.is_strict) { | 628 | 66 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 629 | 66 | decimal_to_string(from.value, scale_from), | 630 | 66 | fmt::format("decimal({}, {})", precision_from, scale_from), | 631 | 66 | precision_to, scale_to); | 632 | 66 | } | 633 | 132 | return false; | 634 | 132 | } | 635 | 350 | } | 636 | 218 | 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 | 350 | } 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 | 350 | } |
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 | 184 | CastParameters& params) { | 610 | 184 | MaxNativeType res; | 611 | 184 | 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 | 184 | } else { | 638 | | if constexpr (IsDecimal128V2<FromCppT>) { | 639 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 640 | 184 | } else { | 641 | 184 | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 642 | 184 | } | 643 | 184 | } | 644 | 184 | } 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 | 184 | return true; | 679 | 184 | } |
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 | 352 | CastParameters& params) { | 610 | 352 | MaxNativeType res; | 611 | 352 | 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 | 352 | } else { | 638 | | if constexpr (IsDecimal128V2<FromCppT>) { | 639 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 640 | 352 | } else { | 641 | 352 | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 642 | 352 | } | 643 | 352 | } | 644 | 352 | } 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 | 352 | return true; | 679 | 352 | } |
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 | 352 | CastParameters& params) { | 610 | 352 | MaxNativeType res; | 611 | 352 | 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 | 352 | } else { | 638 | | if constexpr (IsDecimal128V2<FromCppT>) { | 639 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 640 | 352 | } else { | 641 | 352 | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 642 | 352 | } | 643 | 352 | } | 644 | 352 | } 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 | 352 | return true; | 679 | 352 | } |
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 | 352 | CastParameters& params) { | 610 | 352 | MaxNativeType res; | 611 | 352 | 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 | 352 | } else { | 638 | | if constexpr (IsDecimal128V2<FromCppT>) { | 639 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 640 | 352 | } else { | 641 | 352 | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 642 | 352 | } | 643 | 352 | } | 644 | 352 | } 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 | 352 | return true; | 679 | 352 | } |
_ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_7DecimalIN4wide7integerILm256EiEEEES6_Lb0ELb1ES5_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS8_jjRS7_jjRKT3_RKNS7_10NativeTypeESH_RNS_14CastParametersE Line | Count | Source | 609 | 96 | CastParameters& params) { | 610 | 96 | MaxNativeType res; | 611 | 96 | if (from >= FromCppT(0)) { | 612 | 96 | 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 | 96 | } else { | 625 | 96 | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 626 | 96 | if (UNLIKELY(res > max_result)) { | 627 | 40 | if (params.is_strict) { | 628 | 20 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 629 | 20 | decimal_to_string(from.value, scale_from), | 630 | 20 | fmt::format("decimal({}, {})", precision_from, scale_from), | 631 | 20 | precision_to, scale_to); | 632 | 20 | } | 633 | 40 | return false; | 634 | 40 | } | 635 | 96 | } | 636 | 56 | 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 | 96 | } 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 | 96 | } |
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 | 32 | CastParameters& params) { | 610 | 32 | MaxNativeType res; | 611 | 32 | 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 | 32 | } else { | 638 | 32 | if constexpr (IsDecimal128V2<FromCppT>) { | 639 | 32 | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 640 | | } else { | 641 | | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 642 | | } | 643 | 32 | } | 644 | 32 | } 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 | 32 | return true; | 679 | 32 | } |
_ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_14DecimalV2ValueENS_7DecimalIiEELb0ELb1EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKT3_RKNS5_10NativeTypeESF_RNS_14CastParametersE Line | Count | Source | 609 | 435 | CastParameters& params) { | 610 | 435 | MaxNativeType res; | 611 | 435 | if (from >= FromCppT(0)) { | 612 | 435 | if constexpr (narrow_integral) { | 613 | 435 | if constexpr (IsDecimal128V2<FromCppT>) { | 614 | 435 | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 615 | 435 | if (UNLIKELY(res > max_result)) { | 616 | 156 | if (params.is_strict) { | 617 | 78 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 618 | 78 | decimal_to_string(from.value(), scale_from), | 619 | 78 | fmt::format("decimal({}, {})", precision_from, scale_from), | 620 | 78 | precision_to, scale_to); | 621 | 78 | } | 622 | 156 | return false; | 623 | 156 | } | 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 | 279 | 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 | 435 | } 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 | 435 | } |
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 | 124 | CastParameters& params) { | 610 | 124 | MaxNativeType res; | 611 | 124 | 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 | 124 | } else { | 638 | 124 | if constexpr (IsDecimal128V2<FromCppT>) { | 639 | 124 | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 640 | | } else { | 641 | | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 642 | | } | 643 | 124 | } | 644 | 124 | } 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 | 124 | return true; | 679 | 124 | } |
_ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_14DecimalV2ValueENS_7DecimalIlEELb0ELb1EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKT3_RKNS5_10NativeTypeESF_RNS_14CastParametersE Line | Count | Source | 609 | 354 | CastParameters& params) { | 610 | 354 | MaxNativeType res; | 611 | 354 | if (from >= FromCppT(0)) { | 612 | 354 | if constexpr (narrow_integral) { | 613 | 354 | if constexpr (IsDecimal128V2<FromCppT>) { | 614 | 354 | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 615 | 354 | if (UNLIKELY(res > max_result)) { | 616 | 84 | if (params.is_strict) { | 617 | 42 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 618 | 42 | decimal_to_string(from.value(), scale_from), | 619 | 42 | fmt::format("decimal({}, {})", precision_from, scale_from), | 620 | 42 | precision_to, scale_to); | 621 | 42 | } | 622 | 84 | return false; | 623 | 84 | } | 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 | 270 | 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 | 354 | } 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 | 354 | } |
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 | 364 | CastParameters& params) { | 610 | 364 | MaxNativeType res; | 611 | 364 | 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 | 364 | } else { | 638 | 364 | if constexpr (IsDecimal128V2<FromCppT>) { | 639 | 364 | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 640 | | } else { | 641 | | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 642 | | } | 643 | 364 | } | 644 | 364 | } 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 | 364 | return true; | 679 | 364 | } |
_ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_14DecimalV2ValueENS_12Decimal128V3ELb0ELb1EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 609 | 50 | CastParameters& params) { | 610 | 50 | MaxNativeType res; | 611 | 50 | if (from >= FromCppT(0)) { | 612 | 50 | if constexpr (narrow_integral) { | 613 | 50 | if constexpr (IsDecimal128V2<FromCppT>) { | 614 | 50 | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 615 | 50 | if (UNLIKELY(res > max_result)) { | 616 | 4 | if (params.is_strict) { | 617 | 2 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 618 | 2 | decimal_to_string(from.value(), scale_from), | 619 | 2 | fmt::format("decimal({}, {})", precision_from, scale_from), | 620 | 2 | precision_to, scale_to); | 621 | 2 | } | 622 | 4 | return false; | 623 | 4 | } | 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 | 46 | 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 | 50 | } 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 | 50 | } |
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 | 412 | CastParameters& params) { | 610 | 412 | MaxNativeType res; | 611 | 412 | 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 | 412 | } else { | 638 | 412 | if constexpr (IsDecimal128V2<FromCppT>) { | 639 | 412 | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 640 | | } else { | 641 | | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 642 | | } | 643 | 412 | } | 644 | 412 | } 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 | 412 | return true; | 679 | 412 | } |
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 | 5.86k | const NullMap::value_type* null_map = nullptr) const override { |
689 | 5.86k | const auto* col_from = check_and_get_column<DataTypeString::ColumnType>( |
690 | 5.86k | block.get_by_position(arguments[0]).column.get()); |
691 | | |
692 | 5.86k | auto to_type = block.get_by_position(result).type; |
693 | 5.86k | auto serde = remove_nullable(to_type)->get_serde(); |
694 | | |
695 | | // by default framework, to_type is already unwrapped nullable |
696 | 5.86k | MutableColumnPtr column_to = to_type->create_column(); |
697 | 5.86k | ColumnNullable::MutablePtr nullable_col_to = ColumnNullable::create( |
698 | 5.86k | std::move(column_to), ColumnUInt8::create(input_rows_count, 0)); |
699 | | |
700 | 5.86k | if constexpr (Mode == CastModeType::NonStrictMode) { |
701 | | // may write nulls to nullable_col_to |
702 | 2.89k | RETURN_IF_ERROR(serde->from_string_batch(*col_from, *nullable_col_to, {})); |
703 | 2.96k | } else if constexpr (Mode == CastModeType::StrictMode) { |
704 | | // WON'T write nulls to nullable_col_to, just raise errors. null_map is only used to skip invalid rows |
705 | 2.96k | RETURN_IF_ERROR(serde->from_string_strict_mode_batch( |
706 | 2.96k | *col_from, nullable_col_to->get_nested_column(), {}, null_map)); |
707 | | } else { |
708 | | return Status::InternalError("Unsupported cast mode"); |
709 | | } |
710 | | |
711 | 5.45k | block.get_by_position(result).column = std::move(nullable_col_to); |
712 | 5.86k | return Status::OK(); |
713 | 5.86k | } 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 | 854 | const NullMap::value_type* null_map = nullptr) const override { | 689 | 854 | const auto* col_from = check_and_get_column<DataTypeString::ColumnType>( | 690 | 854 | block.get_by_position(arguments[0]).column.get()); | 691 | | | 692 | 854 | auto to_type = block.get_by_position(result).type; | 693 | 854 | auto serde = remove_nullable(to_type)->get_serde(); | 694 | | | 695 | | // by default framework, to_type is already unwrapped nullable | 696 | 854 | MutableColumnPtr column_to = to_type->create_column(); | 697 | 854 | ColumnNullable::MutablePtr nullable_col_to = ColumnNullable::create( | 698 | 854 | std::move(column_to), ColumnUInt8::create(input_rows_count, 0)); | 699 | | | 700 | | if constexpr (Mode == CastModeType::NonStrictMode) { | 701 | | // may write nulls to nullable_col_to | 702 | | RETURN_IF_ERROR(serde->from_string_batch(*col_from, *nullable_col_to, {})); | 703 | 854 | } else if constexpr (Mode == CastModeType::StrictMode) { | 704 | | // WON'T write nulls to nullable_col_to, just raise errors. null_map is only used to skip invalid rows | 705 | 854 | RETURN_IF_ERROR(serde->from_string_strict_mode_batch( | 706 | 854 | *col_from, nullable_col_to->get_nested_column(), {}, null_map)); | 707 | | } else { | 708 | | return Status::InternalError("Unsupported cast mode"); | 709 | | } | 710 | | | 711 | 665 | block.get_by_position(result).column = std::move(nullable_col_to); | 712 | 854 | return Status::OK(); | 713 | 854 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeStringENS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 688 | 782 | const NullMap::value_type* null_map = nullptr) const override { | 689 | 782 | const auto* col_from = check_and_get_column<DataTypeString::ColumnType>( | 690 | 782 | block.get_by_position(arguments[0]).column.get()); | 691 | | | 692 | 782 | auto to_type = block.get_by_position(result).type; | 693 | 782 | auto serde = remove_nullable(to_type)->get_serde(); | 694 | | | 695 | | // by default framework, to_type is already unwrapped nullable | 696 | 782 | MutableColumnPtr column_to = to_type->create_column(); | 697 | 782 | ColumnNullable::MutablePtr nullable_col_to = ColumnNullable::create( | 698 | 782 | std::move(column_to), ColumnUInt8::create(input_rows_count, 0)); | 699 | | | 700 | 782 | if constexpr (Mode == CastModeType::NonStrictMode) { | 701 | | // may write nulls to nullable_col_to | 702 | 782 | RETURN_IF_ERROR(serde->from_string_batch(*col_from, *nullable_col_to, {})); | 703 | | } else if constexpr (Mode == CastModeType::StrictMode) { | 704 | | // WON'T write nulls to nullable_col_to, just raise errors. null_map is only used to skip invalid rows | 705 | | RETURN_IF_ERROR(serde->from_string_strict_mode_batch( | 706 | | *col_from, nullable_col_to->get_nested_column(), {}, null_map)); | 707 | | } else { | 708 | | return Status::InternalError("Unsupported cast mode"); | 709 | | } | 710 | | | 711 | 782 | block.get_by_position(result).column = std::move(nullable_col_to); | 712 | 782 | return Status::OK(); | 713 | 782 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeStringENS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 688 | 709 | const NullMap::value_type* null_map = nullptr) const override { | 689 | 709 | const auto* col_from = check_and_get_column<DataTypeString::ColumnType>( | 690 | 709 | block.get_by_position(arguments[0]).column.get()); | 691 | | | 692 | 709 | auto to_type = block.get_by_position(result).type; | 693 | 709 | auto serde = remove_nullable(to_type)->get_serde(); | 694 | | | 695 | | // by default framework, to_type is already unwrapped nullable | 696 | 709 | MutableColumnPtr column_to = to_type->create_column(); | 697 | 709 | ColumnNullable::MutablePtr nullable_col_to = ColumnNullable::create( | 698 | 709 | std::move(column_to), ColumnUInt8::create(input_rows_count, 0)); | 699 | | | 700 | | if constexpr (Mode == CastModeType::NonStrictMode) { | 701 | | // may write nulls to nullable_col_to | 702 | | RETURN_IF_ERROR(serde->from_string_batch(*col_from, *nullable_col_to, {})); | 703 | 709 | } else if constexpr (Mode == CastModeType::StrictMode) { | 704 | | // WON'T write nulls to nullable_col_to, just raise errors. null_map is only used to skip invalid rows | 705 | 709 | RETURN_IF_ERROR(serde->from_string_strict_mode_batch( | 706 | 709 | *col_from, nullable_col_to->get_nested_column(), {}, null_map)); | 707 | | } else { | 708 | | return Status::InternalError("Unsupported cast mode"); | 709 | | } | 710 | | | 711 | 631 | block.get_by_position(result).column = std::move(nullable_col_to); | 712 | 709 | return Status::OK(); | 713 | 709 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeStringENS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 688 | 709 | const NullMap::value_type* null_map = nullptr) const override { | 689 | 709 | const auto* col_from = check_and_get_column<DataTypeString::ColumnType>( | 690 | 709 | block.get_by_position(arguments[0]).column.get()); | 691 | | | 692 | 709 | auto to_type = block.get_by_position(result).type; | 693 | 709 | auto serde = remove_nullable(to_type)->get_serde(); | 694 | | | 695 | | // by default framework, to_type is already unwrapped nullable | 696 | 709 | MutableColumnPtr column_to = to_type->create_column(); | 697 | 709 | ColumnNullable::MutablePtr nullable_col_to = ColumnNullable::create( | 698 | 709 | std::move(column_to), ColumnUInt8::create(input_rows_count, 0)); | 699 | | | 700 | 709 | if constexpr (Mode == CastModeType::NonStrictMode) { | 701 | | // may write nulls to nullable_col_to | 702 | 709 | RETURN_IF_ERROR(serde->from_string_batch(*col_from, *nullable_col_to, {})); | 703 | | } else if constexpr (Mode == CastModeType::StrictMode) { | 704 | | // WON'T write nulls to nullable_col_to, just raise errors. null_map is only used to skip invalid rows | 705 | | RETURN_IF_ERROR(serde->from_string_strict_mode_batch( | 706 | | *col_from, nullable_col_to->get_nested_column(), {}, null_map)); | 707 | | } else { | 708 | | return Status::InternalError("Unsupported cast mode"); | 709 | | } | 710 | | | 711 | 709 | block.get_by_position(result).column = std::move(nullable_col_to); | 712 | 709 | return Status::OK(); | 713 | 709 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeStringENS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 688 | 709 | const NullMap::value_type* null_map = nullptr) const override { | 689 | 709 | const auto* col_from = check_and_get_column<DataTypeString::ColumnType>( | 690 | 709 | block.get_by_position(arguments[0]).column.get()); | 691 | | | 692 | 709 | auto to_type = block.get_by_position(result).type; | 693 | 709 | auto serde = remove_nullable(to_type)->get_serde(); | 694 | | | 695 | | // by default framework, to_type is already unwrapped nullable | 696 | 709 | MutableColumnPtr column_to = to_type->create_column(); | 697 | 709 | ColumnNullable::MutablePtr nullable_col_to = ColumnNullable::create( | 698 | 709 | std::move(column_to), ColumnUInt8::create(input_rows_count, 0)); | 699 | | | 700 | | if constexpr (Mode == CastModeType::NonStrictMode) { | 701 | | // may write nulls to nullable_col_to | 702 | | RETURN_IF_ERROR(serde->from_string_batch(*col_from, *nullable_col_to, {})); | 703 | 709 | } else if constexpr (Mode == CastModeType::StrictMode) { | 704 | | // WON'T write nulls to nullable_col_to, just raise errors. null_map is only used to skip invalid rows | 705 | 709 | RETURN_IF_ERROR(serde->from_string_strict_mode_batch( | 706 | 709 | *col_from, nullable_col_to->get_nested_column(), {}, null_map)); | 707 | | } else { | 708 | | return Status::InternalError("Unsupported cast mode"); | 709 | | } | 710 | | | 711 | 631 | block.get_by_position(result).column = std::move(nullable_col_to); | 712 | 709 | return Status::OK(); | 713 | 709 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeStringENS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 688 | 709 | const NullMap::value_type* null_map = nullptr) const override { | 689 | 709 | const auto* col_from = check_and_get_column<DataTypeString::ColumnType>( | 690 | 709 | block.get_by_position(arguments[0]).column.get()); | 691 | | | 692 | 709 | auto to_type = block.get_by_position(result).type; | 693 | 709 | auto serde = remove_nullable(to_type)->get_serde(); | 694 | | | 695 | | // by default framework, to_type is already unwrapped nullable | 696 | 709 | MutableColumnPtr column_to = to_type->create_column(); | 697 | 709 | ColumnNullable::MutablePtr nullable_col_to = ColumnNullable::create( | 698 | 709 | std::move(column_to), ColumnUInt8::create(input_rows_count, 0)); | 699 | | | 700 | 709 | if constexpr (Mode == CastModeType::NonStrictMode) { | 701 | | // may write nulls to nullable_col_to | 702 | 709 | RETURN_IF_ERROR(serde->from_string_batch(*col_from, *nullable_col_to, {})); | 703 | | } else if constexpr (Mode == CastModeType::StrictMode) { | 704 | | // WON'T write nulls to nullable_col_to, just raise errors. null_map is only used to skip invalid rows | 705 | | RETURN_IF_ERROR(serde->from_string_strict_mode_batch( | 706 | | *col_from, nullable_col_to->get_nested_column(), {}, null_map)); | 707 | | } else { | 708 | | return Status::InternalError("Unsupported cast mode"); | 709 | | } | 710 | | | 711 | 709 | block.get_by_position(result).column = std::move(nullable_col_to); | 712 | 709 | return Status::OK(); | 713 | 709 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeStringENS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 688 | 695 | const NullMap::value_type* null_map = nullptr) const override { | 689 | 695 | const auto* col_from = check_and_get_column<DataTypeString::ColumnType>( | 690 | 695 | block.get_by_position(arguments[0]).column.get()); | 691 | | | 692 | 695 | auto to_type = block.get_by_position(result).type; | 693 | 695 | auto serde = remove_nullable(to_type)->get_serde(); | 694 | | | 695 | | // by default framework, to_type is already unwrapped nullable | 696 | 695 | MutableColumnPtr column_to = to_type->create_column(); | 697 | 695 | ColumnNullable::MutablePtr nullable_col_to = ColumnNullable::create( | 698 | 695 | std::move(column_to), ColumnUInt8::create(input_rows_count, 0)); | 699 | | | 700 | | if constexpr (Mode == CastModeType::NonStrictMode) { | 701 | | // may write nulls to nullable_col_to | 702 | | RETURN_IF_ERROR(serde->from_string_batch(*col_from, *nullable_col_to, {})); | 703 | 695 | } else if constexpr (Mode == CastModeType::StrictMode) { | 704 | | // WON'T write nulls to nullable_col_to, just raise errors. null_map is only used to skip invalid rows | 705 | 695 | RETURN_IF_ERROR(serde->from_string_strict_mode_batch( | 706 | 695 | *col_from, nullable_col_to->get_nested_column(), {}, null_map)); | 707 | | } else { | 708 | | return Status::InternalError("Unsupported cast mode"); | 709 | | } | 710 | | | 711 | 631 | block.get_by_position(result).column = std::move(nullable_col_to); | 712 | 695 | return Status::OK(); | 713 | 695 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeStringENS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 688 | 695 | const NullMap::value_type* null_map = nullptr) const override { | 689 | 695 | const auto* col_from = check_and_get_column<DataTypeString::ColumnType>( | 690 | 695 | block.get_by_position(arguments[0]).column.get()); | 691 | | | 692 | 695 | auto to_type = block.get_by_position(result).type; | 693 | 695 | auto serde = remove_nullable(to_type)->get_serde(); | 694 | | | 695 | | // by default framework, to_type is already unwrapped nullable | 696 | 695 | MutableColumnPtr column_to = to_type->create_column(); | 697 | 695 | ColumnNullable::MutablePtr nullable_col_to = ColumnNullable::create( | 698 | 695 | std::move(column_to), ColumnUInt8::create(input_rows_count, 0)); | 699 | | | 700 | 695 | if constexpr (Mode == CastModeType::NonStrictMode) { | 701 | | // may write nulls to nullable_col_to | 702 | 695 | RETURN_IF_ERROR(serde->from_string_batch(*col_from, *nullable_col_to, {})); | 703 | | } else if constexpr (Mode == CastModeType::StrictMode) { | 704 | | // WON'T write nulls to nullable_col_to, just raise errors. null_map is only used to skip invalid rows | 705 | | RETURN_IF_ERROR(serde->from_string_strict_mode_batch( | 706 | | *col_from, nullable_col_to->get_nested_column(), {}, null_map)); | 707 | | } else { | 708 | | return Status::InternalError("Unsupported cast mode"); | 709 | | } | 710 | | | 711 | 695 | block.get_by_position(result).column = std::move(nullable_col_to); | 712 | 695 | return Status::OK(); | 713 | 695 | } |
|
714 | | }; |
715 | | |
716 | | // cast bool and int to decimal. when may overflow, result column is nullable. |
717 | | template <CastModeType CastMode, typename FromDataType, typename ToDataType> |
718 | | requires(IsDataTypeDecimal<ToDataType> && |
719 | | (IsDataTypeInt<FromDataType> || IsDataTypeBool<FromDataType>)) |
720 | | class CastToImpl<CastMode, FromDataType, ToDataType> : public CastToBase { |
721 | | public: |
722 | | Status execute_impl(FunctionContext* context, Block& block, const ColumnNumbers& arguments, |
723 | | uint32_t result, size_t input_rows_count, |
724 | 782 | const NullMap::value_type* null_map = nullptr) const override { |
725 | 782 | using FromFieldType = typename FromDataType::FieldType; |
726 | 782 | using ToFieldType = typename ToDataType::FieldType; |
727 | 782 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); |
728 | 782 | const auto* col_from = |
729 | 782 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); |
730 | 782 | if (!col_from) { |
731 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", |
732 | 0 | named_from.column->get_name()); |
733 | 0 | } |
734 | | |
735 | 782 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); |
736 | 782 | constexpr UInt32 from_scale = 0; |
737 | | |
738 | 782 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); |
739 | 782 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); |
740 | 782 | UInt32 to_precision = to_decimal_type.get_precision(); |
741 | 782 | ToDataType::check_type_precision(to_precision); |
742 | 782 | UInt32 to_scale = to_decimal_type.get_scale(); |
743 | 782 | ToDataType::check_type_scale(to_scale); |
744 | | |
745 | 782 | auto from_max_int_digit_count = from_precision - from_scale; |
746 | 782 | auto to_max_int_digit_count = to_precision - to_scale; |
747 | | // may overflow. nullable result column. |
748 | 782 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); |
749 | | // only in non-strict mode and may overflow, we set nullable |
750 | 782 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; |
751 | | |
752 | 782 | constexpr UInt32 to_max_digits = |
753 | 782 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); |
754 | 782 | bool multiply_may_overflow = false; |
755 | 782 | if (to_scale > from_scale) { |
756 | 483 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; |
757 | 483 | } |
758 | 782 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > |
759 | 782 | sizeof(typename ToFieldType::NativeType)), |
760 | 782 | FromFieldType, typename ToFieldType::NativeType>; |
761 | 782 | MaxNativeType scale_multiplier = |
762 | 782 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); |
763 | 782 | typename ToFieldType::NativeType max_result = |
764 | 782 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); |
765 | 782 | typename ToFieldType::NativeType min_result = -max_result; |
766 | | |
767 | 782 | ColumnUInt8::MutablePtr col_null_map_to; |
768 | 782 | NullMap::value_type* null_map_data = nullptr; |
769 | 782 | if (narrow_integral) { |
770 | 673 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); |
771 | 673 | null_map_data = col_null_map_to->get_data().data(); |
772 | 673 | } |
773 | | |
774 | 782 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); |
775 | 782 | const auto& vec_from = col_from->get_data(); |
776 | 782 | const auto* vec_from_data = vec_from.data(); |
777 | 782 | auto& vec_to = col_to->get_data(); |
778 | 782 | auto* vec_to_data = vec_to.data(); |
779 | | |
780 | 782 | CastParameters params; |
781 | 782 | params.is_strict = (CastMode == CastModeType::StrictMode); |
782 | 782 | size_t size = vec_from.size(); |
783 | | |
784 | 782 | RETURN_IF_ERROR(std::visit( |
785 | 782 | [&](auto multiply_may_overflow, auto narrow_integral) { |
786 | 782 | for (size_t i = 0; i < size; i++) { |
787 | 782 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, |
788 | 782 | typename ToDataType::FieldType, |
789 | 782 | multiply_may_overflow, narrow_integral>( |
790 | 782 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, |
791 | 782 | scale_multiplier, min_result, max_result, params)) { |
792 | 782 | if (set_nullable) { |
793 | 782 | null_map_data[i] = 1; |
794 | 782 | } else { |
795 | 782 | return params.status; |
796 | 782 | } |
797 | 782 | } |
798 | 782 | } |
799 | 782 | return Status::OK(); |
800 | 782 | }, |
801 | 782 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); |
802 | | |
803 | 401 | if (narrow_integral) { |
804 | 292 | block.get_by_position(result).column = |
805 | 292 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); |
806 | 292 | } else { |
807 | 109 | block.get_by_position(result).column = std::move(col_to); |
808 | 109 | } |
809 | 401 | return Status::OK(); |
810 | 782 | } _ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE2EEENS_15DataTypeDecimalILS3_20EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 724 | 2 | const NullMap::value_type* null_map = nullptr) const override { | 725 | 2 | using FromFieldType = typename FromDataType::FieldType; | 726 | 2 | using ToFieldType = typename ToDataType::FieldType; | 727 | 2 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 728 | 2 | const auto* col_from = | 729 | 2 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 730 | 2 | if (!col_from) { | 731 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 732 | 0 | named_from.column->get_name()); | 733 | 0 | } | 734 | | | 735 | 2 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 736 | 2 | constexpr UInt32 from_scale = 0; | 737 | | | 738 | 2 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 739 | 2 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 740 | 2 | UInt32 to_precision = to_decimal_type.get_precision(); | 741 | 2 | ToDataType::check_type_precision(to_precision); | 742 | 2 | UInt32 to_scale = to_decimal_type.get_scale(); | 743 | 2 | ToDataType::check_type_scale(to_scale); | 744 | | | 745 | 2 | auto from_max_int_digit_count = from_precision - from_scale; | 746 | 2 | auto to_max_int_digit_count = to_precision - to_scale; | 747 | | // may overflow. nullable result column. | 748 | 2 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 749 | | // only in non-strict mode and may overflow, we set nullable | 750 | 2 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 751 | | | 752 | 2 | constexpr UInt32 to_max_digits = | 753 | 2 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 754 | 2 | bool multiply_may_overflow = false; | 755 | 2 | if (to_scale > from_scale) { | 756 | 2 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 757 | 2 | } | 758 | 2 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 759 | 2 | sizeof(typename ToFieldType::NativeType)), | 760 | 2 | FromFieldType, typename ToFieldType::NativeType>; | 761 | 2 | MaxNativeType scale_multiplier = | 762 | 2 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 763 | 2 | typename ToFieldType::NativeType max_result = | 764 | 2 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 765 | 2 | typename ToFieldType::NativeType min_result = -max_result; | 766 | | | 767 | 2 | ColumnUInt8::MutablePtr col_null_map_to; | 768 | 2 | NullMap::value_type* null_map_data = nullptr; | 769 | 2 | if (narrow_integral) { | 770 | 2 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 771 | 2 | null_map_data = col_null_map_to->get_data().data(); | 772 | 2 | } | 773 | | | 774 | 2 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 775 | 2 | const auto& vec_from = col_from->get_data(); | 776 | 2 | const auto* vec_from_data = vec_from.data(); | 777 | 2 | auto& vec_to = col_to->get_data(); | 778 | 2 | auto* vec_to_data = vec_to.data(); | 779 | | | 780 | 2 | CastParameters params; | 781 | 2 | params.is_strict = (CastMode == CastModeType::StrictMode); | 782 | 2 | size_t size = vec_from.size(); | 783 | | | 784 | 2 | RETURN_IF_ERROR(std::visit( | 785 | 2 | [&](auto multiply_may_overflow, auto narrow_integral) { | 786 | 2 | for (size_t i = 0; i < size; i++) { | 787 | 2 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 788 | 2 | typename ToDataType::FieldType, | 789 | 2 | multiply_may_overflow, narrow_integral>( | 790 | 2 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 791 | 2 | scale_multiplier, min_result, max_result, params)) { | 792 | 2 | if (set_nullable) { | 793 | 2 | null_map_data[i] = 1; | 794 | 2 | } else { | 795 | 2 | return params.status; | 796 | 2 | } | 797 | 2 | } | 798 | 2 | } | 799 | 2 | return Status::OK(); | 800 | 2 | }, | 801 | 2 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 802 | | | 803 | 1 | if (narrow_integral) { | 804 | 1 | block.get_by_position(result).column = | 805 | 1 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 806 | 1 | } else { | 807 | 0 | block.get_by_position(result).column = std::move(col_to); | 808 | 0 | } | 809 | 1 | return Status::OK(); | 810 | 2 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE2EEENS_15DataTypeDecimalILS3_20EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 724 | 2 | const NullMap::value_type* null_map = nullptr) const override { | 725 | 2 | using FromFieldType = typename FromDataType::FieldType; | 726 | 2 | using ToFieldType = typename ToDataType::FieldType; | 727 | 2 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 728 | 2 | const auto* col_from = | 729 | 2 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 730 | 2 | if (!col_from) { | 731 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 732 | 0 | named_from.column->get_name()); | 733 | 0 | } | 734 | | | 735 | 2 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 736 | 2 | constexpr UInt32 from_scale = 0; | 737 | | | 738 | 2 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 739 | 2 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 740 | 2 | UInt32 to_precision = to_decimal_type.get_precision(); | 741 | 2 | ToDataType::check_type_precision(to_precision); | 742 | 2 | UInt32 to_scale = to_decimal_type.get_scale(); | 743 | 2 | ToDataType::check_type_scale(to_scale); | 744 | | | 745 | 2 | auto from_max_int_digit_count = from_precision - from_scale; | 746 | 2 | auto to_max_int_digit_count = to_precision - to_scale; | 747 | | // may overflow. nullable result column. | 748 | 2 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 749 | | // only in non-strict mode and may overflow, we set nullable | 750 | 2 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 751 | | | 752 | 2 | constexpr UInt32 to_max_digits = | 753 | 2 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 754 | 2 | bool multiply_may_overflow = false; | 755 | 2 | if (to_scale > from_scale) { | 756 | 2 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 757 | 2 | } | 758 | 2 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 759 | 2 | sizeof(typename ToFieldType::NativeType)), | 760 | 2 | FromFieldType, typename ToFieldType::NativeType>; | 761 | 2 | MaxNativeType scale_multiplier = | 762 | 2 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 763 | 2 | typename ToFieldType::NativeType max_result = | 764 | 2 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 765 | 2 | typename ToFieldType::NativeType min_result = -max_result; | 766 | | | 767 | 2 | ColumnUInt8::MutablePtr col_null_map_to; | 768 | 2 | NullMap::value_type* null_map_data = nullptr; | 769 | 2 | if (narrow_integral) { | 770 | 1 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 771 | 1 | null_map_data = col_null_map_to->get_data().data(); | 772 | 1 | } | 773 | | | 774 | 2 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 775 | 2 | const auto& vec_from = col_from->get_data(); | 776 | 2 | const auto* vec_from_data = vec_from.data(); | 777 | 2 | auto& vec_to = col_to->get_data(); | 778 | 2 | auto* vec_to_data = vec_to.data(); | 779 | | | 780 | 2 | CastParameters params; | 781 | 2 | params.is_strict = (CastMode == CastModeType::StrictMode); | 782 | 2 | size_t size = vec_from.size(); | 783 | | | 784 | 2 | RETURN_IF_ERROR(std::visit( | 785 | 2 | [&](auto multiply_may_overflow, auto narrow_integral) { | 786 | 2 | for (size_t i = 0; i < size; i++) { | 787 | 2 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 788 | 2 | typename ToDataType::FieldType, | 789 | 2 | multiply_may_overflow, narrow_integral>( | 790 | 2 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 791 | 2 | scale_multiplier, min_result, max_result, params)) { | 792 | 2 | if (set_nullable) { | 793 | 2 | null_map_data[i] = 1; | 794 | 2 | } else { | 795 | 2 | return params.status; | 796 | 2 | } | 797 | 2 | } | 798 | 2 | } | 799 | 2 | return Status::OK(); | 800 | 2 | }, | 801 | 2 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 802 | | | 803 | 2 | if (narrow_integral) { | 804 | 1 | block.get_by_position(result).column = | 805 | 1 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 806 | 1 | } else { | 807 | 1 | block.get_by_position(result).column = std::move(col_to); | 808 | 1 | } | 809 | 2 | return Status::OK(); | 810 | 2 | } |
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 | 724 | 2 | const NullMap::value_type* null_map = nullptr) const override { | 725 | 2 | using FromFieldType = typename FromDataType::FieldType; | 726 | 2 | using ToFieldType = typename ToDataType::FieldType; | 727 | 2 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 728 | 2 | const auto* col_from = | 729 | 2 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 730 | 2 | if (!col_from) { | 731 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 732 | 0 | named_from.column->get_name()); | 733 | 0 | } | 734 | | | 735 | 2 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 736 | 2 | constexpr UInt32 from_scale = 0; | 737 | | | 738 | 2 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 739 | 2 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 740 | 2 | UInt32 to_precision = to_decimal_type.get_precision(); | 741 | 2 | ToDataType::check_type_precision(to_precision); | 742 | 2 | UInt32 to_scale = to_decimal_type.get_scale(); | 743 | 2 | ToDataType::check_type_scale(to_scale); | 744 | | | 745 | 2 | auto from_max_int_digit_count = from_precision - from_scale; | 746 | 2 | auto to_max_int_digit_count = to_precision - to_scale; | 747 | | // may overflow. nullable result column. | 748 | 2 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 749 | | // only in non-strict mode and may overflow, we set nullable | 750 | 2 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 751 | | | 752 | 2 | constexpr UInt32 to_max_digits = | 753 | 2 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 754 | 2 | bool multiply_may_overflow = false; | 755 | 2 | if (to_scale > from_scale) { | 756 | 2 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 757 | 2 | } | 758 | 2 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 759 | 2 | sizeof(typename ToFieldType::NativeType)), | 760 | 2 | FromFieldType, typename ToFieldType::NativeType>; | 761 | 2 | MaxNativeType scale_multiplier = | 762 | 2 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 763 | 2 | typename ToFieldType::NativeType max_result = | 764 | 2 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 765 | 2 | typename ToFieldType::NativeType min_result = -max_result; | 766 | | | 767 | 2 | ColumnUInt8::MutablePtr col_null_map_to; | 768 | 2 | NullMap::value_type* null_map_data = nullptr; | 769 | 2 | if (narrow_integral) { | 770 | 2 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 771 | 2 | null_map_data = col_null_map_to->get_data().data(); | 772 | 2 | } | 773 | | | 774 | 2 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 775 | 2 | const auto& vec_from = col_from->get_data(); | 776 | 2 | const auto* vec_from_data = vec_from.data(); | 777 | 2 | auto& vec_to = col_to->get_data(); | 778 | 2 | auto* vec_to_data = vec_to.data(); | 779 | | | 780 | 2 | CastParameters params; | 781 | 2 | params.is_strict = (CastMode == CastModeType::StrictMode); | 782 | 2 | size_t size = vec_from.size(); | 783 | | | 784 | 2 | RETURN_IF_ERROR(std::visit( | 785 | 2 | [&](auto multiply_may_overflow, auto narrow_integral) { | 786 | 2 | for (size_t i = 0; i < size; i++) { | 787 | 2 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 788 | 2 | typename ToDataType::FieldType, | 789 | 2 | multiply_may_overflow, narrow_integral>( | 790 | 2 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 791 | 2 | scale_multiplier, min_result, max_result, params)) { | 792 | 2 | if (set_nullable) { | 793 | 2 | null_map_data[i] = 1; | 794 | 2 | } else { | 795 | 2 | return params.status; | 796 | 2 | } | 797 | 2 | } | 798 | 2 | } | 799 | 2 | return Status::OK(); | 800 | 2 | }, | 801 | 2 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 802 | | | 803 | 1 | if (narrow_integral) { | 804 | 1 | block.get_by_position(result).column = | 805 | 1 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 806 | 1 | } else { | 807 | 0 | block.get_by_position(result).column = std::move(col_to); | 808 | 0 | } | 809 | 1 | return Status::OK(); | 810 | 2 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE2EEENS_15DataTypeDecimalILS3_28EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 724 | 5 | const NullMap::value_type* null_map = nullptr) const override { | 725 | 5 | using FromFieldType = typename FromDataType::FieldType; | 726 | 5 | using ToFieldType = typename ToDataType::FieldType; | 727 | 5 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 728 | 5 | const auto* col_from = | 729 | 5 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 730 | 5 | if (!col_from) { | 731 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 732 | 0 | named_from.column->get_name()); | 733 | 0 | } | 734 | | | 735 | 5 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 736 | 5 | constexpr UInt32 from_scale = 0; | 737 | | | 738 | 5 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 739 | 5 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 740 | 5 | UInt32 to_precision = to_decimal_type.get_precision(); | 741 | 5 | ToDataType::check_type_precision(to_precision); | 742 | 5 | UInt32 to_scale = to_decimal_type.get_scale(); | 743 | 5 | ToDataType::check_type_scale(to_scale); | 744 | | | 745 | 5 | auto from_max_int_digit_count = from_precision - from_scale; | 746 | 5 | auto to_max_int_digit_count = to_precision - to_scale; | 747 | | // may overflow. nullable result column. | 748 | 5 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 749 | | // only in non-strict mode and may overflow, we set nullable | 750 | 5 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 751 | | | 752 | 5 | constexpr UInt32 to_max_digits = | 753 | 5 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 754 | 5 | bool multiply_may_overflow = false; | 755 | 5 | if (to_scale > from_scale) { | 756 | 4 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 757 | 4 | } | 758 | 5 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 759 | 5 | sizeof(typename ToFieldType::NativeType)), | 760 | 5 | FromFieldType, typename ToFieldType::NativeType>; | 761 | 5 | MaxNativeType scale_multiplier = | 762 | 5 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 763 | 5 | typename ToFieldType::NativeType max_result = | 764 | 5 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 765 | 5 | typename ToFieldType::NativeType min_result = -max_result; | 766 | | | 767 | 5 | ColumnUInt8::MutablePtr col_null_map_to; | 768 | 5 | NullMap::value_type* null_map_data = nullptr; | 769 | 5 | if (narrow_integral) { | 770 | 1 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 771 | 1 | null_map_data = col_null_map_to->get_data().data(); | 772 | 1 | } | 773 | | | 774 | 5 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 775 | 5 | const auto& vec_from = col_from->get_data(); | 776 | 5 | const auto* vec_from_data = vec_from.data(); | 777 | 5 | auto& vec_to = col_to->get_data(); | 778 | 5 | auto* vec_to_data = vec_to.data(); | 779 | | | 780 | 5 | CastParameters params; | 781 | 5 | params.is_strict = (CastMode == CastModeType::StrictMode); | 782 | 5 | size_t size = vec_from.size(); | 783 | | | 784 | 5 | RETURN_IF_ERROR(std::visit( | 785 | 5 | [&](auto multiply_may_overflow, auto narrow_integral) { | 786 | 5 | for (size_t i = 0; i < size; i++) { | 787 | 5 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 788 | 5 | typename ToDataType::FieldType, | 789 | 5 | multiply_may_overflow, narrow_integral>( | 790 | 5 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 791 | 5 | scale_multiplier, min_result, max_result, params)) { | 792 | 5 | if (set_nullable) { | 793 | 5 | null_map_data[i] = 1; | 794 | 5 | } else { | 795 | 5 | return params.status; | 796 | 5 | } | 797 | 5 | } | 798 | 5 | } | 799 | 5 | return Status::OK(); | 800 | 5 | }, | 801 | 5 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 802 | | | 803 | 5 | if (narrow_integral) { | 804 | 1 | block.get_by_position(result).column = | 805 | 1 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 806 | 4 | } else { | 807 | 4 | block.get_by_position(result).column = std::move(col_to); | 808 | 4 | } | 809 | 5 | return Status::OK(); | 810 | 5 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE3EEENS_15DataTypeDecimalILS3_28EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 724 | 23 | const NullMap::value_type* null_map = nullptr) const override { | 725 | 23 | using FromFieldType = typename FromDataType::FieldType; | 726 | 23 | using ToFieldType = typename ToDataType::FieldType; | 727 | 23 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 728 | 23 | const auto* col_from = | 729 | 23 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 730 | 23 | if (!col_from) { | 731 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 732 | 0 | named_from.column->get_name()); | 733 | 0 | } | 734 | | | 735 | 23 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 736 | 23 | constexpr UInt32 from_scale = 0; | 737 | | | 738 | 23 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 739 | 23 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 740 | 23 | UInt32 to_precision = to_decimal_type.get_precision(); | 741 | 23 | ToDataType::check_type_precision(to_precision); | 742 | 23 | UInt32 to_scale = to_decimal_type.get_scale(); | 743 | 23 | ToDataType::check_type_scale(to_scale); | 744 | | | 745 | 23 | auto from_max_int_digit_count = from_precision - from_scale; | 746 | 23 | auto to_max_int_digit_count = to_precision - to_scale; | 747 | | // may overflow. nullable result column. | 748 | 23 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 749 | | // only in non-strict mode and may overflow, we set nullable | 750 | 23 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 751 | | | 752 | 23 | constexpr UInt32 to_max_digits = | 753 | 23 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 754 | 23 | bool multiply_may_overflow = false; | 755 | 23 | if (to_scale > from_scale) { | 756 | 16 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 757 | 16 | } | 758 | 23 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 759 | 23 | sizeof(typename ToFieldType::NativeType)), | 760 | 23 | FromFieldType, typename ToFieldType::NativeType>; | 761 | 23 | MaxNativeType scale_multiplier = | 762 | 23 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 763 | 23 | typename ToFieldType::NativeType max_result = | 764 | 23 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 765 | 23 | typename ToFieldType::NativeType min_result = -max_result; | 766 | | | 767 | 23 | ColumnUInt8::MutablePtr col_null_map_to; | 768 | 23 | NullMap::value_type* null_map_data = nullptr; | 769 | 23 | if (narrow_integral) { | 770 | 20 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 771 | 20 | null_map_data = col_null_map_to->get_data().data(); | 772 | 20 | } | 773 | | | 774 | 23 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 775 | 23 | const auto& vec_from = col_from->get_data(); | 776 | 23 | const auto* vec_from_data = vec_from.data(); | 777 | 23 | auto& vec_to = col_to->get_data(); | 778 | 23 | auto* vec_to_data = vec_to.data(); | 779 | | | 780 | 23 | CastParameters params; | 781 | 23 | params.is_strict = (CastMode == CastModeType::StrictMode); | 782 | 23 | size_t size = vec_from.size(); | 783 | | | 784 | 23 | RETURN_IF_ERROR(std::visit( | 785 | 23 | [&](auto multiply_may_overflow, auto narrow_integral) { | 786 | 23 | for (size_t i = 0; i < size; i++) { | 787 | 23 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 788 | 23 | typename ToDataType::FieldType, | 789 | 23 | multiply_may_overflow, narrow_integral>( | 790 | 23 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 791 | 23 | scale_multiplier, min_result, max_result, params)) { | 792 | 23 | if (set_nullable) { | 793 | 23 | null_map_data[i] = 1; | 794 | 23 | } else { | 795 | 23 | return params.status; | 796 | 23 | } | 797 | 23 | } | 798 | 23 | } | 799 | 23 | return Status::OK(); | 800 | 23 | }, | 801 | 23 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 802 | | | 803 | 7 | if (narrow_integral) { | 804 | 4 | block.get_by_position(result).column = | 805 | 4 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 806 | 4 | } else { | 807 | 3 | block.get_by_position(result).column = std::move(col_to); | 808 | 3 | } | 809 | 7 | return Status::OK(); | 810 | 23 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE3EEENS_15DataTypeDecimalILS3_28EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 724 | 11 | const NullMap::value_type* null_map = nullptr) const override { | 725 | 11 | using FromFieldType = typename FromDataType::FieldType; | 726 | 11 | using ToFieldType = typename ToDataType::FieldType; | 727 | 11 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 728 | 11 | const auto* col_from = | 729 | 11 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 730 | 11 | if (!col_from) { | 731 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 732 | 0 | named_from.column->get_name()); | 733 | 0 | } | 734 | | | 735 | 11 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 736 | 11 | constexpr UInt32 from_scale = 0; | 737 | | | 738 | 11 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 739 | 11 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 740 | 11 | UInt32 to_precision = to_decimal_type.get_precision(); | 741 | 11 | ToDataType::check_type_precision(to_precision); | 742 | 11 | UInt32 to_scale = to_decimal_type.get_scale(); | 743 | 11 | ToDataType::check_type_scale(to_scale); | 744 | | | 745 | 11 | auto from_max_int_digit_count = from_precision - from_scale; | 746 | 11 | auto to_max_int_digit_count = to_precision - to_scale; | 747 | | // may overflow. nullable result column. | 748 | 11 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 749 | | // only in non-strict mode and may overflow, we set nullable | 750 | 11 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 751 | | | 752 | 11 | constexpr UInt32 to_max_digits = | 753 | 11 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 754 | 11 | bool multiply_may_overflow = false; | 755 | 11 | if (to_scale > from_scale) { | 756 | 7 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 757 | 7 | } | 758 | 11 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 759 | 11 | sizeof(typename ToFieldType::NativeType)), | 760 | 11 | FromFieldType, typename ToFieldType::NativeType>; | 761 | 11 | MaxNativeType scale_multiplier = | 762 | 11 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 763 | 11 | typename ToFieldType::NativeType max_result = | 764 | 11 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 765 | 11 | typename ToFieldType::NativeType min_result = -max_result; | 766 | | | 767 | 11 | ColumnUInt8::MutablePtr col_null_map_to; | 768 | 11 | NullMap::value_type* null_map_data = nullptr; | 769 | 11 | if (narrow_integral) { | 770 | 8 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 771 | 8 | null_map_data = col_null_map_to->get_data().data(); | 772 | 8 | } | 773 | | | 774 | 11 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 775 | 11 | const auto& vec_from = col_from->get_data(); | 776 | 11 | const auto* vec_from_data = vec_from.data(); | 777 | 11 | auto& vec_to = col_to->get_data(); | 778 | 11 | auto* vec_to_data = vec_to.data(); | 779 | | | 780 | 11 | CastParameters params; | 781 | 11 | params.is_strict = (CastMode == CastModeType::StrictMode); | 782 | 11 | size_t size = vec_from.size(); | 783 | | | 784 | 11 | RETURN_IF_ERROR(std::visit( | 785 | 11 | [&](auto multiply_may_overflow, auto narrow_integral) { | 786 | 11 | for (size_t i = 0; i < size; i++) { | 787 | 11 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 788 | 11 | typename ToDataType::FieldType, | 789 | 11 | multiply_may_overflow, narrow_integral>( | 790 | 11 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 791 | 11 | scale_multiplier, min_result, max_result, params)) { | 792 | 11 | if (set_nullable) { | 793 | 11 | null_map_data[i] = 1; | 794 | 11 | } else { | 795 | 11 | return params.status; | 796 | 11 | } | 797 | 11 | } | 798 | 11 | } | 799 | 11 | return Status::OK(); | 800 | 11 | }, | 801 | 11 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 802 | | | 803 | 11 | if (narrow_integral) { | 804 | 8 | block.get_by_position(result).column = | 805 | 8 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 806 | 8 | } else { | 807 | 3 | block.get_by_position(result).column = std::move(col_to); | 808 | 3 | } | 809 | 11 | return Status::OK(); | 810 | 11 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE4EEENS_15DataTypeDecimalILS3_28EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 724 | 27 | const NullMap::value_type* null_map = nullptr) const override { | 725 | 27 | using FromFieldType = typename FromDataType::FieldType; | 726 | 27 | using ToFieldType = typename ToDataType::FieldType; | 727 | 27 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 728 | 27 | const auto* col_from = | 729 | 27 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 730 | 27 | if (!col_from) { | 731 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 732 | 0 | named_from.column->get_name()); | 733 | 0 | } | 734 | | | 735 | 27 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 736 | 27 | constexpr UInt32 from_scale = 0; | 737 | | | 738 | 27 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 739 | 27 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 740 | 27 | UInt32 to_precision = to_decimal_type.get_precision(); | 741 | 27 | ToDataType::check_type_precision(to_precision); | 742 | 27 | UInt32 to_scale = to_decimal_type.get_scale(); | 743 | 27 | ToDataType::check_type_scale(to_scale); | 744 | | | 745 | 27 | auto from_max_int_digit_count = from_precision - from_scale; | 746 | 27 | auto to_max_int_digit_count = to_precision - to_scale; | 747 | | // may overflow. nullable result column. | 748 | 27 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 749 | | // only in non-strict mode and may overflow, we set nullable | 750 | 27 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 751 | | | 752 | 27 | constexpr UInt32 to_max_digits = | 753 | 27 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 754 | 27 | bool multiply_may_overflow = false; | 755 | 27 | if (to_scale > from_scale) { | 756 | 16 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 757 | 16 | } | 758 | 27 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 759 | 27 | sizeof(typename ToFieldType::NativeType)), | 760 | 27 | FromFieldType, typename ToFieldType::NativeType>; | 761 | 27 | MaxNativeType scale_multiplier = | 762 | 27 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 763 | 27 | typename ToFieldType::NativeType max_result = | 764 | 27 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 765 | 27 | typename ToFieldType::NativeType min_result = -max_result; | 766 | | | 767 | 27 | ColumnUInt8::MutablePtr col_null_map_to; | 768 | 27 | NullMap::value_type* null_map_data = nullptr; | 769 | 27 | if (narrow_integral) { | 770 | 25 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 771 | 25 | null_map_data = col_null_map_to->get_data().data(); | 772 | 25 | } | 773 | | | 774 | 27 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 775 | 27 | const auto& vec_from = col_from->get_data(); | 776 | 27 | const auto* vec_from_data = vec_from.data(); | 777 | 27 | auto& vec_to = col_to->get_data(); | 778 | 27 | auto* vec_to_data = vec_to.data(); | 779 | | | 780 | 27 | CastParameters params; | 781 | 27 | params.is_strict = (CastMode == CastModeType::StrictMode); | 782 | 27 | size_t size = vec_from.size(); | 783 | | | 784 | 27 | RETURN_IF_ERROR(std::visit( | 785 | 27 | [&](auto multiply_may_overflow, auto narrow_integral) { | 786 | 27 | for (size_t i = 0; i < size; i++) { | 787 | 27 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 788 | 27 | typename ToDataType::FieldType, | 789 | 27 | multiply_may_overflow, narrow_integral>( | 790 | 27 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 791 | 27 | scale_multiplier, min_result, max_result, params)) { | 792 | 27 | if (set_nullable) { | 793 | 27 | null_map_data[i] = 1; | 794 | 27 | } else { | 795 | 27 | return params.status; | 796 | 27 | } | 797 | 27 | } | 798 | 27 | } | 799 | 27 | return Status::OK(); | 800 | 27 | }, | 801 | 27 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 802 | | | 803 | 7 | if (narrow_integral) { | 804 | 5 | block.get_by_position(result).column = | 805 | 5 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 806 | 5 | } else { | 807 | 2 | block.get_by_position(result).column = std::move(col_to); | 808 | 2 | } | 809 | 7 | return Status::OK(); | 810 | 27 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE4EEENS_15DataTypeDecimalILS3_28EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 724 | 12 | const NullMap::value_type* null_map = nullptr) const override { | 725 | 12 | using FromFieldType = typename FromDataType::FieldType; | 726 | 12 | using ToFieldType = typename ToDataType::FieldType; | 727 | 12 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 728 | 12 | const auto* col_from = | 729 | 12 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 730 | 12 | if (!col_from) { | 731 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 732 | 0 | named_from.column->get_name()); | 733 | 0 | } | 734 | | | 735 | 12 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 736 | 12 | constexpr UInt32 from_scale = 0; | 737 | | | 738 | 12 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 739 | 12 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 740 | 12 | UInt32 to_precision = to_decimal_type.get_precision(); | 741 | 12 | ToDataType::check_type_precision(to_precision); | 742 | 12 | UInt32 to_scale = to_decimal_type.get_scale(); | 743 | 12 | ToDataType::check_type_scale(to_scale); | 744 | | | 745 | 12 | auto from_max_int_digit_count = from_precision - from_scale; | 746 | 12 | auto to_max_int_digit_count = to_precision - to_scale; | 747 | | // may overflow. nullable result column. | 748 | 12 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 749 | | // only in non-strict mode and may overflow, we set nullable | 750 | 12 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 751 | | | 752 | 12 | constexpr UInt32 to_max_digits = | 753 | 12 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 754 | 12 | bool multiply_may_overflow = false; | 755 | 12 | if (to_scale > from_scale) { | 756 | 7 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 757 | 7 | } | 758 | 12 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 759 | 12 | sizeof(typename ToFieldType::NativeType)), | 760 | 12 | FromFieldType, typename ToFieldType::NativeType>; | 761 | 12 | MaxNativeType scale_multiplier = | 762 | 12 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 763 | 12 | typename ToFieldType::NativeType max_result = | 764 | 12 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 765 | 12 | typename ToFieldType::NativeType min_result = -max_result; | 766 | | | 767 | 12 | ColumnUInt8::MutablePtr col_null_map_to; | 768 | 12 | NullMap::value_type* null_map_data = nullptr; | 769 | 12 | if (narrow_integral) { | 770 | 10 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 771 | 10 | null_map_data = col_null_map_to->get_data().data(); | 772 | 10 | } | 773 | | | 774 | 12 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 775 | 12 | const auto& vec_from = col_from->get_data(); | 776 | 12 | const auto* vec_from_data = vec_from.data(); | 777 | 12 | auto& vec_to = col_to->get_data(); | 778 | 12 | auto* vec_to_data = vec_to.data(); | 779 | | | 780 | 12 | CastParameters params; | 781 | 12 | params.is_strict = (CastMode == CastModeType::StrictMode); | 782 | 12 | size_t size = vec_from.size(); | 783 | | | 784 | 12 | RETURN_IF_ERROR(std::visit( | 785 | 12 | [&](auto multiply_may_overflow, auto narrow_integral) { | 786 | 12 | for (size_t i = 0; i < size; i++) { | 787 | 12 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 788 | 12 | typename ToDataType::FieldType, | 789 | 12 | multiply_may_overflow, narrow_integral>( | 790 | 12 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 791 | 12 | scale_multiplier, min_result, max_result, params)) { | 792 | 12 | if (set_nullable) { | 793 | 12 | null_map_data[i] = 1; | 794 | 12 | } else { | 795 | 12 | return params.status; | 796 | 12 | } | 797 | 12 | } | 798 | 12 | } | 799 | 12 | return Status::OK(); | 800 | 12 | }, | 801 | 12 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 802 | | | 803 | 12 | if (narrow_integral) { | 804 | 10 | block.get_by_position(result).column = | 805 | 10 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 806 | 10 | } else { | 807 | 2 | block.get_by_position(result).column = std::move(col_to); | 808 | 2 | } | 809 | 12 | return Status::OK(); | 810 | 12 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE5EEENS_15DataTypeDecimalILS3_28EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 724 | 35 | const NullMap::value_type* null_map = nullptr) const override { | 725 | 35 | using FromFieldType = typename FromDataType::FieldType; | 726 | 35 | using ToFieldType = typename ToDataType::FieldType; | 727 | 35 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 728 | 35 | const auto* col_from = | 729 | 35 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 730 | 35 | if (!col_from) { | 731 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 732 | 0 | named_from.column->get_name()); | 733 | 0 | } | 734 | | | 735 | 35 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 736 | 35 | constexpr UInt32 from_scale = 0; | 737 | | | 738 | 35 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 739 | 35 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 740 | 35 | UInt32 to_precision = to_decimal_type.get_precision(); | 741 | 35 | ToDataType::check_type_precision(to_precision); | 742 | 35 | UInt32 to_scale = to_decimal_type.get_scale(); | 743 | 35 | ToDataType::check_type_scale(to_scale); | 744 | | | 745 | 35 | auto from_max_int_digit_count = from_precision - from_scale; | 746 | 35 | auto to_max_int_digit_count = to_precision - to_scale; | 747 | | // may overflow. nullable result column. | 748 | 35 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 749 | | // only in non-strict mode and may overflow, we set nullable | 750 | 35 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 751 | | | 752 | 35 | constexpr UInt32 to_max_digits = | 753 | 35 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 754 | 35 | bool multiply_may_overflow = false; | 755 | 35 | if (to_scale > from_scale) { | 756 | 20 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 757 | 20 | } | 758 | 35 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 759 | 35 | sizeof(typename ToFieldType::NativeType)), | 760 | 35 | FromFieldType, typename ToFieldType::NativeType>; | 761 | 35 | MaxNativeType scale_multiplier = | 762 | 35 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 763 | 35 | typename ToFieldType::NativeType max_result = | 764 | 35 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 765 | 35 | typename ToFieldType::NativeType min_result = -max_result; | 766 | | | 767 | 35 | ColumnUInt8::MutablePtr col_null_map_to; | 768 | 35 | NullMap::value_type* null_map_data = nullptr; | 769 | 35 | if (narrow_integral) { | 770 | 35 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 771 | 35 | null_map_data = col_null_map_to->get_data().data(); | 772 | 35 | } | 773 | | | 774 | 35 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 775 | 35 | const auto& vec_from = col_from->get_data(); | 776 | 35 | const auto* vec_from_data = vec_from.data(); | 777 | 35 | auto& vec_to = col_to->get_data(); | 778 | 35 | auto* vec_to_data = vec_to.data(); | 779 | | | 780 | 35 | CastParameters params; | 781 | 35 | params.is_strict = (CastMode == CastModeType::StrictMode); | 782 | 35 | size_t size = vec_from.size(); | 783 | | | 784 | 35 | RETURN_IF_ERROR(std::visit( | 785 | 35 | [&](auto multiply_may_overflow, auto narrow_integral) { | 786 | 35 | for (size_t i = 0; i < size; i++) { | 787 | 35 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 788 | 35 | typename ToDataType::FieldType, | 789 | 35 | multiply_may_overflow, narrow_integral>( | 790 | 35 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 791 | 35 | scale_multiplier, min_result, max_result, params)) { | 792 | 35 | if (set_nullable) { | 793 | 35 | null_map_data[i] = 1; | 794 | 35 | } else { | 795 | 35 | return params.status; | 796 | 35 | } | 797 | 35 | } | 798 | 35 | } | 799 | 35 | return Status::OK(); | 800 | 35 | }, | 801 | 35 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 802 | | | 803 | 7 | if (narrow_integral) { | 804 | 7 | block.get_by_position(result).column = | 805 | 7 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 806 | 7 | } else { | 807 | 0 | block.get_by_position(result).column = std::move(col_to); | 808 | 0 | } | 809 | 7 | return Status::OK(); | 810 | 35 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE5EEENS_15DataTypeDecimalILS3_28EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 724 | 14 | const NullMap::value_type* null_map = nullptr) const override { | 725 | 14 | using FromFieldType = typename FromDataType::FieldType; | 726 | 14 | using ToFieldType = typename ToDataType::FieldType; | 727 | 14 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 728 | 14 | const auto* col_from = | 729 | 14 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 730 | 14 | if (!col_from) { | 731 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 732 | 0 | named_from.column->get_name()); | 733 | 0 | } | 734 | | | 735 | 14 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 736 | 14 | constexpr UInt32 from_scale = 0; | 737 | | | 738 | 14 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 739 | 14 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 740 | 14 | UInt32 to_precision = to_decimal_type.get_precision(); | 741 | 14 | ToDataType::check_type_precision(to_precision); | 742 | 14 | UInt32 to_scale = to_decimal_type.get_scale(); | 743 | 14 | ToDataType::check_type_scale(to_scale); | 744 | | | 745 | 14 | auto from_max_int_digit_count = from_precision - from_scale; | 746 | 14 | auto to_max_int_digit_count = to_precision - to_scale; | 747 | | // may overflow. nullable result column. | 748 | 14 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 749 | | // only in non-strict mode and may overflow, we set nullable | 750 | 14 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 751 | | | 752 | 14 | constexpr UInt32 to_max_digits = | 753 | 14 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 754 | 14 | bool multiply_may_overflow = false; | 755 | 14 | if (to_scale > from_scale) { | 756 | 8 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 757 | 8 | } | 758 | 14 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 759 | 14 | sizeof(typename ToFieldType::NativeType)), | 760 | 14 | FromFieldType, typename ToFieldType::NativeType>; | 761 | 14 | MaxNativeType scale_multiplier = | 762 | 14 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 763 | 14 | typename ToFieldType::NativeType max_result = | 764 | 14 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 765 | 14 | typename ToFieldType::NativeType min_result = -max_result; | 766 | | | 767 | 14 | ColumnUInt8::MutablePtr col_null_map_to; | 768 | 14 | NullMap::value_type* null_map_data = nullptr; | 769 | 14 | if (narrow_integral) { | 770 | 14 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 771 | 14 | null_map_data = col_null_map_to->get_data().data(); | 772 | 14 | } | 773 | | | 774 | 14 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 775 | 14 | const auto& vec_from = col_from->get_data(); | 776 | 14 | const auto* vec_from_data = vec_from.data(); | 777 | 14 | auto& vec_to = col_to->get_data(); | 778 | 14 | auto* vec_to_data = vec_to.data(); | 779 | | | 780 | 14 | CastParameters params; | 781 | 14 | params.is_strict = (CastMode == CastModeType::StrictMode); | 782 | 14 | size_t size = vec_from.size(); | 783 | | | 784 | 14 | RETURN_IF_ERROR(std::visit( | 785 | 14 | [&](auto multiply_may_overflow, auto narrow_integral) { | 786 | 14 | for (size_t i = 0; i < size; i++) { | 787 | 14 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 788 | 14 | typename ToDataType::FieldType, | 789 | 14 | multiply_may_overflow, narrow_integral>( | 790 | 14 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 791 | 14 | scale_multiplier, min_result, max_result, params)) { | 792 | 14 | if (set_nullable) { | 793 | 14 | null_map_data[i] = 1; | 794 | 14 | } else { | 795 | 14 | return params.status; | 796 | 14 | } | 797 | 14 | } | 798 | 14 | } | 799 | 14 | return Status::OK(); | 800 | 14 | }, | 801 | 14 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 802 | | | 803 | 14 | if (narrow_integral) { | 804 | 14 | block.get_by_position(result).column = | 805 | 14 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 806 | 14 | } else { | 807 | 0 | block.get_by_position(result).column = std::move(col_to); | 808 | 0 | } | 809 | 14 | return Status::OK(); | 810 | 14 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE6EEENS_15DataTypeDecimalILS3_28EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 724 | 35 | const NullMap::value_type* null_map = nullptr) const override { | 725 | 35 | using FromFieldType = typename FromDataType::FieldType; | 726 | 35 | using ToFieldType = typename ToDataType::FieldType; | 727 | 35 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 728 | 35 | const auto* col_from = | 729 | 35 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 730 | 35 | if (!col_from) { | 731 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 732 | 0 | named_from.column->get_name()); | 733 | 0 | } | 734 | | | 735 | 35 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 736 | 35 | constexpr UInt32 from_scale = 0; | 737 | | | 738 | 35 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 739 | 35 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 740 | 35 | UInt32 to_precision = to_decimal_type.get_precision(); | 741 | 35 | ToDataType::check_type_precision(to_precision); | 742 | 35 | UInt32 to_scale = to_decimal_type.get_scale(); | 743 | 35 | ToDataType::check_type_scale(to_scale); | 744 | | | 745 | 35 | auto from_max_int_digit_count = from_precision - from_scale; | 746 | 35 | auto to_max_int_digit_count = to_precision - to_scale; | 747 | | // may overflow. nullable result column. | 748 | 35 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 749 | | // only in non-strict mode and may overflow, we set nullable | 750 | 35 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 751 | | | 752 | 35 | constexpr UInt32 to_max_digits = | 753 | 35 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 754 | 35 | bool multiply_may_overflow = false; | 755 | 35 | if (to_scale > from_scale) { | 756 | 20 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 757 | 20 | } | 758 | 35 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 759 | 35 | sizeof(typename ToFieldType::NativeType)), | 760 | 35 | FromFieldType, typename ToFieldType::NativeType>; | 761 | 35 | MaxNativeType scale_multiplier = | 762 | 35 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 763 | 35 | typename ToFieldType::NativeType max_result = | 764 | 35 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 765 | 35 | typename ToFieldType::NativeType min_result = -max_result; | 766 | | | 767 | 35 | ColumnUInt8::MutablePtr col_null_map_to; | 768 | 35 | NullMap::value_type* null_map_data = nullptr; | 769 | 35 | if (narrow_integral) { | 770 | 35 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 771 | 35 | null_map_data = col_null_map_to->get_data().data(); | 772 | 35 | } | 773 | | | 774 | 35 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 775 | 35 | const auto& vec_from = col_from->get_data(); | 776 | 35 | const auto* vec_from_data = vec_from.data(); | 777 | 35 | auto& vec_to = col_to->get_data(); | 778 | 35 | auto* vec_to_data = vec_to.data(); | 779 | | | 780 | 35 | CastParameters params; | 781 | 35 | params.is_strict = (CastMode == CastModeType::StrictMode); | 782 | 35 | size_t size = vec_from.size(); | 783 | | | 784 | 35 | RETURN_IF_ERROR(std::visit( | 785 | 35 | [&](auto multiply_may_overflow, auto narrow_integral) { | 786 | 35 | for (size_t i = 0; i < size; i++) { | 787 | 35 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 788 | 35 | typename ToDataType::FieldType, | 789 | 35 | multiply_may_overflow, narrow_integral>( | 790 | 35 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 791 | 35 | scale_multiplier, min_result, max_result, params)) { | 792 | 35 | if (set_nullable) { | 793 | 35 | null_map_data[i] = 1; | 794 | 35 | } else { | 795 | 35 | return params.status; | 796 | 35 | } | 797 | 35 | } | 798 | 35 | } | 799 | 35 | return Status::OK(); | 800 | 35 | }, | 801 | 35 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 802 | | | 803 | 7 | if (narrow_integral) { | 804 | 7 | block.get_by_position(result).column = | 805 | 7 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 806 | 7 | } else { | 807 | 0 | block.get_by_position(result).column = std::move(col_to); | 808 | 0 | } | 809 | 7 | return Status::OK(); | 810 | 35 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE6EEENS_15DataTypeDecimalILS3_28EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 724 | 14 | const NullMap::value_type* null_map = nullptr) const override { | 725 | 14 | using FromFieldType = typename FromDataType::FieldType; | 726 | 14 | using ToFieldType = typename ToDataType::FieldType; | 727 | 14 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 728 | 14 | const auto* col_from = | 729 | 14 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 730 | 14 | if (!col_from) { | 731 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 732 | 0 | named_from.column->get_name()); | 733 | 0 | } | 734 | | | 735 | 14 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 736 | 14 | constexpr UInt32 from_scale = 0; | 737 | | | 738 | 14 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 739 | 14 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 740 | 14 | UInt32 to_precision = to_decimal_type.get_precision(); | 741 | 14 | ToDataType::check_type_precision(to_precision); | 742 | 14 | UInt32 to_scale = to_decimal_type.get_scale(); | 743 | 14 | ToDataType::check_type_scale(to_scale); | 744 | | | 745 | 14 | auto from_max_int_digit_count = from_precision - from_scale; | 746 | 14 | auto to_max_int_digit_count = to_precision - to_scale; | 747 | | // may overflow. nullable result column. | 748 | 14 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 749 | | // only in non-strict mode and may overflow, we set nullable | 750 | 14 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 751 | | | 752 | 14 | constexpr UInt32 to_max_digits = | 753 | 14 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 754 | 14 | bool multiply_may_overflow = false; | 755 | 14 | if (to_scale > from_scale) { | 756 | 8 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 757 | 8 | } | 758 | 14 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 759 | 14 | sizeof(typename ToFieldType::NativeType)), | 760 | 14 | FromFieldType, typename ToFieldType::NativeType>; | 761 | 14 | MaxNativeType scale_multiplier = | 762 | 14 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 763 | 14 | typename ToFieldType::NativeType max_result = | 764 | 14 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 765 | 14 | typename ToFieldType::NativeType min_result = -max_result; | 766 | | | 767 | 14 | ColumnUInt8::MutablePtr col_null_map_to; | 768 | 14 | NullMap::value_type* null_map_data = nullptr; | 769 | 14 | if (narrow_integral) { | 770 | 14 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 771 | 14 | null_map_data = col_null_map_to->get_data().data(); | 772 | 14 | } | 773 | | | 774 | 14 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 775 | 14 | const auto& vec_from = col_from->get_data(); | 776 | 14 | const auto* vec_from_data = vec_from.data(); | 777 | 14 | auto& vec_to = col_to->get_data(); | 778 | 14 | auto* vec_to_data = vec_to.data(); | 779 | | | 780 | 14 | CastParameters params; | 781 | 14 | params.is_strict = (CastMode == CastModeType::StrictMode); | 782 | 14 | size_t size = vec_from.size(); | 783 | | | 784 | 14 | RETURN_IF_ERROR(std::visit( | 785 | 14 | [&](auto multiply_may_overflow, auto narrow_integral) { | 786 | 14 | for (size_t i = 0; i < size; i++) { | 787 | 14 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 788 | 14 | typename ToDataType::FieldType, | 789 | 14 | multiply_may_overflow, narrow_integral>( | 790 | 14 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 791 | 14 | scale_multiplier, min_result, max_result, params)) { | 792 | 14 | if (set_nullable) { | 793 | 14 | null_map_data[i] = 1; | 794 | 14 | } else { | 795 | 14 | return params.status; | 796 | 14 | } | 797 | 14 | } | 798 | 14 | } | 799 | 14 | return Status::OK(); | 800 | 14 | }, | 801 | 14 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 802 | | | 803 | 14 | if (narrow_integral) { | 804 | 14 | block.get_by_position(result).column = | 805 | 14 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 806 | 14 | } else { | 807 | 0 | block.get_by_position(result).column = std::move(col_to); | 808 | 0 | } | 809 | 14 | return Status::OK(); | 810 | 14 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE7EEENS_15DataTypeDecimalILS3_28EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 724 | 35 | const NullMap::value_type* null_map = nullptr) const override { | 725 | 35 | using FromFieldType = typename FromDataType::FieldType; | 726 | 35 | using ToFieldType = typename ToDataType::FieldType; | 727 | 35 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 728 | 35 | const auto* col_from = | 729 | 35 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 730 | 35 | if (!col_from) { | 731 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 732 | 0 | named_from.column->get_name()); | 733 | 0 | } | 734 | | | 735 | 35 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 736 | 35 | constexpr UInt32 from_scale = 0; | 737 | | | 738 | 35 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 739 | 35 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 740 | 35 | UInt32 to_precision = to_decimal_type.get_precision(); | 741 | 35 | ToDataType::check_type_precision(to_precision); | 742 | 35 | UInt32 to_scale = to_decimal_type.get_scale(); | 743 | 35 | ToDataType::check_type_scale(to_scale); | 744 | | | 745 | 35 | auto from_max_int_digit_count = from_precision - from_scale; | 746 | 35 | auto to_max_int_digit_count = to_precision - to_scale; | 747 | | // may overflow. nullable result column. | 748 | 35 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 749 | | // only in non-strict mode and may overflow, we set nullable | 750 | 35 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 751 | | | 752 | 35 | constexpr UInt32 to_max_digits = | 753 | 35 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 754 | 35 | bool multiply_may_overflow = false; | 755 | 35 | if (to_scale > from_scale) { | 756 | 20 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 757 | 20 | } | 758 | 35 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 759 | 35 | sizeof(typename ToFieldType::NativeType)), | 760 | 35 | FromFieldType, typename ToFieldType::NativeType>; | 761 | 35 | MaxNativeType scale_multiplier = | 762 | 35 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 763 | 35 | typename ToFieldType::NativeType max_result = | 764 | 35 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 765 | 35 | typename ToFieldType::NativeType min_result = -max_result; | 766 | | | 767 | 35 | ColumnUInt8::MutablePtr col_null_map_to; | 768 | 35 | NullMap::value_type* null_map_data = nullptr; | 769 | 35 | if (narrow_integral) { | 770 | 35 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 771 | 35 | null_map_data = col_null_map_to->get_data().data(); | 772 | 35 | } | 773 | | | 774 | 35 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 775 | 35 | const auto& vec_from = col_from->get_data(); | 776 | 35 | const auto* vec_from_data = vec_from.data(); | 777 | 35 | auto& vec_to = col_to->get_data(); | 778 | 35 | auto* vec_to_data = vec_to.data(); | 779 | | | 780 | 35 | CastParameters params; | 781 | 35 | params.is_strict = (CastMode == CastModeType::StrictMode); | 782 | 35 | size_t size = vec_from.size(); | 783 | | | 784 | 35 | RETURN_IF_ERROR(std::visit( | 785 | 35 | [&](auto multiply_may_overflow, auto narrow_integral) { | 786 | 35 | for (size_t i = 0; i < size; i++) { | 787 | 35 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 788 | 35 | typename ToDataType::FieldType, | 789 | 35 | multiply_may_overflow, narrow_integral>( | 790 | 35 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 791 | 35 | scale_multiplier, min_result, max_result, params)) { | 792 | 35 | if (set_nullable) { | 793 | 35 | null_map_data[i] = 1; | 794 | 35 | } else { | 795 | 35 | return params.status; | 796 | 35 | } | 797 | 35 | } | 798 | 35 | } | 799 | 35 | return Status::OK(); | 800 | 35 | }, | 801 | 35 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 802 | | | 803 | 7 | if (narrow_integral) { | 804 | 7 | block.get_by_position(result).column = | 805 | 7 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 806 | 7 | } else { | 807 | 0 | block.get_by_position(result).column = std::move(col_to); | 808 | 0 | } | 809 | 7 | return Status::OK(); | 810 | 35 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE7EEENS_15DataTypeDecimalILS3_28EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 724 | 14 | const NullMap::value_type* null_map = nullptr) const override { | 725 | 14 | using FromFieldType = typename FromDataType::FieldType; | 726 | 14 | using ToFieldType = typename ToDataType::FieldType; | 727 | 14 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 728 | 14 | const auto* col_from = | 729 | 14 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 730 | 14 | if (!col_from) { | 731 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 732 | 0 | named_from.column->get_name()); | 733 | 0 | } | 734 | | | 735 | 14 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 736 | 14 | constexpr UInt32 from_scale = 0; | 737 | | | 738 | 14 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 739 | 14 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 740 | 14 | UInt32 to_precision = to_decimal_type.get_precision(); | 741 | 14 | ToDataType::check_type_precision(to_precision); | 742 | 14 | UInt32 to_scale = to_decimal_type.get_scale(); | 743 | 14 | ToDataType::check_type_scale(to_scale); | 744 | | | 745 | 14 | auto from_max_int_digit_count = from_precision - from_scale; | 746 | 14 | auto to_max_int_digit_count = to_precision - to_scale; | 747 | | // may overflow. nullable result column. | 748 | 14 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 749 | | // only in non-strict mode and may overflow, we set nullable | 750 | 14 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 751 | | | 752 | 14 | constexpr UInt32 to_max_digits = | 753 | 14 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 754 | 14 | bool multiply_may_overflow = false; | 755 | 14 | if (to_scale > from_scale) { | 756 | 8 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 757 | 8 | } | 758 | 14 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 759 | 14 | sizeof(typename ToFieldType::NativeType)), | 760 | 14 | FromFieldType, typename ToFieldType::NativeType>; | 761 | 14 | MaxNativeType scale_multiplier = | 762 | 14 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 763 | 14 | typename ToFieldType::NativeType max_result = | 764 | 14 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 765 | 14 | typename ToFieldType::NativeType min_result = -max_result; | 766 | | | 767 | 14 | ColumnUInt8::MutablePtr col_null_map_to; | 768 | 14 | NullMap::value_type* null_map_data = nullptr; | 769 | 14 | if (narrow_integral) { | 770 | 14 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 771 | 14 | null_map_data = col_null_map_to->get_data().data(); | 772 | 14 | } | 773 | | | 774 | 14 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 775 | 14 | const auto& vec_from = col_from->get_data(); | 776 | 14 | const auto* vec_from_data = vec_from.data(); | 777 | 14 | auto& vec_to = col_to->get_data(); | 778 | 14 | auto* vec_to_data = vec_to.data(); | 779 | | | 780 | 14 | CastParameters params; | 781 | 14 | params.is_strict = (CastMode == CastModeType::StrictMode); | 782 | 14 | size_t size = vec_from.size(); | 783 | | | 784 | 14 | RETURN_IF_ERROR(std::visit( | 785 | 14 | [&](auto multiply_may_overflow, auto narrow_integral) { | 786 | 14 | for (size_t i = 0; i < size; i++) { | 787 | 14 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 788 | 14 | typename ToDataType::FieldType, | 789 | 14 | multiply_may_overflow, narrow_integral>( | 790 | 14 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 791 | 14 | scale_multiplier, min_result, max_result, params)) { | 792 | 14 | if (set_nullable) { | 793 | 14 | null_map_data[i] = 1; | 794 | 14 | } else { | 795 | 14 | return params.status; | 796 | 14 | } | 797 | 14 | } | 798 | 14 | } | 799 | 14 | return Status::OK(); | 800 | 14 | }, | 801 | 14 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 802 | | | 803 | 14 | if (narrow_integral) { | 804 | 14 | block.get_by_position(result).column = | 805 | 14 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 806 | 14 | } else { | 807 | 0 | block.get_by_position(result).column = std::move(col_to); | 808 | 0 | } | 809 | 14 | return Status::OK(); | 810 | 14 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE2EEENS_15DataTypeDecimalILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 724 | 2 | const NullMap::value_type* null_map = nullptr) const override { | 725 | 2 | using FromFieldType = typename FromDataType::FieldType; | 726 | 2 | using ToFieldType = typename ToDataType::FieldType; | 727 | 2 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 728 | 2 | const auto* col_from = | 729 | 2 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 730 | 2 | if (!col_from) { | 731 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 732 | 0 | named_from.column->get_name()); | 733 | 0 | } | 734 | | | 735 | 2 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 736 | 2 | constexpr UInt32 from_scale = 0; | 737 | | | 738 | 2 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 739 | 2 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 740 | 2 | UInt32 to_precision = to_decimal_type.get_precision(); | 741 | 2 | ToDataType::check_type_precision(to_precision); | 742 | 2 | UInt32 to_scale = to_decimal_type.get_scale(); | 743 | 2 | ToDataType::check_type_scale(to_scale); | 744 | | | 745 | 2 | auto from_max_int_digit_count = from_precision - from_scale; | 746 | 2 | auto to_max_int_digit_count = to_precision - to_scale; | 747 | | // may overflow. nullable result column. | 748 | 2 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 749 | | // only in non-strict mode and may overflow, we set nullable | 750 | 2 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 751 | | | 752 | 2 | constexpr UInt32 to_max_digits = | 753 | 2 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 754 | 2 | bool multiply_may_overflow = false; | 755 | 2 | if (to_scale > from_scale) { | 756 | 2 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 757 | 2 | } | 758 | 2 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 759 | 2 | sizeof(typename ToFieldType::NativeType)), | 760 | 2 | FromFieldType, typename ToFieldType::NativeType>; | 761 | 2 | MaxNativeType scale_multiplier = | 762 | 2 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 763 | 2 | typename ToFieldType::NativeType max_result = | 764 | 2 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 765 | 2 | typename ToFieldType::NativeType min_result = -max_result; | 766 | | | 767 | 2 | ColumnUInt8::MutablePtr col_null_map_to; | 768 | 2 | NullMap::value_type* null_map_data = nullptr; | 769 | 2 | if (narrow_integral) { | 770 | 2 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 771 | 2 | null_map_data = col_null_map_to->get_data().data(); | 772 | 2 | } | 773 | | | 774 | 2 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 775 | 2 | const auto& vec_from = col_from->get_data(); | 776 | 2 | const auto* vec_from_data = vec_from.data(); | 777 | 2 | auto& vec_to = col_to->get_data(); | 778 | 2 | auto* vec_to_data = vec_to.data(); | 779 | | | 780 | 2 | CastParameters params; | 781 | 2 | params.is_strict = (CastMode == CastModeType::StrictMode); | 782 | 2 | size_t size = vec_from.size(); | 783 | | | 784 | 2 | RETURN_IF_ERROR(std::visit( | 785 | 2 | [&](auto multiply_may_overflow, auto narrow_integral) { | 786 | 2 | for (size_t i = 0; i < size; i++) { | 787 | 2 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 788 | 2 | typename ToDataType::FieldType, | 789 | 2 | multiply_may_overflow, narrow_integral>( | 790 | 2 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 791 | 2 | scale_multiplier, min_result, max_result, params)) { | 792 | 2 | if (set_nullable) { | 793 | 2 | null_map_data[i] = 1; | 794 | 2 | } else { | 795 | 2 | return params.status; | 796 | 2 | } | 797 | 2 | } | 798 | 2 | } | 799 | 2 | return Status::OK(); | 800 | 2 | }, | 801 | 2 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 802 | | | 803 | 1 | if (narrow_integral) { | 804 | 1 | block.get_by_position(result).column = | 805 | 1 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 806 | 1 | } else { | 807 | 0 | block.get_by_position(result).column = std::move(col_to); | 808 | 0 | } | 809 | 1 | return Status::OK(); | 810 | 2 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE2EEENS_15DataTypeDecimalILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 724 | 5 | const NullMap::value_type* null_map = nullptr) const override { | 725 | 5 | using FromFieldType = typename FromDataType::FieldType; | 726 | 5 | using ToFieldType = typename ToDataType::FieldType; | 727 | 5 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 728 | 5 | const auto* col_from = | 729 | 5 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 730 | 5 | if (!col_from) { | 731 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 732 | 0 | named_from.column->get_name()); | 733 | 0 | } | 734 | | | 735 | 5 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 736 | 5 | constexpr UInt32 from_scale = 0; | 737 | | | 738 | 5 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 739 | 5 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 740 | 5 | UInt32 to_precision = to_decimal_type.get_precision(); | 741 | 5 | ToDataType::check_type_precision(to_precision); | 742 | 5 | UInt32 to_scale = to_decimal_type.get_scale(); | 743 | 5 | ToDataType::check_type_scale(to_scale); | 744 | | | 745 | 5 | auto from_max_int_digit_count = from_precision - from_scale; | 746 | 5 | auto to_max_int_digit_count = to_precision - to_scale; | 747 | | // may overflow. nullable result column. | 748 | 5 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 749 | | // only in non-strict mode and may overflow, we set nullable | 750 | 5 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 751 | | | 752 | 5 | constexpr UInt32 to_max_digits = | 753 | 5 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 754 | 5 | bool multiply_may_overflow = false; | 755 | 5 | if (to_scale > from_scale) { | 756 | 4 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 757 | 4 | } | 758 | 5 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 759 | 5 | sizeof(typename ToFieldType::NativeType)), | 760 | 5 | FromFieldType, typename ToFieldType::NativeType>; | 761 | 5 | MaxNativeType scale_multiplier = | 762 | 5 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 763 | 5 | typename ToFieldType::NativeType max_result = | 764 | 5 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 765 | 5 | typename ToFieldType::NativeType min_result = -max_result; | 766 | | | 767 | 5 | ColumnUInt8::MutablePtr col_null_map_to; | 768 | 5 | NullMap::value_type* null_map_data = nullptr; | 769 | 5 | if (narrow_integral) { | 770 | 1 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 771 | 1 | null_map_data = col_null_map_to->get_data().data(); | 772 | 1 | } | 773 | | | 774 | 5 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 775 | 5 | const auto& vec_from = col_from->get_data(); | 776 | 5 | const auto* vec_from_data = vec_from.data(); | 777 | 5 | auto& vec_to = col_to->get_data(); | 778 | 5 | auto* vec_to_data = vec_to.data(); | 779 | | | 780 | 5 | CastParameters params; | 781 | 5 | params.is_strict = (CastMode == CastModeType::StrictMode); | 782 | 5 | size_t size = vec_from.size(); | 783 | | | 784 | 5 | RETURN_IF_ERROR(std::visit( | 785 | 5 | [&](auto multiply_may_overflow, auto narrow_integral) { | 786 | 5 | for (size_t i = 0; i < size; i++) { | 787 | 5 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 788 | 5 | typename ToDataType::FieldType, | 789 | 5 | multiply_may_overflow, narrow_integral>( | 790 | 5 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 791 | 5 | scale_multiplier, min_result, max_result, params)) { | 792 | 5 | if (set_nullable) { | 793 | 5 | null_map_data[i] = 1; | 794 | 5 | } else { | 795 | 5 | return params.status; | 796 | 5 | } | 797 | 5 | } | 798 | 5 | } | 799 | 5 | return Status::OK(); | 800 | 5 | }, | 801 | 5 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 802 | | | 803 | 5 | if (narrow_integral) { | 804 | 1 | block.get_by_position(result).column = | 805 | 1 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 806 | 4 | } else { | 807 | 4 | block.get_by_position(result).column = std::move(col_to); | 808 | 4 | } | 809 | 5 | return Status::OK(); | 810 | 5 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE3EEENS_15DataTypeDecimalILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 724 | 19 | const NullMap::value_type* null_map = nullptr) const override { | 725 | 19 | using FromFieldType = typename FromDataType::FieldType; | 726 | 19 | using ToFieldType = typename ToDataType::FieldType; | 727 | 19 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 728 | 19 | const auto* col_from = | 729 | 19 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 730 | 19 | if (!col_from) { | 731 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 732 | 0 | named_from.column->get_name()); | 733 | 0 | } | 734 | | | 735 | 19 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 736 | 19 | constexpr UInt32 from_scale = 0; | 737 | | | 738 | 19 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 739 | 19 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 740 | 19 | UInt32 to_precision = to_decimal_type.get_precision(); | 741 | 19 | ToDataType::check_type_precision(to_precision); | 742 | 19 | UInt32 to_scale = to_decimal_type.get_scale(); | 743 | 19 | ToDataType::check_type_scale(to_scale); | 744 | | | 745 | 19 | auto from_max_int_digit_count = from_precision - from_scale; | 746 | 19 | auto to_max_int_digit_count = to_precision - to_scale; | 747 | | // may overflow. nullable result column. | 748 | 19 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 749 | | // only in non-strict mode and may overflow, we set nullable | 750 | 19 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 751 | | | 752 | 19 | constexpr UInt32 to_max_digits = | 753 | 19 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 754 | 19 | bool multiply_may_overflow = false; | 755 | 19 | if (to_scale > from_scale) { | 756 | 12 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 757 | 12 | } | 758 | 19 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 759 | 19 | sizeof(typename ToFieldType::NativeType)), | 760 | 19 | FromFieldType, typename ToFieldType::NativeType>; | 761 | 19 | MaxNativeType scale_multiplier = | 762 | 19 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 763 | 19 | typename ToFieldType::NativeType max_result = | 764 | 19 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 765 | 19 | typename ToFieldType::NativeType min_result = -max_result; | 766 | | | 767 | 19 | ColumnUInt8::MutablePtr col_null_map_to; | 768 | 19 | NullMap::value_type* null_map_data = nullptr; | 769 | 19 | if (narrow_integral) { | 770 | 15 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 771 | 15 | null_map_data = col_null_map_to->get_data().data(); | 772 | 15 | } | 773 | | | 774 | 19 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 775 | 19 | const auto& vec_from = col_from->get_data(); | 776 | 19 | const auto* vec_from_data = vec_from.data(); | 777 | 19 | auto& vec_to = col_to->get_data(); | 778 | 19 | auto* vec_to_data = vec_to.data(); | 779 | | | 780 | 19 | CastParameters params; | 781 | 19 | params.is_strict = (CastMode == CastModeType::StrictMode); | 782 | 19 | size_t size = vec_from.size(); | 783 | | | 784 | 19 | RETURN_IF_ERROR(std::visit( | 785 | 19 | [&](auto multiply_may_overflow, auto narrow_integral) { | 786 | 19 | for (size_t i = 0; i < size; i++) { | 787 | 19 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 788 | 19 | typename ToDataType::FieldType, | 789 | 19 | multiply_may_overflow, narrow_integral>( | 790 | 19 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 791 | 19 | scale_multiplier, min_result, max_result, params)) { | 792 | 19 | if (set_nullable) { | 793 | 19 | null_map_data[i] = 1; | 794 | 19 | } else { | 795 | 19 | return params.status; | 796 | 19 | } | 797 | 19 | } | 798 | 19 | } | 799 | 19 | return Status::OK(); | 800 | 19 | }, | 801 | 19 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 802 | | | 803 | 7 | if (narrow_integral) { | 804 | 3 | block.get_by_position(result).column = | 805 | 3 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 806 | 4 | } else { | 807 | 4 | block.get_by_position(result).column = std::move(col_to); | 808 | 4 | } | 809 | 7 | return Status::OK(); | 810 | 19 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE3EEENS_15DataTypeDecimalILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 724 | 10 | const NullMap::value_type* null_map = nullptr) const override { | 725 | 10 | using FromFieldType = typename FromDataType::FieldType; | 726 | 10 | using ToFieldType = typename ToDataType::FieldType; | 727 | 10 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 728 | 10 | const auto* col_from = | 729 | 10 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 730 | 10 | if (!col_from) { | 731 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 732 | 0 | named_from.column->get_name()); | 733 | 0 | } | 734 | | | 735 | 10 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 736 | 10 | constexpr UInt32 from_scale = 0; | 737 | | | 738 | 10 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 739 | 10 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 740 | 10 | UInt32 to_precision = to_decimal_type.get_precision(); | 741 | 10 | ToDataType::check_type_precision(to_precision); | 742 | 10 | UInt32 to_scale = to_decimal_type.get_scale(); | 743 | 10 | ToDataType::check_type_scale(to_scale); | 744 | | | 745 | 10 | auto from_max_int_digit_count = from_precision - from_scale; | 746 | 10 | auto to_max_int_digit_count = to_precision - to_scale; | 747 | | // may overflow. nullable result column. | 748 | 10 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 749 | | // only in non-strict mode and may overflow, we set nullable | 750 | 10 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 751 | | | 752 | 10 | constexpr UInt32 to_max_digits = | 753 | 10 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 754 | 10 | bool multiply_may_overflow = false; | 755 | 10 | if (to_scale > from_scale) { | 756 | 6 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 757 | 6 | } | 758 | 10 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 759 | 10 | sizeof(typename ToFieldType::NativeType)), | 760 | 10 | FromFieldType, typename ToFieldType::NativeType>; | 761 | 10 | MaxNativeType scale_multiplier = | 762 | 10 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 763 | 10 | typename ToFieldType::NativeType max_result = | 764 | 10 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 765 | 10 | typename ToFieldType::NativeType min_result = -max_result; | 766 | | | 767 | 10 | ColumnUInt8::MutablePtr col_null_map_to; | 768 | 10 | NullMap::value_type* null_map_data = nullptr; | 769 | 10 | if (narrow_integral) { | 770 | 6 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 771 | 6 | null_map_data = col_null_map_to->get_data().data(); | 772 | 6 | } | 773 | | | 774 | 10 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 775 | 10 | const auto& vec_from = col_from->get_data(); | 776 | 10 | const auto* vec_from_data = vec_from.data(); | 777 | 10 | auto& vec_to = col_to->get_data(); | 778 | 10 | auto* vec_to_data = vec_to.data(); | 779 | | | 780 | 10 | CastParameters params; | 781 | 10 | params.is_strict = (CastMode == CastModeType::StrictMode); | 782 | 10 | size_t size = vec_from.size(); | 783 | | | 784 | 10 | RETURN_IF_ERROR(std::visit( | 785 | 10 | [&](auto multiply_may_overflow, auto narrow_integral) { | 786 | 10 | for (size_t i = 0; i < size; i++) { | 787 | 10 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 788 | 10 | typename ToDataType::FieldType, | 789 | 10 | multiply_may_overflow, narrow_integral>( | 790 | 10 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 791 | 10 | scale_multiplier, min_result, max_result, params)) { | 792 | 10 | if (set_nullable) { | 793 | 10 | null_map_data[i] = 1; | 794 | 10 | } else { | 795 | 10 | return params.status; | 796 | 10 | } | 797 | 10 | } | 798 | 10 | } | 799 | 10 | return Status::OK(); | 800 | 10 | }, | 801 | 10 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 802 | | | 803 | 10 | if (narrow_integral) { | 804 | 6 | block.get_by_position(result).column = | 805 | 6 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 806 | 6 | } else { | 807 | 4 | block.get_by_position(result).column = std::move(col_to); | 808 | 4 | } | 809 | 10 | return Status::OK(); | 810 | 10 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE4EEENS_15DataTypeDecimalILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 724 | 19 | const NullMap::value_type* null_map = nullptr) const override { | 725 | 19 | using FromFieldType = typename FromDataType::FieldType; | 726 | 19 | using ToFieldType = typename ToDataType::FieldType; | 727 | 19 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 728 | 19 | const auto* col_from = | 729 | 19 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 730 | 19 | if (!col_from) { | 731 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 732 | 0 | named_from.column->get_name()); | 733 | 0 | } | 734 | | | 735 | 19 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 736 | 19 | constexpr UInt32 from_scale = 0; | 737 | | | 738 | 19 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 739 | 19 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 740 | 19 | UInt32 to_precision = to_decimal_type.get_precision(); | 741 | 19 | ToDataType::check_type_precision(to_precision); | 742 | 19 | UInt32 to_scale = to_decimal_type.get_scale(); | 743 | 19 | ToDataType::check_type_scale(to_scale); | 744 | | | 745 | 19 | auto from_max_int_digit_count = from_precision - from_scale; | 746 | 19 | auto to_max_int_digit_count = to_precision - to_scale; | 747 | | // may overflow. nullable result column. | 748 | 19 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 749 | | // only in non-strict mode and may overflow, we set nullable | 750 | 19 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 751 | | | 752 | 19 | constexpr UInt32 to_max_digits = | 753 | 19 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 754 | 19 | bool multiply_may_overflow = false; | 755 | 19 | if (to_scale > from_scale) { | 756 | 12 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 757 | 12 | } | 758 | 19 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 759 | 19 | sizeof(typename ToFieldType::NativeType)), | 760 | 19 | FromFieldType, typename ToFieldType::NativeType>; | 761 | 19 | MaxNativeType scale_multiplier = | 762 | 19 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 763 | 19 | typename ToFieldType::NativeType max_result = | 764 | 19 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 765 | 19 | typename ToFieldType::NativeType min_result = -max_result; | 766 | | | 767 | 19 | ColumnUInt8::MutablePtr col_null_map_to; | 768 | 19 | NullMap::value_type* null_map_data = nullptr; | 769 | 19 | if (narrow_integral) { | 770 | 15 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 771 | 15 | null_map_data = col_null_map_to->get_data().data(); | 772 | 15 | } | 773 | | | 774 | 19 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 775 | 19 | const auto& vec_from = col_from->get_data(); | 776 | 19 | const auto* vec_from_data = vec_from.data(); | 777 | 19 | auto& vec_to = col_to->get_data(); | 778 | 19 | auto* vec_to_data = vec_to.data(); | 779 | | | 780 | 19 | CastParameters params; | 781 | 19 | params.is_strict = (CastMode == CastModeType::StrictMode); | 782 | 19 | size_t size = vec_from.size(); | 783 | | | 784 | 19 | RETURN_IF_ERROR(std::visit( | 785 | 19 | [&](auto multiply_may_overflow, auto narrow_integral) { | 786 | 19 | for (size_t i = 0; i < size; i++) { | 787 | 19 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 788 | 19 | typename ToDataType::FieldType, | 789 | 19 | multiply_may_overflow, narrow_integral>( | 790 | 19 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 791 | 19 | scale_multiplier, min_result, max_result, params)) { | 792 | 19 | if (set_nullable) { | 793 | 19 | null_map_data[i] = 1; | 794 | 19 | } else { | 795 | 19 | return params.status; | 796 | 19 | } | 797 | 19 | } | 798 | 19 | } | 799 | 19 | return Status::OK(); | 800 | 19 | }, | 801 | 19 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 802 | | | 803 | 7 | if (narrow_integral) { | 804 | 3 | block.get_by_position(result).column = | 805 | 3 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 806 | 4 | } else { | 807 | 4 | block.get_by_position(result).column = std::move(col_to); | 808 | 4 | } | 809 | 7 | return Status::OK(); | 810 | 19 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE4EEENS_15DataTypeDecimalILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 724 | 10 | const NullMap::value_type* null_map = nullptr) const override { | 725 | 10 | using FromFieldType = typename FromDataType::FieldType; | 726 | 10 | using ToFieldType = typename ToDataType::FieldType; | 727 | 10 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 728 | 10 | const auto* col_from = | 729 | 10 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 730 | 10 | if (!col_from) { | 731 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 732 | 0 | named_from.column->get_name()); | 733 | 0 | } | 734 | | | 735 | 10 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 736 | 10 | constexpr UInt32 from_scale = 0; | 737 | | | 738 | 10 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 739 | 10 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 740 | 10 | UInt32 to_precision = to_decimal_type.get_precision(); | 741 | 10 | ToDataType::check_type_precision(to_precision); | 742 | 10 | UInt32 to_scale = to_decimal_type.get_scale(); | 743 | 10 | ToDataType::check_type_scale(to_scale); | 744 | | | 745 | 10 | auto from_max_int_digit_count = from_precision - from_scale; | 746 | 10 | auto to_max_int_digit_count = to_precision - to_scale; | 747 | | // may overflow. nullable result column. | 748 | 10 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 749 | | // only in non-strict mode and may overflow, we set nullable | 750 | 10 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 751 | | | 752 | 10 | constexpr UInt32 to_max_digits = | 753 | 10 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 754 | 10 | bool multiply_may_overflow = false; | 755 | 10 | if (to_scale > from_scale) { | 756 | 6 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 757 | 6 | } | 758 | 10 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 759 | 10 | sizeof(typename ToFieldType::NativeType)), | 760 | 10 | FromFieldType, typename ToFieldType::NativeType>; | 761 | 10 | MaxNativeType scale_multiplier = | 762 | 10 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 763 | 10 | typename ToFieldType::NativeType max_result = | 764 | 10 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 765 | 10 | typename ToFieldType::NativeType min_result = -max_result; | 766 | | | 767 | 10 | ColumnUInt8::MutablePtr col_null_map_to; | 768 | 10 | NullMap::value_type* null_map_data = nullptr; | 769 | 10 | if (narrow_integral) { | 770 | 6 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 771 | 6 | null_map_data = col_null_map_to->get_data().data(); | 772 | 6 | } | 773 | | | 774 | 10 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 775 | 10 | const auto& vec_from = col_from->get_data(); | 776 | 10 | const auto* vec_from_data = vec_from.data(); | 777 | 10 | auto& vec_to = col_to->get_data(); | 778 | 10 | auto* vec_to_data = vec_to.data(); | 779 | | | 780 | 10 | CastParameters params; | 781 | 10 | params.is_strict = (CastMode == CastModeType::StrictMode); | 782 | 10 | size_t size = vec_from.size(); | 783 | | | 784 | 10 | RETURN_IF_ERROR(std::visit( | 785 | 10 | [&](auto multiply_may_overflow, auto narrow_integral) { | 786 | 10 | for (size_t i = 0; i < size; i++) { | 787 | 10 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 788 | 10 | typename ToDataType::FieldType, | 789 | 10 | multiply_may_overflow, narrow_integral>( | 790 | 10 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 791 | 10 | scale_multiplier, min_result, max_result, params)) { | 792 | 10 | if (set_nullable) { | 793 | 10 | null_map_data[i] = 1; | 794 | 10 | } else { | 795 | 10 | return params.status; | 796 | 10 | } | 797 | 10 | } | 798 | 10 | } | 799 | 10 | return Status::OK(); | 800 | 10 | }, | 801 | 10 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 802 | | | 803 | 10 | if (narrow_integral) { | 804 | 6 | block.get_by_position(result).column = | 805 | 6 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 806 | 6 | } else { | 807 | 4 | block.get_by_position(result).column = std::move(col_to); | 808 | 4 | } | 809 | 10 | return Status::OK(); | 810 | 10 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE5EEENS_15DataTypeDecimalILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 724 | 31 | const NullMap::value_type* null_map = nullptr) const override { | 725 | 31 | using FromFieldType = typename FromDataType::FieldType; | 726 | 31 | using ToFieldType = typename ToDataType::FieldType; | 727 | 31 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 728 | 31 | const auto* col_from = | 729 | 31 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 730 | 31 | if (!col_from) { | 731 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 732 | 0 | named_from.column->get_name()); | 733 | 0 | } | 734 | | | 735 | 31 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 736 | 31 | constexpr UInt32 from_scale = 0; | 737 | | | 738 | 31 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 739 | 31 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 740 | 31 | UInt32 to_precision = to_decimal_type.get_precision(); | 741 | 31 | ToDataType::check_type_precision(to_precision); | 742 | 31 | UInt32 to_scale = to_decimal_type.get_scale(); | 743 | 31 | ToDataType::check_type_scale(to_scale); | 744 | | | 745 | 31 | auto from_max_int_digit_count = from_precision - from_scale; | 746 | 31 | auto to_max_int_digit_count = to_precision - to_scale; | 747 | | // may overflow. nullable result column. | 748 | 31 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 749 | | // only in non-strict mode and may overflow, we set nullable | 750 | 31 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 751 | | | 752 | 31 | constexpr UInt32 to_max_digits = | 753 | 31 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 754 | 31 | bool multiply_may_overflow = false; | 755 | 31 | if (to_scale > from_scale) { | 756 | 20 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 757 | 20 | } | 758 | 31 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 759 | 31 | sizeof(typename ToFieldType::NativeType)), | 760 | 31 | FromFieldType, typename ToFieldType::NativeType>; | 761 | 31 | MaxNativeType scale_multiplier = | 762 | 31 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 763 | 31 | typename ToFieldType::NativeType max_result = | 764 | 31 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 765 | 31 | typename ToFieldType::NativeType min_result = -max_result; | 766 | | | 767 | 31 | ColumnUInt8::MutablePtr col_null_map_to; | 768 | 31 | NullMap::value_type* null_map_data = nullptr; | 769 | 31 | if (narrow_integral) { | 770 | 30 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 771 | 30 | null_map_data = col_null_map_to->get_data().data(); | 772 | 30 | } | 773 | | | 774 | 31 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 775 | 31 | const auto& vec_from = col_from->get_data(); | 776 | 31 | const auto* vec_from_data = vec_from.data(); | 777 | 31 | auto& vec_to = col_to->get_data(); | 778 | 31 | auto* vec_to_data = vec_to.data(); | 779 | | | 780 | 31 | CastParameters params; | 781 | 31 | params.is_strict = (CastMode == CastModeType::StrictMode); | 782 | 31 | size_t size = vec_from.size(); | 783 | | | 784 | 31 | RETURN_IF_ERROR(std::visit( | 785 | 31 | [&](auto multiply_may_overflow, auto narrow_integral) { | 786 | 31 | for (size_t i = 0; i < size; i++) { | 787 | 31 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 788 | 31 | typename ToDataType::FieldType, | 789 | 31 | multiply_may_overflow, narrow_integral>( | 790 | 31 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 791 | 31 | scale_multiplier, min_result, max_result, params)) { | 792 | 31 | if (set_nullable) { | 793 | 31 | null_map_data[i] = 1; | 794 | 31 | } else { | 795 | 31 | return params.status; | 796 | 31 | } | 797 | 31 | } | 798 | 31 | } | 799 | 31 | return Status::OK(); | 800 | 31 | }, | 801 | 31 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 802 | | | 803 | 7 | if (narrow_integral) { | 804 | 6 | block.get_by_position(result).column = | 805 | 6 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 806 | 6 | } else { | 807 | 1 | block.get_by_position(result).column = std::move(col_to); | 808 | 1 | } | 809 | 7 | return Status::OK(); | 810 | 31 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE5EEENS_15DataTypeDecimalILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 724 | 13 | const NullMap::value_type* null_map = nullptr) const override { | 725 | 13 | using FromFieldType = typename FromDataType::FieldType; | 726 | 13 | using ToFieldType = typename ToDataType::FieldType; | 727 | 13 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 728 | 13 | const auto* col_from = | 729 | 13 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 730 | 13 | if (!col_from) { | 731 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 732 | 0 | named_from.column->get_name()); | 733 | 0 | } | 734 | | | 735 | 13 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 736 | 13 | constexpr UInt32 from_scale = 0; | 737 | | | 738 | 13 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 739 | 13 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 740 | 13 | UInt32 to_precision = to_decimal_type.get_precision(); | 741 | 13 | ToDataType::check_type_precision(to_precision); | 742 | 13 | UInt32 to_scale = to_decimal_type.get_scale(); | 743 | 13 | ToDataType::check_type_scale(to_scale); | 744 | | | 745 | 13 | auto from_max_int_digit_count = from_precision - from_scale; | 746 | 13 | auto to_max_int_digit_count = to_precision - to_scale; | 747 | | // may overflow. nullable result column. | 748 | 13 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 749 | | // only in non-strict mode and may overflow, we set nullable | 750 | 13 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 751 | | | 752 | 13 | constexpr UInt32 to_max_digits = | 753 | 13 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 754 | 13 | bool multiply_may_overflow = false; | 755 | 13 | if (to_scale > from_scale) { | 756 | 8 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 757 | 8 | } | 758 | 13 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 759 | 13 | sizeof(typename ToFieldType::NativeType)), | 760 | 13 | FromFieldType, typename ToFieldType::NativeType>; | 761 | 13 | MaxNativeType scale_multiplier = | 762 | 13 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 763 | 13 | typename ToFieldType::NativeType max_result = | 764 | 13 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 765 | 13 | typename ToFieldType::NativeType min_result = -max_result; | 766 | | | 767 | 13 | ColumnUInt8::MutablePtr col_null_map_to; | 768 | 13 | NullMap::value_type* null_map_data = nullptr; | 769 | 13 | if (narrow_integral) { | 770 | 12 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 771 | 12 | null_map_data = col_null_map_to->get_data().data(); | 772 | 12 | } | 773 | | | 774 | 13 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 775 | 13 | const auto& vec_from = col_from->get_data(); | 776 | 13 | const auto* vec_from_data = vec_from.data(); | 777 | 13 | auto& vec_to = col_to->get_data(); | 778 | 13 | auto* vec_to_data = vec_to.data(); | 779 | | | 780 | 13 | CastParameters params; | 781 | 13 | params.is_strict = (CastMode == CastModeType::StrictMode); | 782 | 13 | size_t size = vec_from.size(); | 783 | | | 784 | 13 | RETURN_IF_ERROR(std::visit( | 785 | 13 | [&](auto multiply_may_overflow, auto narrow_integral) { | 786 | 13 | for (size_t i = 0; i < size; i++) { | 787 | 13 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 788 | 13 | typename ToDataType::FieldType, | 789 | 13 | multiply_may_overflow, narrow_integral>( | 790 | 13 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 791 | 13 | scale_multiplier, min_result, max_result, params)) { | 792 | 13 | if (set_nullable) { | 793 | 13 | null_map_data[i] = 1; | 794 | 13 | } else { | 795 | 13 | return params.status; | 796 | 13 | } | 797 | 13 | } | 798 | 13 | } | 799 | 13 | return Status::OK(); | 800 | 13 | }, | 801 | 13 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 802 | | | 803 | 13 | if (narrow_integral) { | 804 | 12 | block.get_by_position(result).column = | 805 | 12 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 806 | 12 | } else { | 807 | 1 | block.get_by_position(result).column = std::move(col_to); | 808 | 1 | } | 809 | 13 | return Status::OK(); | 810 | 13 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE6EEENS_15DataTypeDecimalILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 724 | 35 | const NullMap::value_type* null_map = nullptr) const override { | 725 | 35 | using FromFieldType = typename FromDataType::FieldType; | 726 | 35 | using ToFieldType = typename ToDataType::FieldType; | 727 | 35 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 728 | 35 | const auto* col_from = | 729 | 35 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 730 | 35 | if (!col_from) { | 731 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 732 | 0 | named_from.column->get_name()); | 733 | 0 | } | 734 | | | 735 | 35 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 736 | 35 | constexpr UInt32 from_scale = 0; | 737 | | | 738 | 35 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 739 | 35 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 740 | 35 | UInt32 to_precision = to_decimal_type.get_precision(); | 741 | 35 | ToDataType::check_type_precision(to_precision); | 742 | 35 | UInt32 to_scale = to_decimal_type.get_scale(); | 743 | 35 | ToDataType::check_type_scale(to_scale); | 744 | | | 745 | 35 | auto from_max_int_digit_count = from_precision - from_scale; | 746 | 35 | auto to_max_int_digit_count = to_precision - to_scale; | 747 | | // may overflow. nullable result column. | 748 | 35 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 749 | | // only in non-strict mode and may overflow, we set nullable | 750 | 35 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 751 | | | 752 | 35 | constexpr UInt32 to_max_digits = | 753 | 35 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 754 | 35 | bool multiply_may_overflow = false; | 755 | 35 | if (to_scale > from_scale) { | 756 | 20 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 757 | 20 | } | 758 | 35 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 759 | 35 | sizeof(typename ToFieldType::NativeType)), | 760 | 35 | FromFieldType, typename ToFieldType::NativeType>; | 761 | 35 | MaxNativeType scale_multiplier = | 762 | 35 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 763 | 35 | typename ToFieldType::NativeType max_result = | 764 | 35 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 765 | 35 | typename ToFieldType::NativeType min_result = -max_result; | 766 | | | 767 | 35 | ColumnUInt8::MutablePtr col_null_map_to; | 768 | 35 | NullMap::value_type* null_map_data = nullptr; | 769 | 35 | if (narrow_integral) { | 770 | 35 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 771 | 35 | null_map_data = col_null_map_to->get_data().data(); | 772 | 35 | } | 773 | | | 774 | 35 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 775 | 35 | const auto& vec_from = col_from->get_data(); | 776 | 35 | const auto* vec_from_data = vec_from.data(); | 777 | 35 | auto& vec_to = col_to->get_data(); | 778 | 35 | auto* vec_to_data = vec_to.data(); | 779 | | | 780 | 35 | CastParameters params; | 781 | 35 | params.is_strict = (CastMode == CastModeType::StrictMode); | 782 | 35 | size_t size = vec_from.size(); | 783 | | | 784 | 35 | RETURN_IF_ERROR(std::visit( | 785 | 35 | [&](auto multiply_may_overflow, auto narrow_integral) { | 786 | 35 | for (size_t i = 0; i < size; i++) { | 787 | 35 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 788 | 35 | typename ToDataType::FieldType, | 789 | 35 | multiply_may_overflow, narrow_integral>( | 790 | 35 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 791 | 35 | scale_multiplier, min_result, max_result, params)) { | 792 | 35 | if (set_nullable) { | 793 | 35 | null_map_data[i] = 1; | 794 | 35 | } else { | 795 | 35 | return params.status; | 796 | 35 | } | 797 | 35 | } | 798 | 35 | } | 799 | 35 | return Status::OK(); | 800 | 35 | }, | 801 | 35 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 802 | | | 803 | 7 | if (narrow_integral) { | 804 | 7 | block.get_by_position(result).column = | 805 | 7 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 806 | 7 | } else { | 807 | 0 | block.get_by_position(result).column = std::move(col_to); | 808 | 0 | } | 809 | 7 | return Status::OK(); | 810 | 35 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE6EEENS_15DataTypeDecimalILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 724 | 14 | const NullMap::value_type* null_map = nullptr) const override { | 725 | 14 | using FromFieldType = typename FromDataType::FieldType; | 726 | 14 | using ToFieldType = typename ToDataType::FieldType; | 727 | 14 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 728 | 14 | const auto* col_from = | 729 | 14 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 730 | 14 | if (!col_from) { | 731 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 732 | 0 | named_from.column->get_name()); | 733 | 0 | } | 734 | | | 735 | 14 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 736 | 14 | constexpr UInt32 from_scale = 0; | 737 | | | 738 | 14 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 739 | 14 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 740 | 14 | UInt32 to_precision = to_decimal_type.get_precision(); | 741 | 14 | ToDataType::check_type_precision(to_precision); | 742 | 14 | UInt32 to_scale = to_decimal_type.get_scale(); | 743 | 14 | ToDataType::check_type_scale(to_scale); | 744 | | | 745 | 14 | auto from_max_int_digit_count = from_precision - from_scale; | 746 | 14 | auto to_max_int_digit_count = to_precision - to_scale; | 747 | | // may overflow. nullable result column. | 748 | 14 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 749 | | // only in non-strict mode and may overflow, we set nullable | 750 | 14 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 751 | | | 752 | 14 | constexpr UInt32 to_max_digits = | 753 | 14 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 754 | 14 | bool multiply_may_overflow = false; | 755 | 14 | if (to_scale > from_scale) { | 756 | 8 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 757 | 8 | } | 758 | 14 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 759 | 14 | sizeof(typename ToFieldType::NativeType)), | 760 | 14 | FromFieldType, typename ToFieldType::NativeType>; | 761 | 14 | MaxNativeType scale_multiplier = | 762 | 14 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 763 | 14 | typename ToFieldType::NativeType max_result = | 764 | 14 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 765 | 14 | typename ToFieldType::NativeType min_result = -max_result; | 766 | | | 767 | 14 | ColumnUInt8::MutablePtr col_null_map_to; | 768 | 14 | NullMap::value_type* null_map_data = nullptr; | 769 | 14 | if (narrow_integral) { | 770 | 14 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 771 | 14 | null_map_data = col_null_map_to->get_data().data(); | 772 | 14 | } | 773 | | | 774 | 14 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 775 | 14 | const auto& vec_from = col_from->get_data(); | 776 | 14 | const auto* vec_from_data = vec_from.data(); | 777 | 14 | auto& vec_to = col_to->get_data(); | 778 | 14 | auto* vec_to_data = vec_to.data(); | 779 | | | 780 | 14 | CastParameters params; | 781 | 14 | params.is_strict = (CastMode == CastModeType::StrictMode); | 782 | 14 | size_t size = vec_from.size(); | 783 | | | 784 | 14 | RETURN_IF_ERROR(std::visit( | 785 | 14 | [&](auto multiply_may_overflow, auto narrow_integral) { | 786 | 14 | for (size_t i = 0; i < size; i++) { | 787 | 14 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 788 | 14 | typename ToDataType::FieldType, | 789 | 14 | multiply_may_overflow, narrow_integral>( | 790 | 14 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 791 | 14 | scale_multiplier, min_result, max_result, params)) { | 792 | 14 | if (set_nullable) { | 793 | 14 | null_map_data[i] = 1; | 794 | 14 | } else { | 795 | 14 | return params.status; | 796 | 14 | } | 797 | 14 | } | 798 | 14 | } | 799 | 14 | return Status::OK(); | 800 | 14 | }, | 801 | 14 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 802 | | | 803 | 14 | if (narrow_integral) { | 804 | 14 | block.get_by_position(result).column = | 805 | 14 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 806 | 14 | } else { | 807 | 0 | block.get_by_position(result).column = std::move(col_to); | 808 | 0 | } | 809 | 14 | return Status::OK(); | 810 | 14 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE7EEENS_15DataTypeDecimalILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 724 | 35 | const NullMap::value_type* null_map = nullptr) const override { | 725 | 35 | using FromFieldType = typename FromDataType::FieldType; | 726 | 35 | using ToFieldType = typename ToDataType::FieldType; | 727 | 35 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 728 | 35 | const auto* col_from = | 729 | 35 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 730 | 35 | if (!col_from) { | 731 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 732 | 0 | named_from.column->get_name()); | 733 | 0 | } | 734 | | | 735 | 35 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 736 | 35 | constexpr UInt32 from_scale = 0; | 737 | | | 738 | 35 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 739 | 35 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 740 | 35 | UInt32 to_precision = to_decimal_type.get_precision(); | 741 | 35 | ToDataType::check_type_precision(to_precision); | 742 | 35 | UInt32 to_scale = to_decimal_type.get_scale(); | 743 | 35 | ToDataType::check_type_scale(to_scale); | 744 | | | 745 | 35 | auto from_max_int_digit_count = from_precision - from_scale; | 746 | 35 | auto to_max_int_digit_count = to_precision - to_scale; | 747 | | // may overflow. nullable result column. | 748 | 35 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 749 | | // only in non-strict mode and may overflow, we set nullable | 750 | 35 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 751 | | | 752 | 35 | constexpr UInt32 to_max_digits = | 753 | 35 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 754 | 35 | bool multiply_may_overflow = false; | 755 | 35 | if (to_scale > from_scale) { | 756 | 20 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 757 | 20 | } | 758 | 35 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 759 | 35 | sizeof(typename ToFieldType::NativeType)), | 760 | 35 | FromFieldType, typename ToFieldType::NativeType>; | 761 | 35 | MaxNativeType scale_multiplier = | 762 | 35 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 763 | 35 | typename ToFieldType::NativeType max_result = | 764 | 35 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 765 | 35 | typename ToFieldType::NativeType min_result = -max_result; | 766 | | | 767 | 35 | ColumnUInt8::MutablePtr col_null_map_to; | 768 | 35 | NullMap::value_type* null_map_data = nullptr; | 769 | 35 | if (narrow_integral) { | 770 | 35 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 771 | 35 | null_map_data = col_null_map_to->get_data().data(); | 772 | 35 | } | 773 | | | 774 | 35 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 775 | 35 | const auto& vec_from = col_from->get_data(); | 776 | 35 | const auto* vec_from_data = vec_from.data(); | 777 | 35 | auto& vec_to = col_to->get_data(); | 778 | 35 | auto* vec_to_data = vec_to.data(); | 779 | | | 780 | 35 | CastParameters params; | 781 | 35 | params.is_strict = (CastMode == CastModeType::StrictMode); | 782 | 35 | size_t size = vec_from.size(); | 783 | | | 784 | 35 | RETURN_IF_ERROR(std::visit( | 785 | 35 | [&](auto multiply_may_overflow, auto narrow_integral) { | 786 | 35 | for (size_t i = 0; i < size; i++) { | 787 | 35 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 788 | 35 | typename ToDataType::FieldType, | 789 | 35 | multiply_may_overflow, narrow_integral>( | 790 | 35 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 791 | 35 | scale_multiplier, min_result, max_result, params)) { | 792 | 35 | if (set_nullable) { | 793 | 35 | null_map_data[i] = 1; | 794 | 35 | } else { | 795 | 35 | return params.status; | 796 | 35 | } | 797 | 35 | } | 798 | 35 | } | 799 | 35 | return Status::OK(); | 800 | 35 | }, | 801 | 35 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 802 | | | 803 | 7 | if (narrow_integral) { | 804 | 7 | block.get_by_position(result).column = | 805 | 7 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 806 | 7 | } else { | 807 | 0 | block.get_by_position(result).column = std::move(col_to); | 808 | 0 | } | 809 | 7 | return Status::OK(); | 810 | 35 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE7EEENS_15DataTypeDecimalILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 724 | 14 | const NullMap::value_type* null_map = nullptr) const override { | 725 | 14 | using FromFieldType = typename FromDataType::FieldType; | 726 | 14 | using ToFieldType = typename ToDataType::FieldType; | 727 | 14 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 728 | 14 | const auto* col_from = | 729 | 14 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 730 | 14 | if (!col_from) { | 731 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 732 | 0 | named_from.column->get_name()); | 733 | 0 | } | 734 | | | 735 | 14 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 736 | 14 | constexpr UInt32 from_scale = 0; | 737 | | | 738 | 14 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 739 | 14 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 740 | 14 | UInt32 to_precision = to_decimal_type.get_precision(); | 741 | 14 | ToDataType::check_type_precision(to_precision); | 742 | 14 | UInt32 to_scale = to_decimal_type.get_scale(); | 743 | 14 | ToDataType::check_type_scale(to_scale); | 744 | | | 745 | 14 | auto from_max_int_digit_count = from_precision - from_scale; | 746 | 14 | auto to_max_int_digit_count = to_precision - to_scale; | 747 | | // may overflow. nullable result column. | 748 | 14 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 749 | | // only in non-strict mode and may overflow, we set nullable | 750 | 14 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 751 | | | 752 | 14 | constexpr UInt32 to_max_digits = | 753 | 14 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 754 | 14 | bool multiply_may_overflow = false; | 755 | 14 | if (to_scale > from_scale) { | 756 | 8 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 757 | 8 | } | 758 | 14 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 759 | 14 | sizeof(typename ToFieldType::NativeType)), | 760 | 14 | FromFieldType, typename ToFieldType::NativeType>; | 761 | 14 | MaxNativeType scale_multiplier = | 762 | 14 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 763 | 14 | typename ToFieldType::NativeType max_result = | 764 | 14 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 765 | 14 | typename ToFieldType::NativeType min_result = -max_result; | 766 | | | 767 | 14 | ColumnUInt8::MutablePtr col_null_map_to; | 768 | 14 | NullMap::value_type* null_map_data = nullptr; | 769 | 14 | if (narrow_integral) { | 770 | 14 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 771 | 14 | null_map_data = col_null_map_to->get_data().data(); | 772 | 14 | } | 773 | | | 774 | 14 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 775 | 14 | const auto& vec_from = col_from->get_data(); | 776 | 14 | const auto* vec_from_data = vec_from.data(); | 777 | 14 | auto& vec_to = col_to->get_data(); | 778 | 14 | auto* vec_to_data = vec_to.data(); | 779 | | | 780 | 14 | CastParameters params; | 781 | 14 | params.is_strict = (CastMode == CastModeType::StrictMode); | 782 | 14 | size_t size = vec_from.size(); | 783 | | | 784 | 14 | RETURN_IF_ERROR(std::visit( | 785 | 14 | [&](auto multiply_may_overflow, auto narrow_integral) { | 786 | 14 | for (size_t i = 0; i < size; i++) { | 787 | 14 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 788 | 14 | typename ToDataType::FieldType, | 789 | 14 | multiply_may_overflow, narrow_integral>( | 790 | 14 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 791 | 14 | scale_multiplier, min_result, max_result, params)) { | 792 | 14 | if (set_nullable) { | 793 | 14 | null_map_data[i] = 1; | 794 | 14 | } else { | 795 | 14 | return params.status; | 796 | 14 | } | 797 | 14 | } | 798 | 14 | } | 799 | 14 | return Status::OK(); | 800 | 14 | }, | 801 | 14 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 802 | | | 803 | 14 | if (narrow_integral) { | 804 | 14 | block.get_by_position(result).column = | 805 | 14 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 806 | 14 | } else { | 807 | 0 | block.get_by_position(result).column = std::move(col_to); | 808 | 0 | } | 809 | 14 | return Status::OK(); | 810 | 14 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE2EEENS_15DataTypeDecimalILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 724 | 2 | const NullMap::value_type* null_map = nullptr) const override { | 725 | 2 | using FromFieldType = typename FromDataType::FieldType; | 726 | 2 | using ToFieldType = typename ToDataType::FieldType; | 727 | 2 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 728 | 2 | const auto* col_from = | 729 | 2 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 730 | 2 | if (!col_from) { | 731 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 732 | 0 | named_from.column->get_name()); | 733 | 0 | } | 734 | | | 735 | 2 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 736 | 2 | constexpr UInt32 from_scale = 0; | 737 | | | 738 | 2 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 739 | 2 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 740 | 2 | UInt32 to_precision = to_decimal_type.get_precision(); | 741 | 2 | ToDataType::check_type_precision(to_precision); | 742 | 2 | UInt32 to_scale = to_decimal_type.get_scale(); | 743 | 2 | ToDataType::check_type_scale(to_scale); | 744 | | | 745 | 2 | auto from_max_int_digit_count = from_precision - from_scale; | 746 | 2 | auto to_max_int_digit_count = to_precision - to_scale; | 747 | | // may overflow. nullable result column. | 748 | 2 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 749 | | // only in non-strict mode and may overflow, we set nullable | 750 | 2 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 751 | | | 752 | 2 | constexpr UInt32 to_max_digits = | 753 | 2 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 754 | 2 | bool multiply_may_overflow = false; | 755 | 2 | if (to_scale > from_scale) { | 756 | 2 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 757 | 2 | } | 758 | 2 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 759 | 2 | sizeof(typename ToFieldType::NativeType)), | 760 | 2 | FromFieldType, typename ToFieldType::NativeType>; | 761 | 2 | MaxNativeType scale_multiplier = | 762 | 2 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 763 | 2 | typename ToFieldType::NativeType max_result = | 764 | 2 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 765 | 2 | typename ToFieldType::NativeType min_result = -max_result; | 766 | | | 767 | 2 | ColumnUInt8::MutablePtr col_null_map_to; | 768 | 2 | NullMap::value_type* null_map_data = nullptr; | 769 | 2 | if (narrow_integral) { | 770 | 2 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 771 | 2 | null_map_data = col_null_map_to->get_data().data(); | 772 | 2 | } | 773 | | | 774 | 2 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 775 | 2 | const auto& vec_from = col_from->get_data(); | 776 | 2 | const auto* vec_from_data = vec_from.data(); | 777 | 2 | auto& vec_to = col_to->get_data(); | 778 | 2 | auto* vec_to_data = vec_to.data(); | 779 | | | 780 | 2 | CastParameters params; | 781 | 2 | params.is_strict = (CastMode == CastModeType::StrictMode); | 782 | 2 | size_t size = vec_from.size(); | 783 | | | 784 | 2 | RETURN_IF_ERROR(std::visit( | 785 | 2 | [&](auto multiply_may_overflow, auto narrow_integral) { | 786 | 2 | for (size_t i = 0; i < size; i++) { | 787 | 2 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 788 | 2 | typename ToDataType::FieldType, | 789 | 2 | multiply_may_overflow, narrow_integral>( | 790 | 2 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 791 | 2 | scale_multiplier, min_result, max_result, params)) { | 792 | 2 | if (set_nullable) { | 793 | 2 | null_map_data[i] = 1; | 794 | 2 | } else { | 795 | 2 | return params.status; | 796 | 2 | } | 797 | 2 | } | 798 | 2 | } | 799 | 2 | return Status::OK(); | 800 | 2 | }, | 801 | 2 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 802 | | | 803 | 1 | if (narrow_integral) { | 804 | 1 | block.get_by_position(result).column = | 805 | 1 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 806 | 1 | } else { | 807 | 0 | block.get_by_position(result).column = std::move(col_to); | 808 | 0 | } | 809 | 1 | return Status::OK(); | 810 | 2 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE2EEENS_15DataTypeDecimalILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 724 | 5 | const NullMap::value_type* null_map = nullptr) const override { | 725 | 5 | using FromFieldType = typename FromDataType::FieldType; | 726 | 5 | using ToFieldType = typename ToDataType::FieldType; | 727 | 5 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 728 | 5 | const auto* col_from = | 729 | 5 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 730 | 5 | if (!col_from) { | 731 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 732 | 0 | named_from.column->get_name()); | 733 | 0 | } | 734 | | | 735 | 5 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 736 | 5 | constexpr UInt32 from_scale = 0; | 737 | | | 738 | 5 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 739 | 5 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 740 | 5 | UInt32 to_precision = to_decimal_type.get_precision(); | 741 | 5 | ToDataType::check_type_precision(to_precision); | 742 | 5 | UInt32 to_scale = to_decimal_type.get_scale(); | 743 | 5 | ToDataType::check_type_scale(to_scale); | 744 | | | 745 | 5 | auto from_max_int_digit_count = from_precision - from_scale; | 746 | 5 | auto to_max_int_digit_count = to_precision - to_scale; | 747 | | // may overflow. nullable result column. | 748 | 5 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 749 | | // only in non-strict mode and may overflow, we set nullable | 750 | 5 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 751 | | | 752 | 5 | constexpr UInt32 to_max_digits = | 753 | 5 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 754 | 5 | bool multiply_may_overflow = false; | 755 | 5 | if (to_scale > from_scale) { | 756 | 4 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 757 | 4 | } | 758 | 5 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 759 | 5 | sizeof(typename ToFieldType::NativeType)), | 760 | 5 | FromFieldType, typename ToFieldType::NativeType>; | 761 | 5 | MaxNativeType scale_multiplier = | 762 | 5 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 763 | 5 | typename ToFieldType::NativeType max_result = | 764 | 5 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 765 | 5 | typename ToFieldType::NativeType min_result = -max_result; | 766 | | | 767 | 5 | ColumnUInt8::MutablePtr col_null_map_to; | 768 | 5 | NullMap::value_type* null_map_data = nullptr; | 769 | 5 | if (narrow_integral) { | 770 | 1 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 771 | 1 | null_map_data = col_null_map_to->get_data().data(); | 772 | 1 | } | 773 | | | 774 | 5 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 775 | 5 | const auto& vec_from = col_from->get_data(); | 776 | 5 | const auto* vec_from_data = vec_from.data(); | 777 | 5 | auto& vec_to = col_to->get_data(); | 778 | 5 | auto* vec_to_data = vec_to.data(); | 779 | | | 780 | 5 | CastParameters params; | 781 | 5 | params.is_strict = (CastMode == CastModeType::StrictMode); | 782 | 5 | size_t size = vec_from.size(); | 783 | | | 784 | 5 | RETURN_IF_ERROR(std::visit( | 785 | 5 | [&](auto multiply_may_overflow, auto narrow_integral) { | 786 | 5 | for (size_t i = 0; i < size; i++) { | 787 | 5 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 788 | 5 | typename ToDataType::FieldType, | 789 | 5 | multiply_may_overflow, narrow_integral>( | 790 | 5 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 791 | 5 | scale_multiplier, min_result, max_result, params)) { | 792 | 5 | if (set_nullable) { | 793 | 5 | null_map_data[i] = 1; | 794 | 5 | } else { | 795 | 5 | return params.status; | 796 | 5 | } | 797 | 5 | } | 798 | 5 | } | 799 | 5 | return Status::OK(); | 800 | 5 | }, | 801 | 5 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 802 | | | 803 | 5 | if (narrow_integral) { | 804 | 1 | block.get_by_position(result).column = | 805 | 1 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 806 | 4 | } else { | 807 | 4 | block.get_by_position(result).column = std::move(col_to); | 808 | 4 | } | 809 | 5 | return Status::OK(); | 810 | 5 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE3EEENS_15DataTypeDecimalILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 724 | 19 | const NullMap::value_type* null_map = nullptr) const override { | 725 | 19 | using FromFieldType = typename FromDataType::FieldType; | 726 | 19 | using ToFieldType = typename ToDataType::FieldType; | 727 | 19 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 728 | 19 | const auto* col_from = | 729 | 19 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 730 | 19 | if (!col_from) { | 731 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 732 | 0 | named_from.column->get_name()); | 733 | 0 | } | 734 | | | 735 | 19 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 736 | 19 | constexpr UInt32 from_scale = 0; | 737 | | | 738 | 19 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 739 | 19 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 740 | 19 | UInt32 to_precision = to_decimal_type.get_precision(); | 741 | 19 | ToDataType::check_type_precision(to_precision); | 742 | 19 | UInt32 to_scale = to_decimal_type.get_scale(); | 743 | 19 | ToDataType::check_type_scale(to_scale); | 744 | | | 745 | 19 | auto from_max_int_digit_count = from_precision - from_scale; | 746 | 19 | auto to_max_int_digit_count = to_precision - to_scale; | 747 | | // may overflow. nullable result column. | 748 | 19 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 749 | | // only in non-strict mode and may overflow, we set nullable | 750 | 19 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 751 | | | 752 | 19 | constexpr UInt32 to_max_digits = | 753 | 19 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 754 | 19 | bool multiply_may_overflow = false; | 755 | 19 | if (to_scale > from_scale) { | 756 | 12 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 757 | 12 | } | 758 | 19 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 759 | 19 | sizeof(typename ToFieldType::NativeType)), | 760 | 19 | FromFieldType, typename ToFieldType::NativeType>; | 761 | 19 | MaxNativeType scale_multiplier = | 762 | 19 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 763 | 19 | typename ToFieldType::NativeType max_result = | 764 | 19 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 765 | 19 | typename ToFieldType::NativeType min_result = -max_result; | 766 | | | 767 | 19 | ColumnUInt8::MutablePtr col_null_map_to; | 768 | 19 | NullMap::value_type* null_map_data = nullptr; | 769 | 19 | if (narrow_integral) { | 770 | 15 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 771 | 15 | null_map_data = col_null_map_to->get_data().data(); | 772 | 15 | } | 773 | | | 774 | 19 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 775 | 19 | const auto& vec_from = col_from->get_data(); | 776 | 19 | const auto* vec_from_data = vec_from.data(); | 777 | 19 | auto& vec_to = col_to->get_data(); | 778 | 19 | auto* vec_to_data = vec_to.data(); | 779 | | | 780 | 19 | CastParameters params; | 781 | 19 | params.is_strict = (CastMode == CastModeType::StrictMode); | 782 | 19 | size_t size = vec_from.size(); | 783 | | | 784 | 19 | RETURN_IF_ERROR(std::visit( | 785 | 19 | [&](auto multiply_may_overflow, auto narrow_integral) { | 786 | 19 | for (size_t i = 0; i < size; i++) { | 787 | 19 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 788 | 19 | typename ToDataType::FieldType, | 789 | 19 | multiply_may_overflow, narrow_integral>( | 790 | 19 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 791 | 19 | scale_multiplier, min_result, max_result, params)) { | 792 | 19 | if (set_nullable) { | 793 | 19 | null_map_data[i] = 1; | 794 | 19 | } else { | 795 | 19 | return params.status; | 796 | 19 | } | 797 | 19 | } | 798 | 19 | } | 799 | 19 | return Status::OK(); | 800 | 19 | }, | 801 | 19 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 802 | | | 803 | 7 | if (narrow_integral) { | 804 | 3 | block.get_by_position(result).column = | 805 | 3 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 806 | 4 | } else { | 807 | 4 | block.get_by_position(result).column = std::move(col_to); | 808 | 4 | } | 809 | 7 | return Status::OK(); | 810 | 19 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE3EEENS_15DataTypeDecimalILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 724 | 10 | const NullMap::value_type* null_map = nullptr) const override { | 725 | 10 | using FromFieldType = typename FromDataType::FieldType; | 726 | 10 | using ToFieldType = typename ToDataType::FieldType; | 727 | 10 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 728 | 10 | const auto* col_from = | 729 | 10 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 730 | 10 | if (!col_from) { | 731 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 732 | 0 | named_from.column->get_name()); | 733 | 0 | } | 734 | | | 735 | 10 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 736 | 10 | constexpr UInt32 from_scale = 0; | 737 | | | 738 | 10 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 739 | 10 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 740 | 10 | UInt32 to_precision = to_decimal_type.get_precision(); | 741 | 10 | ToDataType::check_type_precision(to_precision); | 742 | 10 | UInt32 to_scale = to_decimal_type.get_scale(); | 743 | 10 | ToDataType::check_type_scale(to_scale); | 744 | | | 745 | 10 | auto from_max_int_digit_count = from_precision - from_scale; | 746 | 10 | auto to_max_int_digit_count = to_precision - to_scale; | 747 | | // may overflow. nullable result column. | 748 | 10 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 749 | | // only in non-strict mode and may overflow, we set nullable | 750 | 10 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 751 | | | 752 | 10 | constexpr UInt32 to_max_digits = | 753 | 10 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 754 | 10 | bool multiply_may_overflow = false; | 755 | 10 | if (to_scale > from_scale) { | 756 | 6 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 757 | 6 | } | 758 | 10 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 759 | 10 | sizeof(typename ToFieldType::NativeType)), | 760 | 10 | FromFieldType, typename ToFieldType::NativeType>; | 761 | 10 | MaxNativeType scale_multiplier = | 762 | 10 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 763 | 10 | typename ToFieldType::NativeType max_result = | 764 | 10 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 765 | 10 | typename ToFieldType::NativeType min_result = -max_result; | 766 | | | 767 | 10 | ColumnUInt8::MutablePtr col_null_map_to; | 768 | 10 | NullMap::value_type* null_map_data = nullptr; | 769 | 10 | if (narrow_integral) { | 770 | 6 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 771 | 6 | null_map_data = col_null_map_to->get_data().data(); | 772 | 6 | } | 773 | | | 774 | 10 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 775 | 10 | const auto& vec_from = col_from->get_data(); | 776 | 10 | const auto* vec_from_data = vec_from.data(); | 777 | 10 | auto& vec_to = col_to->get_data(); | 778 | 10 | auto* vec_to_data = vec_to.data(); | 779 | | | 780 | 10 | CastParameters params; | 781 | 10 | params.is_strict = (CastMode == CastModeType::StrictMode); | 782 | 10 | size_t size = vec_from.size(); | 783 | | | 784 | 10 | RETURN_IF_ERROR(std::visit( | 785 | 10 | [&](auto multiply_may_overflow, auto narrow_integral) { | 786 | 10 | for (size_t i = 0; i < size; i++) { | 787 | 10 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 788 | 10 | typename ToDataType::FieldType, | 789 | 10 | multiply_may_overflow, narrow_integral>( | 790 | 10 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 791 | 10 | scale_multiplier, min_result, max_result, params)) { | 792 | 10 | if (set_nullable) { | 793 | 10 | null_map_data[i] = 1; | 794 | 10 | } else { | 795 | 10 | return params.status; | 796 | 10 | } | 797 | 10 | } | 798 | 10 | } | 799 | 10 | return Status::OK(); | 800 | 10 | }, | 801 | 10 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 802 | | | 803 | 10 | if (narrow_integral) { | 804 | 6 | block.get_by_position(result).column = | 805 | 6 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 806 | 6 | } else { | 807 | 4 | block.get_by_position(result).column = std::move(col_to); | 808 | 4 | } | 809 | 10 | return Status::OK(); | 810 | 10 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE4EEENS_15DataTypeDecimalILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 724 | 19 | const NullMap::value_type* null_map = nullptr) const override { | 725 | 19 | using FromFieldType = typename FromDataType::FieldType; | 726 | 19 | using ToFieldType = typename ToDataType::FieldType; | 727 | 19 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 728 | 19 | const auto* col_from = | 729 | 19 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 730 | 19 | if (!col_from) { | 731 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 732 | 0 | named_from.column->get_name()); | 733 | 0 | } | 734 | | | 735 | 19 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 736 | 19 | constexpr UInt32 from_scale = 0; | 737 | | | 738 | 19 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 739 | 19 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 740 | 19 | UInt32 to_precision = to_decimal_type.get_precision(); | 741 | 19 | ToDataType::check_type_precision(to_precision); | 742 | 19 | UInt32 to_scale = to_decimal_type.get_scale(); | 743 | 19 | ToDataType::check_type_scale(to_scale); | 744 | | | 745 | 19 | auto from_max_int_digit_count = from_precision - from_scale; | 746 | 19 | auto to_max_int_digit_count = to_precision - to_scale; | 747 | | // may overflow. nullable result column. | 748 | 19 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 749 | | // only in non-strict mode and may overflow, we set nullable | 750 | 19 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 751 | | | 752 | 19 | constexpr UInt32 to_max_digits = | 753 | 19 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 754 | 19 | bool multiply_may_overflow = false; | 755 | 19 | if (to_scale > from_scale) { | 756 | 12 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 757 | 12 | } | 758 | 19 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 759 | 19 | sizeof(typename ToFieldType::NativeType)), | 760 | 19 | FromFieldType, typename ToFieldType::NativeType>; | 761 | 19 | MaxNativeType scale_multiplier = | 762 | 19 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 763 | 19 | typename ToFieldType::NativeType max_result = | 764 | 19 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 765 | 19 | typename ToFieldType::NativeType min_result = -max_result; | 766 | | | 767 | 19 | ColumnUInt8::MutablePtr col_null_map_to; | 768 | 19 | NullMap::value_type* null_map_data = nullptr; | 769 | 19 | if (narrow_integral) { | 770 | 15 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 771 | 15 | null_map_data = col_null_map_to->get_data().data(); | 772 | 15 | } | 773 | | | 774 | 19 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 775 | 19 | const auto& vec_from = col_from->get_data(); | 776 | 19 | const auto* vec_from_data = vec_from.data(); | 777 | 19 | auto& vec_to = col_to->get_data(); | 778 | 19 | auto* vec_to_data = vec_to.data(); | 779 | | | 780 | 19 | CastParameters params; | 781 | 19 | params.is_strict = (CastMode == CastModeType::StrictMode); | 782 | 19 | size_t size = vec_from.size(); | 783 | | | 784 | 19 | RETURN_IF_ERROR(std::visit( | 785 | 19 | [&](auto multiply_may_overflow, auto narrow_integral) { | 786 | 19 | for (size_t i = 0; i < size; i++) { | 787 | 19 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 788 | 19 | typename ToDataType::FieldType, | 789 | 19 | multiply_may_overflow, narrow_integral>( | 790 | 19 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 791 | 19 | scale_multiplier, min_result, max_result, params)) { | 792 | 19 | if (set_nullable) { | 793 | 19 | null_map_data[i] = 1; | 794 | 19 | } else { | 795 | 19 | return params.status; | 796 | 19 | } | 797 | 19 | } | 798 | 19 | } | 799 | 19 | return Status::OK(); | 800 | 19 | }, | 801 | 19 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 802 | | | 803 | 7 | if (narrow_integral) { | 804 | 3 | block.get_by_position(result).column = | 805 | 3 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 806 | 4 | } else { | 807 | 4 | block.get_by_position(result).column = std::move(col_to); | 808 | 4 | } | 809 | 7 | return Status::OK(); | 810 | 19 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE4EEENS_15DataTypeDecimalILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 724 | 10 | const NullMap::value_type* null_map = nullptr) const override { | 725 | 10 | using FromFieldType = typename FromDataType::FieldType; | 726 | 10 | using ToFieldType = typename ToDataType::FieldType; | 727 | 10 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 728 | 10 | const auto* col_from = | 729 | 10 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 730 | 10 | if (!col_from) { | 731 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 732 | 0 | named_from.column->get_name()); | 733 | 0 | } | 734 | | | 735 | 10 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 736 | 10 | constexpr UInt32 from_scale = 0; | 737 | | | 738 | 10 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 739 | 10 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 740 | 10 | UInt32 to_precision = to_decimal_type.get_precision(); | 741 | 10 | ToDataType::check_type_precision(to_precision); | 742 | 10 | UInt32 to_scale = to_decimal_type.get_scale(); | 743 | 10 | ToDataType::check_type_scale(to_scale); | 744 | | | 745 | 10 | auto from_max_int_digit_count = from_precision - from_scale; | 746 | 10 | auto to_max_int_digit_count = to_precision - to_scale; | 747 | | // may overflow. nullable result column. | 748 | 10 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 749 | | // only in non-strict mode and may overflow, we set nullable | 750 | 10 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 751 | | | 752 | 10 | constexpr UInt32 to_max_digits = | 753 | 10 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 754 | 10 | bool multiply_may_overflow = false; | 755 | 10 | if (to_scale > from_scale) { | 756 | 6 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 757 | 6 | } | 758 | 10 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 759 | 10 | sizeof(typename ToFieldType::NativeType)), | 760 | 10 | FromFieldType, typename ToFieldType::NativeType>; | 761 | 10 | MaxNativeType scale_multiplier = | 762 | 10 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 763 | 10 | typename ToFieldType::NativeType max_result = | 764 | 10 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 765 | 10 | typename ToFieldType::NativeType min_result = -max_result; | 766 | | | 767 | 10 | ColumnUInt8::MutablePtr col_null_map_to; | 768 | 10 | NullMap::value_type* null_map_data = nullptr; | 769 | 10 | if (narrow_integral) { | 770 | 6 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 771 | 6 | null_map_data = col_null_map_to->get_data().data(); | 772 | 6 | } | 773 | | | 774 | 10 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 775 | 10 | const auto& vec_from = col_from->get_data(); | 776 | 10 | const auto* vec_from_data = vec_from.data(); | 777 | 10 | auto& vec_to = col_to->get_data(); | 778 | 10 | auto* vec_to_data = vec_to.data(); | 779 | | | 780 | 10 | CastParameters params; | 781 | 10 | params.is_strict = (CastMode == CastModeType::StrictMode); | 782 | 10 | size_t size = vec_from.size(); | 783 | | | 784 | 10 | RETURN_IF_ERROR(std::visit( | 785 | 10 | [&](auto multiply_may_overflow, auto narrow_integral) { | 786 | 10 | for (size_t i = 0; i < size; i++) { | 787 | 10 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 788 | 10 | typename ToDataType::FieldType, | 789 | 10 | multiply_may_overflow, narrow_integral>( | 790 | 10 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 791 | 10 | scale_multiplier, min_result, max_result, params)) { | 792 | 10 | if (set_nullable) { | 793 | 10 | null_map_data[i] = 1; | 794 | 10 | } else { | 795 | 10 | return params.status; | 796 | 10 | } | 797 | 10 | } | 798 | 10 | } | 799 | 10 | return Status::OK(); | 800 | 10 | }, | 801 | 10 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 802 | | | 803 | 10 | if (narrow_integral) { | 804 | 6 | block.get_by_position(result).column = | 805 | 6 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 806 | 6 | } else { | 807 | 4 | block.get_by_position(result).column = std::move(col_to); | 808 | 4 | } | 809 | 10 | return Status::OK(); | 810 | 10 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE5EEENS_15DataTypeDecimalILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 724 | 19 | const NullMap::value_type* null_map = nullptr) const override { | 725 | 19 | using FromFieldType = typename FromDataType::FieldType; | 726 | 19 | using ToFieldType = typename ToDataType::FieldType; | 727 | 19 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 728 | 19 | const auto* col_from = | 729 | 19 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 730 | 19 | if (!col_from) { | 731 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 732 | 0 | named_from.column->get_name()); | 733 | 0 | } | 734 | | | 735 | 19 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 736 | 19 | constexpr UInt32 from_scale = 0; | 737 | | | 738 | 19 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 739 | 19 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 740 | 19 | UInt32 to_precision = to_decimal_type.get_precision(); | 741 | 19 | ToDataType::check_type_precision(to_precision); | 742 | 19 | UInt32 to_scale = to_decimal_type.get_scale(); | 743 | 19 | ToDataType::check_type_scale(to_scale); | 744 | | | 745 | 19 | auto from_max_int_digit_count = from_precision - from_scale; | 746 | 19 | auto to_max_int_digit_count = to_precision - to_scale; | 747 | | // may overflow. nullable result column. | 748 | 19 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 749 | | // only in non-strict mode and may overflow, we set nullable | 750 | 19 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 751 | | | 752 | 19 | constexpr UInt32 to_max_digits = | 753 | 19 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 754 | 19 | bool multiply_may_overflow = false; | 755 | 19 | if (to_scale > from_scale) { | 756 | 12 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 757 | 12 | } | 758 | 19 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 759 | 19 | sizeof(typename ToFieldType::NativeType)), | 760 | 19 | FromFieldType, typename ToFieldType::NativeType>; | 761 | 19 | MaxNativeType scale_multiplier = | 762 | 19 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 763 | 19 | typename ToFieldType::NativeType max_result = | 764 | 19 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 765 | 19 | typename ToFieldType::NativeType min_result = -max_result; | 766 | | | 767 | 19 | ColumnUInt8::MutablePtr col_null_map_to; | 768 | 19 | NullMap::value_type* null_map_data = nullptr; | 769 | 19 | if (narrow_integral) { | 770 | 15 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 771 | 15 | null_map_data = col_null_map_to->get_data().data(); | 772 | 15 | } | 773 | | | 774 | 19 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 775 | 19 | const auto& vec_from = col_from->get_data(); | 776 | 19 | const auto* vec_from_data = vec_from.data(); | 777 | 19 | auto& vec_to = col_to->get_data(); | 778 | 19 | auto* vec_to_data = vec_to.data(); | 779 | | | 780 | 19 | CastParameters params; | 781 | 19 | params.is_strict = (CastMode == CastModeType::StrictMode); | 782 | 19 | size_t size = vec_from.size(); | 783 | | | 784 | 19 | RETURN_IF_ERROR(std::visit( | 785 | 19 | [&](auto multiply_may_overflow, auto narrow_integral) { | 786 | 19 | for (size_t i = 0; i < size; i++) { | 787 | 19 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 788 | 19 | typename ToDataType::FieldType, | 789 | 19 | multiply_may_overflow, narrow_integral>( | 790 | 19 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 791 | 19 | scale_multiplier, min_result, max_result, params)) { | 792 | 19 | if (set_nullable) { | 793 | 19 | null_map_data[i] = 1; | 794 | 19 | } else { | 795 | 19 | return params.status; | 796 | 19 | } | 797 | 19 | } | 798 | 19 | } | 799 | 19 | return Status::OK(); | 800 | 19 | }, | 801 | 19 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 802 | | | 803 | 7 | if (narrow_integral) { | 804 | 3 | block.get_by_position(result).column = | 805 | 3 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 806 | 4 | } else { | 807 | 4 | block.get_by_position(result).column = std::move(col_to); | 808 | 4 | } | 809 | 7 | return Status::OK(); | 810 | 19 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE5EEENS_15DataTypeDecimalILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 724 | 10 | const NullMap::value_type* null_map = nullptr) const override { | 725 | 10 | using FromFieldType = typename FromDataType::FieldType; | 726 | 10 | using ToFieldType = typename ToDataType::FieldType; | 727 | 10 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 728 | 10 | const auto* col_from = | 729 | 10 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 730 | 10 | if (!col_from) { | 731 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 732 | 0 | named_from.column->get_name()); | 733 | 0 | } | 734 | | | 735 | 10 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 736 | 10 | constexpr UInt32 from_scale = 0; | 737 | | | 738 | 10 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 739 | 10 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 740 | 10 | UInt32 to_precision = to_decimal_type.get_precision(); | 741 | 10 | ToDataType::check_type_precision(to_precision); | 742 | 10 | UInt32 to_scale = to_decimal_type.get_scale(); | 743 | 10 | ToDataType::check_type_scale(to_scale); | 744 | | | 745 | 10 | auto from_max_int_digit_count = from_precision - from_scale; | 746 | 10 | auto to_max_int_digit_count = to_precision - to_scale; | 747 | | // may overflow. nullable result column. | 748 | 10 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 749 | | // only in non-strict mode and may overflow, we set nullable | 750 | 10 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 751 | | | 752 | 10 | constexpr UInt32 to_max_digits = | 753 | 10 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 754 | 10 | bool multiply_may_overflow = false; | 755 | 10 | if (to_scale > from_scale) { | 756 | 6 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 757 | 6 | } | 758 | 10 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 759 | 10 | sizeof(typename ToFieldType::NativeType)), | 760 | 10 | FromFieldType, typename ToFieldType::NativeType>; | 761 | 10 | MaxNativeType scale_multiplier = | 762 | 10 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 763 | 10 | typename ToFieldType::NativeType max_result = | 764 | 10 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 765 | 10 | typename ToFieldType::NativeType min_result = -max_result; | 766 | | | 767 | 10 | ColumnUInt8::MutablePtr col_null_map_to; | 768 | 10 | NullMap::value_type* null_map_data = nullptr; | 769 | 10 | if (narrow_integral) { | 770 | 6 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 771 | 6 | null_map_data = col_null_map_to->get_data().data(); | 772 | 6 | } | 773 | | | 774 | 10 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 775 | 10 | const auto& vec_from = col_from->get_data(); | 776 | 10 | const auto* vec_from_data = vec_from.data(); | 777 | 10 | auto& vec_to = col_to->get_data(); | 778 | 10 | auto* vec_to_data = vec_to.data(); | 779 | | | 780 | 10 | CastParameters params; | 781 | 10 | params.is_strict = (CastMode == CastModeType::StrictMode); | 782 | 10 | size_t size = vec_from.size(); | 783 | | | 784 | 10 | RETURN_IF_ERROR(std::visit( | 785 | 10 | [&](auto multiply_may_overflow, auto narrow_integral) { | 786 | 10 | for (size_t i = 0; i < size; i++) { | 787 | 10 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 788 | 10 | typename ToDataType::FieldType, | 789 | 10 | multiply_may_overflow, narrow_integral>( | 790 | 10 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 791 | 10 | scale_multiplier, min_result, max_result, params)) { | 792 | 10 | if (set_nullable) { | 793 | 10 | null_map_data[i] = 1; | 794 | 10 | } else { | 795 | 10 | return params.status; | 796 | 10 | } | 797 | 10 | } | 798 | 10 | } | 799 | 10 | return Status::OK(); | 800 | 10 | }, | 801 | 10 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 802 | | | 803 | 10 | if (narrow_integral) { | 804 | 6 | block.get_by_position(result).column = | 805 | 6 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 806 | 6 | } else { | 807 | 4 | block.get_by_position(result).column = std::move(col_to); | 808 | 4 | } | 809 | 10 | return Status::OK(); | 810 | 10 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE6EEENS_15DataTypeDecimalILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 724 | 23 | const NullMap::value_type* null_map = nullptr) const override { | 725 | 23 | using FromFieldType = typename FromDataType::FieldType; | 726 | 23 | using ToFieldType = typename ToDataType::FieldType; | 727 | 23 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 728 | 23 | const auto* col_from = | 729 | 23 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 730 | 23 | if (!col_from) { | 731 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 732 | 0 | named_from.column->get_name()); | 733 | 0 | } | 734 | | | 735 | 23 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 736 | 23 | constexpr UInt32 from_scale = 0; | 737 | | | 738 | 23 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 739 | 23 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 740 | 23 | UInt32 to_precision = to_decimal_type.get_precision(); | 741 | 23 | ToDataType::check_type_precision(to_precision); | 742 | 23 | UInt32 to_scale = to_decimal_type.get_scale(); | 743 | 23 | ToDataType::check_type_scale(to_scale); | 744 | | | 745 | 23 | auto from_max_int_digit_count = from_precision - from_scale; | 746 | 23 | auto to_max_int_digit_count = to_precision - to_scale; | 747 | | // may overflow. nullable result column. | 748 | 23 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 749 | | // only in non-strict mode and may overflow, we set nullable | 750 | 23 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 751 | | | 752 | 23 | constexpr UInt32 to_max_digits = | 753 | 23 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 754 | 23 | bool multiply_may_overflow = false; | 755 | 23 | if (to_scale > from_scale) { | 756 | 16 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 757 | 16 | } | 758 | 23 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 759 | 23 | sizeof(typename ToFieldType::NativeType)), | 760 | 23 | FromFieldType, typename ToFieldType::NativeType>; | 761 | 23 | MaxNativeType scale_multiplier = | 762 | 23 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 763 | 23 | typename ToFieldType::NativeType max_result = | 764 | 23 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 765 | 23 | typename ToFieldType::NativeType min_result = -max_result; | 766 | | | 767 | 23 | ColumnUInt8::MutablePtr col_null_map_to; | 768 | 23 | NullMap::value_type* null_map_data = nullptr; | 769 | 23 | if (narrow_integral) { | 770 | 20 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 771 | 20 | null_map_data = col_null_map_to->get_data().data(); | 772 | 20 | } | 773 | | | 774 | 23 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 775 | 23 | const auto& vec_from = col_from->get_data(); | 776 | 23 | const auto* vec_from_data = vec_from.data(); | 777 | 23 | auto& vec_to = col_to->get_data(); | 778 | 23 | auto* vec_to_data = vec_to.data(); | 779 | | | 780 | 23 | CastParameters params; | 781 | 23 | params.is_strict = (CastMode == CastModeType::StrictMode); | 782 | 23 | size_t size = vec_from.size(); | 783 | | | 784 | 23 | RETURN_IF_ERROR(std::visit( | 785 | 23 | [&](auto multiply_may_overflow, auto narrow_integral) { | 786 | 23 | for (size_t i = 0; i < size; i++) { | 787 | 23 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 788 | 23 | typename ToDataType::FieldType, | 789 | 23 | multiply_may_overflow, narrow_integral>( | 790 | 23 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 791 | 23 | scale_multiplier, min_result, max_result, params)) { | 792 | 23 | if (set_nullable) { | 793 | 23 | null_map_data[i] = 1; | 794 | 23 | } else { | 795 | 23 | return params.status; | 796 | 23 | } | 797 | 23 | } | 798 | 23 | } | 799 | 23 | return Status::OK(); | 800 | 23 | }, | 801 | 23 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 802 | | | 803 | 7 | if (narrow_integral) { | 804 | 4 | block.get_by_position(result).column = | 805 | 4 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 806 | 4 | } else { | 807 | 3 | block.get_by_position(result).column = std::move(col_to); | 808 | 3 | } | 809 | 7 | return Status::OK(); | 810 | 23 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE6EEENS_15DataTypeDecimalILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 724 | 11 | const NullMap::value_type* null_map = nullptr) const override { | 725 | 11 | using FromFieldType = typename FromDataType::FieldType; | 726 | 11 | using ToFieldType = typename ToDataType::FieldType; | 727 | 11 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 728 | 11 | const auto* col_from = | 729 | 11 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 730 | 11 | if (!col_from) { | 731 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 732 | 0 | named_from.column->get_name()); | 733 | 0 | } | 734 | | | 735 | 11 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 736 | 11 | constexpr UInt32 from_scale = 0; | 737 | | | 738 | 11 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 739 | 11 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 740 | 11 | UInt32 to_precision = to_decimal_type.get_precision(); | 741 | 11 | ToDataType::check_type_precision(to_precision); | 742 | 11 | UInt32 to_scale = to_decimal_type.get_scale(); | 743 | 11 | ToDataType::check_type_scale(to_scale); | 744 | | | 745 | 11 | auto from_max_int_digit_count = from_precision - from_scale; | 746 | 11 | auto to_max_int_digit_count = to_precision - to_scale; | 747 | | // may overflow. nullable result column. | 748 | 11 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 749 | | // only in non-strict mode and may overflow, we set nullable | 750 | 11 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 751 | | | 752 | 11 | constexpr UInt32 to_max_digits = | 753 | 11 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 754 | 11 | bool multiply_may_overflow = false; | 755 | 11 | if (to_scale > from_scale) { | 756 | 7 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 757 | 7 | } | 758 | 11 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 759 | 11 | sizeof(typename ToFieldType::NativeType)), | 760 | 11 | FromFieldType, typename ToFieldType::NativeType>; | 761 | 11 | MaxNativeType scale_multiplier = | 762 | 11 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 763 | 11 | typename ToFieldType::NativeType max_result = | 764 | 11 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 765 | 11 | typename ToFieldType::NativeType min_result = -max_result; | 766 | | | 767 | 11 | ColumnUInt8::MutablePtr col_null_map_to; | 768 | 11 | NullMap::value_type* null_map_data = nullptr; | 769 | 11 | if (narrow_integral) { | 770 | 8 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 771 | 8 | null_map_data = col_null_map_to->get_data().data(); | 772 | 8 | } | 773 | | | 774 | 11 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 775 | 11 | const auto& vec_from = col_from->get_data(); | 776 | 11 | const auto* vec_from_data = vec_from.data(); | 777 | 11 | auto& vec_to = col_to->get_data(); | 778 | 11 | auto* vec_to_data = vec_to.data(); | 779 | | | 780 | 11 | CastParameters params; | 781 | 11 | params.is_strict = (CastMode == CastModeType::StrictMode); | 782 | 11 | size_t size = vec_from.size(); | 783 | | | 784 | 11 | RETURN_IF_ERROR(std::visit( | 785 | 11 | [&](auto multiply_may_overflow, auto narrow_integral) { | 786 | 11 | for (size_t i = 0; i < size; i++) { | 787 | 11 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 788 | 11 | typename ToDataType::FieldType, | 789 | 11 | multiply_may_overflow, narrow_integral>( | 790 | 11 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 791 | 11 | scale_multiplier, min_result, max_result, params)) { | 792 | 11 | if (set_nullable) { | 793 | 11 | null_map_data[i] = 1; | 794 | 11 | } else { | 795 | 11 | return params.status; | 796 | 11 | } | 797 | 11 | } | 798 | 11 | } | 799 | 11 | return Status::OK(); | 800 | 11 | }, | 801 | 11 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 802 | | | 803 | 11 | if (narrow_integral) { | 804 | 8 | block.get_by_position(result).column = | 805 | 8 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 806 | 8 | } else { | 807 | 3 | block.get_by_position(result).column = std::move(col_to); | 808 | 3 | } | 809 | 11 | return Status::OK(); | 810 | 11 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE7EEENS_15DataTypeDecimalILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 724 | 35 | const NullMap::value_type* null_map = nullptr) const override { | 725 | 35 | using FromFieldType = typename FromDataType::FieldType; | 726 | 35 | using ToFieldType = typename ToDataType::FieldType; | 727 | 35 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 728 | 35 | const auto* col_from = | 729 | 35 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 730 | 35 | if (!col_from) { | 731 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 732 | 0 | named_from.column->get_name()); | 733 | 0 | } | 734 | | | 735 | 35 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 736 | 35 | constexpr UInt32 from_scale = 0; | 737 | | | 738 | 35 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 739 | 35 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 740 | 35 | UInt32 to_precision = to_decimal_type.get_precision(); | 741 | 35 | ToDataType::check_type_precision(to_precision); | 742 | 35 | UInt32 to_scale = to_decimal_type.get_scale(); | 743 | 35 | ToDataType::check_type_scale(to_scale); | 744 | | | 745 | 35 | auto from_max_int_digit_count = from_precision - from_scale; | 746 | 35 | auto to_max_int_digit_count = to_precision - to_scale; | 747 | | // may overflow. nullable result column. | 748 | 35 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 749 | | // only in non-strict mode and may overflow, we set nullable | 750 | 35 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 751 | | | 752 | 35 | constexpr UInt32 to_max_digits = | 753 | 35 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 754 | 35 | bool multiply_may_overflow = false; | 755 | 35 | if (to_scale > from_scale) { | 756 | 20 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 757 | 20 | } | 758 | 35 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 759 | 35 | sizeof(typename ToFieldType::NativeType)), | 760 | 35 | FromFieldType, typename ToFieldType::NativeType>; | 761 | 35 | MaxNativeType scale_multiplier = | 762 | 35 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 763 | 35 | typename ToFieldType::NativeType max_result = | 764 | 35 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 765 | 35 | typename ToFieldType::NativeType min_result = -max_result; | 766 | | | 767 | 35 | ColumnUInt8::MutablePtr col_null_map_to; | 768 | 35 | NullMap::value_type* null_map_data = nullptr; | 769 | 35 | if (narrow_integral) { | 770 | 35 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 771 | 35 | null_map_data = col_null_map_to->get_data().data(); | 772 | 35 | } | 773 | | | 774 | 35 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 775 | 35 | const auto& vec_from = col_from->get_data(); | 776 | 35 | const auto* vec_from_data = vec_from.data(); | 777 | 35 | auto& vec_to = col_to->get_data(); | 778 | 35 | auto* vec_to_data = vec_to.data(); | 779 | | | 780 | 35 | CastParameters params; | 781 | 35 | params.is_strict = (CastMode == CastModeType::StrictMode); | 782 | 35 | size_t size = vec_from.size(); | 783 | | | 784 | 35 | RETURN_IF_ERROR(std::visit( | 785 | 35 | [&](auto multiply_may_overflow, auto narrow_integral) { | 786 | 35 | for (size_t i = 0; i < size; i++) { | 787 | 35 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 788 | 35 | typename ToDataType::FieldType, | 789 | 35 | multiply_may_overflow, narrow_integral>( | 790 | 35 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 791 | 35 | scale_multiplier, min_result, max_result, params)) { | 792 | 35 | if (set_nullable) { | 793 | 35 | null_map_data[i] = 1; | 794 | 35 | } else { | 795 | 35 | return params.status; | 796 | 35 | } | 797 | 35 | } | 798 | 35 | } | 799 | 35 | return Status::OK(); | 800 | 35 | }, | 801 | 35 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 802 | | | 803 | 7 | if (narrow_integral) { | 804 | 7 | block.get_by_position(result).column = | 805 | 7 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 806 | 7 | } else { | 807 | 0 | block.get_by_position(result).column = std::move(col_to); | 808 | 0 | } | 809 | 7 | return Status::OK(); | 810 | 35 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE7EEENS_15DataTypeDecimalILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 724 | 14 | const NullMap::value_type* null_map = nullptr) const override { | 725 | 14 | using FromFieldType = typename FromDataType::FieldType; | 726 | 14 | using ToFieldType = typename ToDataType::FieldType; | 727 | 14 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 728 | 14 | const auto* col_from = | 729 | 14 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 730 | 14 | if (!col_from) { | 731 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 732 | 0 | named_from.column->get_name()); | 733 | 0 | } | 734 | | | 735 | 14 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 736 | 14 | constexpr UInt32 from_scale = 0; | 737 | | | 738 | 14 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 739 | 14 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 740 | 14 | UInt32 to_precision = to_decimal_type.get_precision(); | 741 | 14 | ToDataType::check_type_precision(to_precision); | 742 | 14 | UInt32 to_scale = to_decimal_type.get_scale(); | 743 | 14 | ToDataType::check_type_scale(to_scale); | 744 | | | 745 | 14 | auto from_max_int_digit_count = from_precision - from_scale; | 746 | 14 | auto to_max_int_digit_count = to_precision - to_scale; | 747 | | // may overflow. nullable result column. | 748 | 14 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 749 | | // only in non-strict mode and may overflow, we set nullable | 750 | 14 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 751 | | | 752 | 14 | constexpr UInt32 to_max_digits = | 753 | 14 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 754 | 14 | bool multiply_may_overflow = false; | 755 | 14 | if (to_scale > from_scale) { | 756 | 8 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 757 | 8 | } | 758 | 14 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 759 | 14 | sizeof(typename ToFieldType::NativeType)), | 760 | 14 | FromFieldType, typename ToFieldType::NativeType>; | 761 | 14 | MaxNativeType scale_multiplier = | 762 | 14 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 763 | 14 | typename ToFieldType::NativeType max_result = | 764 | 14 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 765 | 14 | typename ToFieldType::NativeType min_result = -max_result; | 766 | | | 767 | 14 | ColumnUInt8::MutablePtr col_null_map_to; | 768 | 14 | NullMap::value_type* null_map_data = nullptr; | 769 | 14 | if (narrow_integral) { | 770 | 14 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 771 | 14 | null_map_data = col_null_map_to->get_data().data(); | 772 | 14 | } | 773 | | | 774 | 14 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 775 | 14 | const auto& vec_from = col_from->get_data(); | 776 | 14 | const auto* vec_from_data = vec_from.data(); | 777 | 14 | auto& vec_to = col_to->get_data(); | 778 | 14 | auto* vec_to_data = vec_to.data(); | 779 | | | 780 | 14 | CastParameters params; | 781 | 14 | params.is_strict = (CastMode == CastModeType::StrictMode); | 782 | 14 | size_t size = vec_from.size(); | 783 | | | 784 | 14 | RETURN_IF_ERROR(std::visit( | 785 | 14 | [&](auto multiply_may_overflow, auto narrow_integral) { | 786 | 14 | for (size_t i = 0; i < size; i++) { | 787 | 14 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 788 | 14 | typename ToDataType::FieldType, | 789 | 14 | multiply_may_overflow, narrow_integral>( | 790 | 14 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 791 | 14 | scale_multiplier, min_result, max_result, params)) { | 792 | 14 | if (set_nullable) { | 793 | 14 | null_map_data[i] = 1; | 794 | 14 | } else { | 795 | 14 | return params.status; | 796 | 14 | } | 797 | 14 | } | 798 | 14 | } | 799 | 14 | return Status::OK(); | 800 | 14 | }, | 801 | 14 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 802 | | | 803 | 14 | if (narrow_integral) { | 804 | 14 | block.get_by_position(result).column = | 805 | 14 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 806 | 14 | } else { | 807 | 0 | block.get_by_position(result).column = std::move(col_to); | 808 | 0 | } | 809 | 14 | return Status::OK(); | 810 | 14 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE2EEENS_15DataTypeDecimalILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 724 | 2 | const NullMap::value_type* null_map = nullptr) const override { | 725 | 2 | using FromFieldType = typename FromDataType::FieldType; | 726 | 2 | using ToFieldType = typename ToDataType::FieldType; | 727 | 2 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 728 | 2 | const auto* col_from = | 729 | 2 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 730 | 2 | if (!col_from) { | 731 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 732 | 0 | named_from.column->get_name()); | 733 | 0 | } | 734 | | | 735 | 2 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 736 | 2 | constexpr UInt32 from_scale = 0; | 737 | | | 738 | 2 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 739 | 2 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 740 | 2 | UInt32 to_precision = to_decimal_type.get_precision(); | 741 | 2 | ToDataType::check_type_precision(to_precision); | 742 | 2 | UInt32 to_scale = to_decimal_type.get_scale(); | 743 | 2 | ToDataType::check_type_scale(to_scale); | 744 | | | 745 | 2 | auto from_max_int_digit_count = from_precision - from_scale; | 746 | 2 | auto to_max_int_digit_count = to_precision - to_scale; | 747 | | // may overflow. nullable result column. | 748 | 2 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 749 | | // only in non-strict mode and may overflow, we set nullable | 750 | 2 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 751 | | | 752 | 2 | constexpr UInt32 to_max_digits = | 753 | 2 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 754 | 2 | bool multiply_may_overflow = false; | 755 | 2 | if (to_scale > from_scale) { | 756 | 2 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 757 | 2 | } | 758 | 2 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 759 | 2 | sizeof(typename ToFieldType::NativeType)), | 760 | 2 | FromFieldType, typename ToFieldType::NativeType>; | 761 | 2 | MaxNativeType scale_multiplier = | 762 | 2 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 763 | 2 | typename ToFieldType::NativeType max_result = | 764 | 2 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 765 | 2 | typename ToFieldType::NativeType min_result = -max_result; | 766 | | | 767 | 2 | ColumnUInt8::MutablePtr col_null_map_to; | 768 | 2 | NullMap::value_type* null_map_data = nullptr; | 769 | 2 | if (narrow_integral) { | 770 | 2 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 771 | 2 | null_map_data = col_null_map_to->get_data().data(); | 772 | 2 | } | 773 | | | 774 | 2 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 775 | 2 | const auto& vec_from = col_from->get_data(); | 776 | 2 | const auto* vec_from_data = vec_from.data(); | 777 | 2 | auto& vec_to = col_to->get_data(); | 778 | 2 | auto* vec_to_data = vec_to.data(); | 779 | | | 780 | 2 | CastParameters params; | 781 | 2 | params.is_strict = (CastMode == CastModeType::StrictMode); | 782 | 2 | size_t size = vec_from.size(); | 783 | | | 784 | 2 | RETURN_IF_ERROR(std::visit( | 785 | 2 | [&](auto multiply_may_overflow, auto narrow_integral) { | 786 | 2 | for (size_t i = 0; i < size; i++) { | 787 | 2 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 788 | 2 | typename ToDataType::FieldType, | 789 | 2 | multiply_may_overflow, narrow_integral>( | 790 | 2 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 791 | 2 | scale_multiplier, min_result, max_result, params)) { | 792 | 2 | if (set_nullable) { | 793 | 2 | null_map_data[i] = 1; | 794 | 2 | } else { | 795 | 2 | return params.status; | 796 | 2 | } | 797 | 2 | } | 798 | 2 | } | 799 | 2 | return Status::OK(); | 800 | 2 | }, | 801 | 2 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 802 | | | 803 | 1 | if (narrow_integral) { | 804 | 1 | block.get_by_position(result).column = | 805 | 1 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 806 | 1 | } else { | 807 | 0 | block.get_by_position(result).column = std::move(col_to); | 808 | 0 | } | 809 | 1 | return Status::OK(); | 810 | 2 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE2EEENS_15DataTypeDecimalILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 724 | 5 | const NullMap::value_type* null_map = nullptr) const override { | 725 | 5 | using FromFieldType = typename FromDataType::FieldType; | 726 | 5 | using ToFieldType = typename ToDataType::FieldType; | 727 | 5 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 728 | 5 | const auto* col_from = | 729 | 5 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 730 | 5 | if (!col_from) { | 731 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 732 | 0 | named_from.column->get_name()); | 733 | 0 | } | 734 | | | 735 | 5 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 736 | 5 | constexpr UInt32 from_scale = 0; | 737 | | | 738 | 5 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 739 | 5 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 740 | 5 | UInt32 to_precision = to_decimal_type.get_precision(); | 741 | 5 | ToDataType::check_type_precision(to_precision); | 742 | 5 | UInt32 to_scale = to_decimal_type.get_scale(); | 743 | 5 | ToDataType::check_type_scale(to_scale); | 744 | | | 745 | 5 | auto from_max_int_digit_count = from_precision - from_scale; | 746 | 5 | auto to_max_int_digit_count = to_precision - to_scale; | 747 | | // may overflow. nullable result column. | 748 | 5 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 749 | | // only in non-strict mode and may overflow, we set nullable | 750 | 5 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 751 | | | 752 | 5 | constexpr UInt32 to_max_digits = | 753 | 5 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 754 | 5 | bool multiply_may_overflow = false; | 755 | 5 | if (to_scale > from_scale) { | 756 | 4 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 757 | 4 | } | 758 | 5 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 759 | 5 | sizeof(typename ToFieldType::NativeType)), | 760 | 5 | FromFieldType, typename ToFieldType::NativeType>; | 761 | 5 | MaxNativeType scale_multiplier = | 762 | 5 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 763 | 5 | typename ToFieldType::NativeType max_result = | 764 | 5 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 765 | 5 | typename ToFieldType::NativeType min_result = -max_result; | 766 | | | 767 | 5 | ColumnUInt8::MutablePtr col_null_map_to; | 768 | 5 | NullMap::value_type* null_map_data = nullptr; | 769 | 5 | if (narrow_integral) { | 770 | 1 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 771 | 1 | null_map_data = col_null_map_to->get_data().data(); | 772 | 1 | } | 773 | | | 774 | 5 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 775 | 5 | const auto& vec_from = col_from->get_data(); | 776 | 5 | const auto* vec_from_data = vec_from.data(); | 777 | 5 | auto& vec_to = col_to->get_data(); | 778 | 5 | auto* vec_to_data = vec_to.data(); | 779 | | | 780 | 5 | CastParameters params; | 781 | 5 | params.is_strict = (CastMode == CastModeType::StrictMode); | 782 | 5 | size_t size = vec_from.size(); | 783 | | | 784 | 5 | RETURN_IF_ERROR(std::visit( | 785 | 5 | [&](auto multiply_may_overflow, auto narrow_integral) { | 786 | 5 | for (size_t i = 0; i < size; i++) { | 787 | 5 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 788 | 5 | typename ToDataType::FieldType, | 789 | 5 | multiply_may_overflow, narrow_integral>( | 790 | 5 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 791 | 5 | scale_multiplier, min_result, max_result, params)) { | 792 | 5 | if (set_nullable) { | 793 | 5 | null_map_data[i] = 1; | 794 | 5 | } else { | 795 | 5 | return params.status; | 796 | 5 | } | 797 | 5 | } | 798 | 5 | } | 799 | 5 | return Status::OK(); | 800 | 5 | }, | 801 | 5 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 802 | | | 803 | 5 | if (narrow_integral) { | 804 | 1 | block.get_by_position(result).column = | 805 | 1 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 806 | 4 | } else { | 807 | 4 | block.get_by_position(result).column = std::move(col_to); | 808 | 4 | } | 809 | 5 | return Status::OK(); | 810 | 5 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE3EEENS_15DataTypeDecimalILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 724 | 19 | const NullMap::value_type* null_map = nullptr) const override { | 725 | 19 | using FromFieldType = typename FromDataType::FieldType; | 726 | 19 | using ToFieldType = typename ToDataType::FieldType; | 727 | 19 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 728 | 19 | const auto* col_from = | 729 | 19 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 730 | 19 | if (!col_from) { | 731 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 732 | 0 | named_from.column->get_name()); | 733 | 0 | } | 734 | | | 735 | 19 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 736 | 19 | constexpr UInt32 from_scale = 0; | 737 | | | 738 | 19 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 739 | 19 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 740 | 19 | UInt32 to_precision = to_decimal_type.get_precision(); | 741 | 19 | ToDataType::check_type_precision(to_precision); | 742 | 19 | UInt32 to_scale = to_decimal_type.get_scale(); | 743 | 19 | ToDataType::check_type_scale(to_scale); | 744 | | | 745 | 19 | auto from_max_int_digit_count = from_precision - from_scale; | 746 | 19 | auto to_max_int_digit_count = to_precision - to_scale; | 747 | | // may overflow. nullable result column. | 748 | 19 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 749 | | // only in non-strict mode and may overflow, we set nullable | 750 | 19 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 751 | | | 752 | 19 | constexpr UInt32 to_max_digits = | 753 | 19 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 754 | 19 | bool multiply_may_overflow = false; | 755 | 19 | if (to_scale > from_scale) { | 756 | 12 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 757 | 12 | } | 758 | 19 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 759 | 19 | sizeof(typename ToFieldType::NativeType)), | 760 | 19 | FromFieldType, typename ToFieldType::NativeType>; | 761 | 19 | MaxNativeType scale_multiplier = | 762 | 19 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 763 | 19 | typename ToFieldType::NativeType max_result = | 764 | 19 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 765 | 19 | typename ToFieldType::NativeType min_result = -max_result; | 766 | | | 767 | 19 | ColumnUInt8::MutablePtr col_null_map_to; | 768 | 19 | NullMap::value_type* null_map_data = nullptr; | 769 | 19 | if (narrow_integral) { | 770 | 15 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 771 | 15 | null_map_data = col_null_map_to->get_data().data(); | 772 | 15 | } | 773 | | | 774 | 19 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 775 | 19 | const auto& vec_from = col_from->get_data(); | 776 | 19 | const auto* vec_from_data = vec_from.data(); | 777 | 19 | auto& vec_to = col_to->get_data(); | 778 | 19 | auto* vec_to_data = vec_to.data(); | 779 | | | 780 | 19 | CastParameters params; | 781 | 19 | params.is_strict = (CastMode == CastModeType::StrictMode); | 782 | 19 | size_t size = vec_from.size(); | 783 | | | 784 | 19 | RETURN_IF_ERROR(std::visit( | 785 | 19 | [&](auto multiply_may_overflow, auto narrow_integral) { | 786 | 19 | for (size_t i = 0; i < size; i++) { | 787 | 19 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 788 | 19 | typename ToDataType::FieldType, | 789 | 19 | multiply_may_overflow, narrow_integral>( | 790 | 19 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 791 | 19 | scale_multiplier, min_result, max_result, params)) { | 792 | 19 | if (set_nullable) { | 793 | 19 | null_map_data[i] = 1; | 794 | 19 | } else { | 795 | 19 | return params.status; | 796 | 19 | } | 797 | 19 | } | 798 | 19 | } | 799 | 19 | return Status::OK(); | 800 | 19 | }, | 801 | 19 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 802 | | | 803 | 7 | if (narrow_integral) { | 804 | 3 | block.get_by_position(result).column = | 805 | 3 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 806 | 4 | } else { | 807 | 4 | block.get_by_position(result).column = std::move(col_to); | 808 | 4 | } | 809 | 7 | return Status::OK(); | 810 | 19 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE3EEENS_15DataTypeDecimalILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 724 | 10 | const NullMap::value_type* null_map = nullptr) const override { | 725 | 10 | using FromFieldType = typename FromDataType::FieldType; | 726 | 10 | using ToFieldType = typename ToDataType::FieldType; | 727 | 10 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 728 | 10 | const auto* col_from = | 729 | 10 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 730 | 10 | if (!col_from) { | 731 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 732 | 0 | named_from.column->get_name()); | 733 | 0 | } | 734 | | | 735 | 10 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 736 | 10 | constexpr UInt32 from_scale = 0; | 737 | | | 738 | 10 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 739 | 10 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 740 | 10 | UInt32 to_precision = to_decimal_type.get_precision(); | 741 | 10 | ToDataType::check_type_precision(to_precision); | 742 | 10 | UInt32 to_scale = to_decimal_type.get_scale(); | 743 | 10 | ToDataType::check_type_scale(to_scale); | 744 | | | 745 | 10 | auto from_max_int_digit_count = from_precision - from_scale; | 746 | 10 | auto to_max_int_digit_count = to_precision - to_scale; | 747 | | // may overflow. nullable result column. | 748 | 10 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 749 | | // only in non-strict mode and may overflow, we set nullable | 750 | 10 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 751 | | | 752 | 10 | constexpr UInt32 to_max_digits = | 753 | 10 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 754 | 10 | bool multiply_may_overflow = false; | 755 | 10 | if (to_scale > from_scale) { | 756 | 6 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 757 | 6 | } | 758 | 10 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 759 | 10 | sizeof(typename ToFieldType::NativeType)), | 760 | 10 | FromFieldType, typename ToFieldType::NativeType>; | 761 | 10 | MaxNativeType scale_multiplier = | 762 | 10 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 763 | 10 | typename ToFieldType::NativeType max_result = | 764 | 10 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 765 | 10 | typename ToFieldType::NativeType min_result = -max_result; | 766 | | | 767 | 10 | ColumnUInt8::MutablePtr col_null_map_to; | 768 | 10 | NullMap::value_type* null_map_data = nullptr; | 769 | 10 | if (narrow_integral) { | 770 | 6 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 771 | 6 | null_map_data = col_null_map_to->get_data().data(); | 772 | 6 | } | 773 | | | 774 | 10 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 775 | 10 | const auto& vec_from = col_from->get_data(); | 776 | 10 | const auto* vec_from_data = vec_from.data(); | 777 | 10 | auto& vec_to = col_to->get_data(); | 778 | 10 | auto* vec_to_data = vec_to.data(); | 779 | | | 780 | 10 | CastParameters params; | 781 | 10 | params.is_strict = (CastMode == CastModeType::StrictMode); | 782 | 10 | size_t size = vec_from.size(); | 783 | | | 784 | 10 | RETURN_IF_ERROR(std::visit( | 785 | 10 | [&](auto multiply_may_overflow, auto narrow_integral) { | 786 | 10 | for (size_t i = 0; i < size; i++) { | 787 | 10 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 788 | 10 | typename ToDataType::FieldType, | 789 | 10 | multiply_may_overflow, narrow_integral>( | 790 | 10 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 791 | 10 | scale_multiplier, min_result, max_result, params)) { | 792 | 10 | if (set_nullable) { | 793 | 10 | null_map_data[i] = 1; | 794 | 10 | } else { | 795 | 10 | return params.status; | 796 | 10 | } | 797 | 10 | } | 798 | 10 | } | 799 | 10 | return Status::OK(); | 800 | 10 | }, | 801 | 10 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 802 | | | 803 | 10 | if (narrow_integral) { | 804 | 6 | block.get_by_position(result).column = | 805 | 6 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 806 | 6 | } else { | 807 | 4 | block.get_by_position(result).column = std::move(col_to); | 808 | 4 | } | 809 | 10 | return Status::OK(); | 810 | 10 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE4EEENS_15DataTypeDecimalILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 724 | 19 | const NullMap::value_type* null_map = nullptr) const override { | 725 | 19 | using FromFieldType = typename FromDataType::FieldType; | 726 | 19 | using ToFieldType = typename ToDataType::FieldType; | 727 | 19 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 728 | 19 | const auto* col_from = | 729 | 19 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 730 | 19 | if (!col_from) { | 731 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 732 | 0 | named_from.column->get_name()); | 733 | 0 | } | 734 | | | 735 | 19 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 736 | 19 | constexpr UInt32 from_scale = 0; | 737 | | | 738 | 19 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 739 | 19 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 740 | 19 | UInt32 to_precision = to_decimal_type.get_precision(); | 741 | 19 | ToDataType::check_type_precision(to_precision); | 742 | 19 | UInt32 to_scale = to_decimal_type.get_scale(); | 743 | 19 | ToDataType::check_type_scale(to_scale); | 744 | | | 745 | 19 | auto from_max_int_digit_count = from_precision - from_scale; | 746 | 19 | auto to_max_int_digit_count = to_precision - to_scale; | 747 | | // may overflow. nullable result column. | 748 | 19 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 749 | | // only in non-strict mode and may overflow, we set nullable | 750 | 19 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 751 | | | 752 | 19 | constexpr UInt32 to_max_digits = | 753 | 19 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 754 | 19 | bool multiply_may_overflow = false; | 755 | 19 | if (to_scale > from_scale) { | 756 | 12 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 757 | 12 | } | 758 | 19 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 759 | 19 | sizeof(typename ToFieldType::NativeType)), | 760 | 19 | FromFieldType, typename ToFieldType::NativeType>; | 761 | 19 | MaxNativeType scale_multiplier = | 762 | 19 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 763 | 19 | typename ToFieldType::NativeType max_result = | 764 | 19 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 765 | 19 | typename ToFieldType::NativeType min_result = -max_result; | 766 | | | 767 | 19 | ColumnUInt8::MutablePtr col_null_map_to; | 768 | 19 | NullMap::value_type* null_map_data = nullptr; | 769 | 19 | if (narrow_integral) { | 770 | 15 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 771 | 15 | null_map_data = col_null_map_to->get_data().data(); | 772 | 15 | } | 773 | | | 774 | 19 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 775 | 19 | const auto& vec_from = col_from->get_data(); | 776 | 19 | const auto* vec_from_data = vec_from.data(); | 777 | 19 | auto& vec_to = col_to->get_data(); | 778 | 19 | auto* vec_to_data = vec_to.data(); | 779 | | | 780 | 19 | CastParameters params; | 781 | 19 | params.is_strict = (CastMode == CastModeType::StrictMode); | 782 | 19 | size_t size = vec_from.size(); | 783 | | | 784 | 19 | RETURN_IF_ERROR(std::visit( | 785 | 19 | [&](auto multiply_may_overflow, auto narrow_integral) { | 786 | 19 | for (size_t i = 0; i < size; i++) { | 787 | 19 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 788 | 19 | typename ToDataType::FieldType, | 789 | 19 | multiply_may_overflow, narrow_integral>( | 790 | 19 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 791 | 19 | scale_multiplier, min_result, max_result, params)) { | 792 | 19 | if (set_nullable) { | 793 | 19 | null_map_data[i] = 1; | 794 | 19 | } else { | 795 | 19 | return params.status; | 796 | 19 | } | 797 | 19 | } | 798 | 19 | } | 799 | 19 | return Status::OK(); | 800 | 19 | }, | 801 | 19 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 802 | | | 803 | 7 | if (narrow_integral) { | 804 | 3 | block.get_by_position(result).column = | 805 | 3 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 806 | 4 | } else { | 807 | 4 | block.get_by_position(result).column = std::move(col_to); | 808 | 4 | } | 809 | 7 | return Status::OK(); | 810 | 19 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE4EEENS_15DataTypeDecimalILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 724 | 10 | const NullMap::value_type* null_map = nullptr) const override { | 725 | 10 | using FromFieldType = typename FromDataType::FieldType; | 726 | 10 | using ToFieldType = typename ToDataType::FieldType; | 727 | 10 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 728 | 10 | const auto* col_from = | 729 | 10 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 730 | 10 | if (!col_from) { | 731 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 732 | 0 | named_from.column->get_name()); | 733 | 0 | } | 734 | | | 735 | 10 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 736 | 10 | constexpr UInt32 from_scale = 0; | 737 | | | 738 | 10 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 739 | 10 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 740 | 10 | UInt32 to_precision = to_decimal_type.get_precision(); | 741 | 10 | ToDataType::check_type_precision(to_precision); | 742 | 10 | UInt32 to_scale = to_decimal_type.get_scale(); | 743 | 10 | ToDataType::check_type_scale(to_scale); | 744 | | | 745 | 10 | auto from_max_int_digit_count = from_precision - from_scale; | 746 | 10 | auto to_max_int_digit_count = to_precision - to_scale; | 747 | | // may overflow. nullable result column. | 748 | 10 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 749 | | // only in non-strict mode and may overflow, we set nullable | 750 | 10 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 751 | | | 752 | 10 | constexpr UInt32 to_max_digits = | 753 | 10 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 754 | 10 | bool multiply_may_overflow = false; | 755 | 10 | if (to_scale > from_scale) { | 756 | 6 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 757 | 6 | } | 758 | 10 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 759 | 10 | sizeof(typename ToFieldType::NativeType)), | 760 | 10 | FromFieldType, typename ToFieldType::NativeType>; | 761 | 10 | MaxNativeType scale_multiplier = | 762 | 10 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 763 | 10 | typename ToFieldType::NativeType max_result = | 764 | 10 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 765 | 10 | typename ToFieldType::NativeType min_result = -max_result; | 766 | | | 767 | 10 | ColumnUInt8::MutablePtr col_null_map_to; | 768 | 10 | NullMap::value_type* null_map_data = nullptr; | 769 | 10 | if (narrow_integral) { | 770 | 6 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 771 | 6 | null_map_data = col_null_map_to->get_data().data(); | 772 | 6 | } | 773 | | | 774 | 10 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 775 | 10 | const auto& vec_from = col_from->get_data(); | 776 | 10 | const auto* vec_from_data = vec_from.data(); | 777 | 10 | auto& vec_to = col_to->get_data(); | 778 | 10 | auto* vec_to_data = vec_to.data(); | 779 | | | 780 | 10 | CastParameters params; | 781 | 10 | params.is_strict = (CastMode == CastModeType::StrictMode); | 782 | 10 | size_t size = vec_from.size(); | 783 | | | 784 | 10 | RETURN_IF_ERROR(std::visit( | 785 | 10 | [&](auto multiply_may_overflow, auto narrow_integral) { | 786 | 10 | for (size_t i = 0; i < size; i++) { | 787 | 10 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 788 | 10 | typename ToDataType::FieldType, | 789 | 10 | multiply_may_overflow, narrow_integral>( | 790 | 10 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 791 | 10 | scale_multiplier, min_result, max_result, params)) { | 792 | 10 | if (set_nullable) { | 793 | 10 | null_map_data[i] = 1; | 794 | 10 | } else { | 795 | 10 | return params.status; | 796 | 10 | } | 797 | 10 | } | 798 | 10 | } | 799 | 10 | return Status::OK(); | 800 | 10 | }, | 801 | 10 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 802 | | | 803 | 10 | if (narrow_integral) { | 804 | 6 | block.get_by_position(result).column = | 805 | 6 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 806 | 6 | } else { | 807 | 4 | block.get_by_position(result).column = std::move(col_to); | 808 | 4 | } | 809 | 10 | return Status::OK(); | 810 | 10 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE5EEENS_15DataTypeDecimalILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 724 | 19 | const NullMap::value_type* null_map = nullptr) const override { | 725 | 19 | using FromFieldType = typename FromDataType::FieldType; | 726 | 19 | using ToFieldType = typename ToDataType::FieldType; | 727 | 19 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 728 | 19 | const auto* col_from = | 729 | 19 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 730 | 19 | if (!col_from) { | 731 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 732 | 0 | named_from.column->get_name()); | 733 | 0 | } | 734 | | | 735 | 19 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 736 | 19 | constexpr UInt32 from_scale = 0; | 737 | | | 738 | 19 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 739 | 19 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 740 | 19 | UInt32 to_precision = to_decimal_type.get_precision(); | 741 | 19 | ToDataType::check_type_precision(to_precision); | 742 | 19 | UInt32 to_scale = to_decimal_type.get_scale(); | 743 | 19 | ToDataType::check_type_scale(to_scale); | 744 | | | 745 | 19 | auto from_max_int_digit_count = from_precision - from_scale; | 746 | 19 | auto to_max_int_digit_count = to_precision - to_scale; | 747 | | // may overflow. nullable result column. | 748 | 19 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 749 | | // only in non-strict mode and may overflow, we set nullable | 750 | 19 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 751 | | | 752 | 19 | constexpr UInt32 to_max_digits = | 753 | 19 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 754 | 19 | bool multiply_may_overflow = false; | 755 | 19 | if (to_scale > from_scale) { | 756 | 12 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 757 | 12 | } | 758 | 19 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 759 | 19 | sizeof(typename ToFieldType::NativeType)), | 760 | 19 | FromFieldType, typename ToFieldType::NativeType>; | 761 | 19 | MaxNativeType scale_multiplier = | 762 | 19 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 763 | 19 | typename ToFieldType::NativeType max_result = | 764 | 19 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 765 | 19 | typename ToFieldType::NativeType min_result = -max_result; | 766 | | | 767 | 19 | ColumnUInt8::MutablePtr col_null_map_to; | 768 | 19 | NullMap::value_type* null_map_data = nullptr; | 769 | 19 | if (narrow_integral) { | 770 | 15 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 771 | 15 | null_map_data = col_null_map_to->get_data().data(); | 772 | 15 | } | 773 | | | 774 | 19 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 775 | 19 | const auto& vec_from = col_from->get_data(); | 776 | 19 | const auto* vec_from_data = vec_from.data(); | 777 | 19 | auto& vec_to = col_to->get_data(); | 778 | 19 | auto* vec_to_data = vec_to.data(); | 779 | | | 780 | 19 | CastParameters params; | 781 | 19 | params.is_strict = (CastMode == CastModeType::StrictMode); | 782 | 19 | size_t size = vec_from.size(); | 783 | | | 784 | 19 | RETURN_IF_ERROR(std::visit( | 785 | 19 | [&](auto multiply_may_overflow, auto narrow_integral) { | 786 | 19 | for (size_t i = 0; i < size; i++) { | 787 | 19 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 788 | 19 | typename ToDataType::FieldType, | 789 | 19 | multiply_may_overflow, narrow_integral>( | 790 | 19 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 791 | 19 | scale_multiplier, min_result, max_result, params)) { | 792 | 19 | if (set_nullable) { | 793 | 19 | null_map_data[i] = 1; | 794 | 19 | } else { | 795 | 19 | return params.status; | 796 | 19 | } | 797 | 19 | } | 798 | 19 | } | 799 | 19 | return Status::OK(); | 800 | 19 | }, | 801 | 19 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 802 | | | 803 | 7 | if (narrow_integral) { | 804 | 3 | block.get_by_position(result).column = | 805 | 3 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 806 | 4 | } else { | 807 | 4 | block.get_by_position(result).column = std::move(col_to); | 808 | 4 | } | 809 | 7 | return Status::OK(); | 810 | 19 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE5EEENS_15DataTypeDecimalILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 724 | 10 | const NullMap::value_type* null_map = nullptr) const override { | 725 | 10 | using FromFieldType = typename FromDataType::FieldType; | 726 | 10 | using ToFieldType = typename ToDataType::FieldType; | 727 | 10 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 728 | 10 | const auto* col_from = | 729 | 10 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 730 | 10 | if (!col_from) { | 731 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 732 | 0 | named_from.column->get_name()); | 733 | 0 | } | 734 | | | 735 | 10 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 736 | 10 | constexpr UInt32 from_scale = 0; | 737 | | | 738 | 10 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 739 | 10 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 740 | 10 | UInt32 to_precision = to_decimal_type.get_precision(); | 741 | 10 | ToDataType::check_type_precision(to_precision); | 742 | 10 | UInt32 to_scale = to_decimal_type.get_scale(); | 743 | 10 | ToDataType::check_type_scale(to_scale); | 744 | | | 745 | 10 | auto from_max_int_digit_count = from_precision - from_scale; | 746 | 10 | auto to_max_int_digit_count = to_precision - to_scale; | 747 | | // may overflow. nullable result column. | 748 | 10 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 749 | | // only in non-strict mode and may overflow, we set nullable | 750 | 10 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 751 | | | 752 | 10 | constexpr UInt32 to_max_digits = | 753 | 10 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 754 | 10 | bool multiply_may_overflow = false; | 755 | 10 | if (to_scale > from_scale) { | 756 | 6 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 757 | 6 | } | 758 | 10 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 759 | 10 | sizeof(typename ToFieldType::NativeType)), | 760 | 10 | FromFieldType, typename ToFieldType::NativeType>; | 761 | 10 | MaxNativeType scale_multiplier = | 762 | 10 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 763 | 10 | typename ToFieldType::NativeType max_result = | 764 | 10 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 765 | 10 | typename ToFieldType::NativeType min_result = -max_result; | 766 | | | 767 | 10 | ColumnUInt8::MutablePtr col_null_map_to; | 768 | 10 | NullMap::value_type* null_map_data = nullptr; | 769 | 10 | if (narrow_integral) { | 770 | 6 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 771 | 6 | null_map_data = col_null_map_to->get_data().data(); | 772 | 6 | } | 773 | | | 774 | 10 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 775 | 10 | const auto& vec_from = col_from->get_data(); | 776 | 10 | const auto* vec_from_data = vec_from.data(); | 777 | 10 | auto& vec_to = col_to->get_data(); | 778 | 10 | auto* vec_to_data = vec_to.data(); | 779 | | | 780 | 10 | CastParameters params; | 781 | 10 | params.is_strict = (CastMode == CastModeType::StrictMode); | 782 | 10 | size_t size = vec_from.size(); | 783 | | | 784 | 10 | RETURN_IF_ERROR(std::visit( | 785 | 10 | [&](auto multiply_may_overflow, auto narrow_integral) { | 786 | 10 | for (size_t i = 0; i < size; i++) { | 787 | 10 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 788 | 10 | typename ToDataType::FieldType, | 789 | 10 | multiply_may_overflow, narrow_integral>( | 790 | 10 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 791 | 10 | scale_multiplier, min_result, max_result, params)) { | 792 | 10 | if (set_nullable) { | 793 | 10 | null_map_data[i] = 1; | 794 | 10 | } else { | 795 | 10 | return params.status; | 796 | 10 | } | 797 | 10 | } | 798 | 10 | } | 799 | 10 | return Status::OK(); | 800 | 10 | }, | 801 | 10 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 802 | | | 803 | 10 | if (narrow_integral) { | 804 | 6 | block.get_by_position(result).column = | 805 | 6 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 806 | 6 | } else { | 807 | 4 | block.get_by_position(result).column = std::move(col_to); | 808 | 4 | } | 809 | 10 | return Status::OK(); | 810 | 10 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE6EEENS_15DataTypeDecimalILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 724 | 19 | const NullMap::value_type* null_map = nullptr) const override { | 725 | 19 | using FromFieldType = typename FromDataType::FieldType; | 726 | 19 | using ToFieldType = typename ToDataType::FieldType; | 727 | 19 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 728 | 19 | const auto* col_from = | 729 | 19 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 730 | 19 | if (!col_from) { | 731 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 732 | 0 | named_from.column->get_name()); | 733 | 0 | } | 734 | | | 735 | 19 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 736 | 19 | constexpr UInt32 from_scale = 0; | 737 | | | 738 | 19 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 739 | 19 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 740 | 19 | UInt32 to_precision = to_decimal_type.get_precision(); | 741 | 19 | ToDataType::check_type_precision(to_precision); | 742 | 19 | UInt32 to_scale = to_decimal_type.get_scale(); | 743 | 19 | ToDataType::check_type_scale(to_scale); | 744 | | | 745 | 19 | auto from_max_int_digit_count = from_precision - from_scale; | 746 | 19 | auto to_max_int_digit_count = to_precision - to_scale; | 747 | | // may overflow. nullable result column. | 748 | 19 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 749 | | // only in non-strict mode and may overflow, we set nullable | 750 | 19 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 751 | | | 752 | 19 | constexpr UInt32 to_max_digits = | 753 | 19 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 754 | 19 | bool multiply_may_overflow = false; | 755 | 19 | if (to_scale > from_scale) { | 756 | 12 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 757 | 12 | } | 758 | 19 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 759 | 19 | sizeof(typename ToFieldType::NativeType)), | 760 | 19 | FromFieldType, typename ToFieldType::NativeType>; | 761 | 19 | MaxNativeType scale_multiplier = | 762 | 19 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 763 | 19 | typename ToFieldType::NativeType max_result = | 764 | 19 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 765 | 19 | typename ToFieldType::NativeType min_result = -max_result; | 766 | | | 767 | 19 | ColumnUInt8::MutablePtr col_null_map_to; | 768 | 19 | NullMap::value_type* null_map_data = nullptr; | 769 | 19 | if (narrow_integral) { | 770 | 15 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 771 | 15 | null_map_data = col_null_map_to->get_data().data(); | 772 | 15 | } | 773 | | | 774 | 19 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 775 | 19 | const auto& vec_from = col_from->get_data(); | 776 | 19 | const auto* vec_from_data = vec_from.data(); | 777 | 19 | auto& vec_to = col_to->get_data(); | 778 | 19 | auto* vec_to_data = vec_to.data(); | 779 | | | 780 | 19 | CastParameters params; | 781 | 19 | params.is_strict = (CastMode == CastModeType::StrictMode); | 782 | 19 | size_t size = vec_from.size(); | 783 | | | 784 | 19 | RETURN_IF_ERROR(std::visit( | 785 | 19 | [&](auto multiply_may_overflow, auto narrow_integral) { | 786 | 19 | for (size_t i = 0; i < size; i++) { | 787 | 19 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 788 | 19 | typename ToDataType::FieldType, | 789 | 19 | multiply_may_overflow, narrow_integral>( | 790 | 19 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 791 | 19 | scale_multiplier, min_result, max_result, params)) { | 792 | 19 | if (set_nullable) { | 793 | 19 | null_map_data[i] = 1; | 794 | 19 | } else { | 795 | 19 | return params.status; | 796 | 19 | } | 797 | 19 | } | 798 | 19 | } | 799 | 19 | return Status::OK(); | 800 | 19 | }, | 801 | 19 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 802 | | | 803 | 7 | if (narrow_integral) { | 804 | 3 | block.get_by_position(result).column = | 805 | 3 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 806 | 4 | } else { | 807 | 4 | block.get_by_position(result).column = std::move(col_to); | 808 | 4 | } | 809 | 7 | return Status::OK(); | 810 | 19 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE6EEENS_15DataTypeDecimalILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 724 | 10 | const NullMap::value_type* null_map = nullptr) const override { | 725 | 10 | using FromFieldType = typename FromDataType::FieldType; | 726 | 10 | using ToFieldType = typename ToDataType::FieldType; | 727 | 10 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 728 | 10 | const auto* col_from = | 729 | 10 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 730 | 10 | if (!col_from) { | 731 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 732 | 0 | named_from.column->get_name()); | 733 | 0 | } | 734 | | | 735 | 10 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 736 | 10 | constexpr UInt32 from_scale = 0; | 737 | | | 738 | 10 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 739 | 10 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 740 | 10 | UInt32 to_precision = to_decimal_type.get_precision(); | 741 | 10 | ToDataType::check_type_precision(to_precision); | 742 | 10 | UInt32 to_scale = to_decimal_type.get_scale(); | 743 | 10 | ToDataType::check_type_scale(to_scale); | 744 | | | 745 | 10 | auto from_max_int_digit_count = from_precision - from_scale; | 746 | 10 | auto to_max_int_digit_count = to_precision - to_scale; | 747 | | // may overflow. nullable result column. | 748 | 10 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 749 | | // only in non-strict mode and may overflow, we set nullable | 750 | 10 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 751 | | | 752 | 10 | constexpr UInt32 to_max_digits = | 753 | 10 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 754 | 10 | bool multiply_may_overflow = false; | 755 | 10 | if (to_scale > from_scale) { | 756 | 6 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 757 | 6 | } | 758 | 10 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 759 | 10 | sizeof(typename ToFieldType::NativeType)), | 760 | 10 | FromFieldType, typename ToFieldType::NativeType>; | 761 | 10 | MaxNativeType scale_multiplier = | 762 | 10 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 763 | 10 | typename ToFieldType::NativeType max_result = | 764 | 10 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 765 | 10 | typename ToFieldType::NativeType min_result = -max_result; | 766 | | | 767 | 10 | ColumnUInt8::MutablePtr col_null_map_to; | 768 | 10 | NullMap::value_type* null_map_data = nullptr; | 769 | 10 | if (narrow_integral) { | 770 | 6 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 771 | 6 | null_map_data = col_null_map_to->get_data().data(); | 772 | 6 | } | 773 | | | 774 | 10 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 775 | 10 | const auto& vec_from = col_from->get_data(); | 776 | 10 | const auto* vec_from_data = vec_from.data(); | 777 | 10 | auto& vec_to = col_to->get_data(); | 778 | 10 | auto* vec_to_data = vec_to.data(); | 779 | | | 780 | 10 | CastParameters params; | 781 | 10 | params.is_strict = (CastMode == CastModeType::StrictMode); | 782 | 10 | size_t size = vec_from.size(); | 783 | | | 784 | 10 | RETURN_IF_ERROR(std::visit( | 785 | 10 | [&](auto multiply_may_overflow, auto narrow_integral) { | 786 | 10 | for (size_t i = 0; i < size; i++) { | 787 | 10 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 788 | 10 | typename ToDataType::FieldType, | 789 | 10 | multiply_may_overflow, narrow_integral>( | 790 | 10 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 791 | 10 | scale_multiplier, min_result, max_result, params)) { | 792 | 10 | if (set_nullable) { | 793 | 10 | null_map_data[i] = 1; | 794 | 10 | } else { | 795 | 10 | return params.status; | 796 | 10 | } | 797 | 10 | } | 798 | 10 | } | 799 | 10 | return Status::OK(); | 800 | 10 | }, | 801 | 10 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 802 | | | 803 | 10 | if (narrow_integral) { | 804 | 6 | block.get_by_position(result).column = | 805 | 6 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 806 | 6 | } else { | 807 | 4 | block.get_by_position(result).column = std::move(col_to); | 808 | 4 | } | 809 | 10 | return Status::OK(); | 810 | 10 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE7EEENS_15DataTypeDecimalILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 724 | 31 | const NullMap::value_type* null_map = nullptr) const override { | 725 | 31 | using FromFieldType = typename FromDataType::FieldType; | 726 | 31 | using ToFieldType = typename ToDataType::FieldType; | 727 | 31 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 728 | 31 | const auto* col_from = | 729 | 31 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 730 | 31 | if (!col_from) { | 731 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 732 | 0 | named_from.column->get_name()); | 733 | 0 | } | 734 | | | 735 | 31 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 736 | 31 | constexpr UInt32 from_scale = 0; | 737 | | | 738 | 31 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 739 | 31 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 740 | 31 | UInt32 to_precision = to_decimal_type.get_precision(); | 741 | 31 | ToDataType::check_type_precision(to_precision); | 742 | 31 | UInt32 to_scale = to_decimal_type.get_scale(); | 743 | 31 | ToDataType::check_type_scale(to_scale); | 744 | | | 745 | 31 | auto from_max_int_digit_count = from_precision - from_scale; | 746 | 31 | auto to_max_int_digit_count = to_precision - to_scale; | 747 | | // may overflow. nullable result column. | 748 | 31 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 749 | | // only in non-strict mode and may overflow, we set nullable | 750 | 31 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 751 | | | 752 | 31 | constexpr UInt32 to_max_digits = | 753 | 31 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 754 | 31 | bool multiply_may_overflow = false; | 755 | 31 | if (to_scale > from_scale) { | 756 | 20 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 757 | 20 | } | 758 | 31 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 759 | 31 | sizeof(typename ToFieldType::NativeType)), | 760 | 31 | FromFieldType, typename ToFieldType::NativeType>; | 761 | 31 | MaxNativeType scale_multiplier = | 762 | 31 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 763 | 31 | typename ToFieldType::NativeType max_result = | 764 | 31 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 765 | 31 | typename ToFieldType::NativeType min_result = -max_result; | 766 | | | 767 | 31 | ColumnUInt8::MutablePtr col_null_map_to; | 768 | 31 | NullMap::value_type* null_map_data = nullptr; | 769 | 31 | if (narrow_integral) { | 770 | 30 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 771 | 30 | null_map_data = col_null_map_to->get_data().data(); | 772 | 30 | } | 773 | | | 774 | 31 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 775 | 31 | const auto& vec_from = col_from->get_data(); | 776 | 31 | const auto* vec_from_data = vec_from.data(); | 777 | 31 | auto& vec_to = col_to->get_data(); | 778 | 31 | auto* vec_to_data = vec_to.data(); | 779 | | | 780 | 31 | CastParameters params; | 781 | 31 | params.is_strict = (CastMode == CastModeType::StrictMode); | 782 | 31 | size_t size = vec_from.size(); | 783 | | | 784 | 31 | RETURN_IF_ERROR(std::visit( | 785 | 31 | [&](auto multiply_may_overflow, auto narrow_integral) { | 786 | 31 | for (size_t i = 0; i < size; i++) { | 787 | 31 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 788 | 31 | typename ToDataType::FieldType, | 789 | 31 | multiply_may_overflow, narrow_integral>( | 790 | 31 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 791 | 31 | scale_multiplier, min_result, max_result, params)) { | 792 | 31 | if (set_nullable) { | 793 | 31 | null_map_data[i] = 1; | 794 | 31 | } else { | 795 | 31 | return params.status; | 796 | 31 | } | 797 | 31 | } | 798 | 31 | } | 799 | 31 | return Status::OK(); | 800 | 31 | }, | 801 | 31 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 802 | | | 803 | 7 | if (narrow_integral) { | 804 | 6 | block.get_by_position(result).column = | 805 | 6 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 806 | 6 | } else { | 807 | 1 | block.get_by_position(result).column = std::move(col_to); | 808 | 1 | } | 809 | 7 | return Status::OK(); | 810 | 31 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE7EEENS_15DataTypeDecimalILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 724 | 13 | const NullMap::value_type* null_map = nullptr) const override { | 725 | 13 | using FromFieldType = typename FromDataType::FieldType; | 726 | 13 | using ToFieldType = typename ToDataType::FieldType; | 727 | 13 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 728 | 13 | const auto* col_from = | 729 | 13 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 730 | 13 | if (!col_from) { | 731 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 732 | 0 | named_from.column->get_name()); | 733 | 0 | } | 734 | | | 735 | 13 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 736 | 13 | constexpr UInt32 from_scale = 0; | 737 | | | 738 | 13 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 739 | 13 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 740 | 13 | UInt32 to_precision = to_decimal_type.get_precision(); | 741 | 13 | ToDataType::check_type_precision(to_precision); | 742 | 13 | UInt32 to_scale = to_decimal_type.get_scale(); | 743 | 13 | ToDataType::check_type_scale(to_scale); | 744 | | | 745 | 13 | auto from_max_int_digit_count = from_precision - from_scale; | 746 | 13 | auto to_max_int_digit_count = to_precision - to_scale; | 747 | | // may overflow. nullable result column. | 748 | 13 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 749 | | // only in non-strict mode and may overflow, we set nullable | 750 | 13 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 751 | | | 752 | 13 | constexpr UInt32 to_max_digits = | 753 | 13 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 754 | 13 | bool multiply_may_overflow = false; | 755 | 13 | if (to_scale > from_scale) { | 756 | 8 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 757 | 8 | } | 758 | 13 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 759 | 13 | sizeof(typename ToFieldType::NativeType)), | 760 | 13 | FromFieldType, typename ToFieldType::NativeType>; | 761 | 13 | MaxNativeType scale_multiplier = | 762 | 13 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 763 | 13 | typename ToFieldType::NativeType max_result = | 764 | 13 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 765 | 13 | typename ToFieldType::NativeType min_result = -max_result; | 766 | | | 767 | 13 | ColumnUInt8::MutablePtr col_null_map_to; | 768 | 13 | NullMap::value_type* null_map_data = nullptr; | 769 | 13 | if (narrow_integral) { | 770 | 12 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 771 | 12 | null_map_data = col_null_map_to->get_data().data(); | 772 | 12 | } | 773 | | | 774 | 13 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 775 | 13 | const auto& vec_from = col_from->get_data(); | 776 | 13 | const auto* vec_from_data = vec_from.data(); | 777 | 13 | auto& vec_to = col_to->get_data(); | 778 | 13 | auto* vec_to_data = vec_to.data(); | 779 | | | 780 | 13 | CastParameters params; | 781 | 13 | params.is_strict = (CastMode == CastModeType::StrictMode); | 782 | 13 | size_t size = vec_from.size(); | 783 | | | 784 | 13 | RETURN_IF_ERROR(std::visit( | 785 | 13 | [&](auto multiply_may_overflow, auto narrow_integral) { | 786 | 13 | for (size_t i = 0; i < size; i++) { | 787 | 13 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 788 | 13 | typename ToDataType::FieldType, | 789 | 13 | multiply_may_overflow, narrow_integral>( | 790 | 13 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 791 | 13 | scale_multiplier, min_result, max_result, params)) { | 792 | 13 | if (set_nullable) { | 793 | 13 | null_map_data[i] = 1; | 794 | 13 | } else { | 795 | 13 | return params.status; | 796 | 13 | } | 797 | 13 | } | 798 | 13 | } | 799 | 13 | return Status::OK(); | 800 | 13 | }, | 801 | 13 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 802 | | | 803 | 13 | if (narrow_integral) { | 804 | 12 | block.get_by_position(result).column = | 805 | 12 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 806 | 12 | } else { | 807 | 1 | block.get_by_position(result).column = std::move(col_to); | 808 | 1 | } | 809 | 13 | return Status::OK(); | 810 | 13 | } |
|
811 | | }; |
812 | | |
813 | | // cast float and double to decimal. ALWAYS nullable result column. |
814 | | template <CastModeType CastMode, typename FromDataType, typename ToDataType> |
815 | | requires(IsDataTypeDecimal<ToDataType> && IsDataTypeFloat<FromDataType>) |
816 | | class CastToImpl<CastMode, FromDataType, ToDataType> : public CastToBase { |
817 | | public: |
818 | | Status execute_impl(FunctionContext* context, Block& block, const ColumnNumbers& arguments, |
819 | | uint32_t result, size_t input_rows_count, |
820 | 784 | const NullMap::value_type* null_map = nullptr) const override { |
821 | 784 | using FromFieldType = typename FromDataType::FieldType; |
822 | 784 | using ToFieldType = typename ToDataType::FieldType; |
823 | 784 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); |
824 | 784 | const auto* col_from = |
825 | 784 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); |
826 | 784 | if (!col_from) { |
827 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", |
828 | 0 | named_from.column->get_name()); |
829 | 0 | } |
830 | | |
831 | 784 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); |
832 | 784 | UInt32 from_scale = 0; |
833 | | |
834 | 784 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); |
835 | 784 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); |
836 | 784 | UInt32 to_precision = to_decimal_type.get_precision(); |
837 | 784 | ToDataType::check_type_precision(to_precision); |
838 | 784 | UInt32 to_scale = to_decimal_type.get_scale(); |
839 | 784 | ToDataType::check_type_scale(to_scale); |
840 | | |
841 | 784 | auto from_max_int_digit_count = from_precision - from_scale; |
842 | 784 | auto to_max_int_digit_count = to_precision - to_scale; |
843 | 784 | bool narrow_integral = |
844 | 784 | (to_max_int_digit_count < from_max_int_digit_count) || |
845 | 784 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); |
846 | | // only in non-strict mode and may overflow, we set nullable |
847 | 784 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; |
848 | | |
849 | 784 | ColumnUInt8::MutablePtr col_null_map_to = ColumnUInt8::create(input_rows_count, 0); |
850 | 784 | NullMap::value_type* null_map_data = col_null_map_to->get_data().data(); |
851 | | |
852 | 784 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); |
853 | 784 | const auto& vec_from = col_from->get_data(); |
854 | 784 | const auto* vec_from_data = vec_from.data(); |
855 | 784 | auto& vec_to = col_to->get_data(); |
856 | 784 | auto* vec_to_data = vec_to.data(); |
857 | | |
858 | 784 | CastParameters params; |
859 | 784 | params.is_strict = (CastMode == CastModeType::StrictMode); |
860 | 784 | size_t size = vec_from.size(); |
861 | | |
862 | 784 | typename ToFieldType::NativeType scale_multiplier = |
863 | 784 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); |
864 | 784 | typename ToFieldType::NativeType max_result = |
865 | 784 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); |
866 | 784 | typename ToFieldType::NativeType min_result = -max_result; |
867 | 3.99k | for (size_t i = 0; i < size; i++) { |
868 | 3.35k | if (!CastToDecimal::_from_float<typename FromDataType::FieldType, |
869 | 3.35k | typename ToDataType::FieldType>( |
870 | 3.35k | vec_from_data[i], vec_to_data[i], to_precision, to_scale, scale_multiplier, |
871 | 3.35k | min_result, max_result, params)) { |
872 | 288 | if (set_nullable) { |
873 | 144 | null_map_data[i] = 1; |
874 | 144 | } else { |
875 | 144 | return params.status; |
876 | 144 | } |
877 | 288 | } |
878 | 3.35k | } |
879 | | |
880 | 640 | block.get_by_position(result).column = |
881 | 640 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); |
882 | 640 | return Status::OK(); |
883 | 784 | } 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 | 820 | 18 | const NullMap::value_type* null_map = nullptr) const override { | 821 | 18 | using FromFieldType = typename FromDataType::FieldType; | 822 | 18 | using ToFieldType = typename ToDataType::FieldType; | 823 | 18 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 824 | 18 | const auto* col_from = | 825 | 18 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 826 | 18 | if (!col_from) { | 827 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 828 | 0 | named_from.column->get_name()); | 829 | 0 | } | 830 | | | 831 | 18 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 832 | 18 | UInt32 from_scale = 0; | 833 | | | 834 | 18 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 835 | 18 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 836 | 18 | UInt32 to_precision = to_decimal_type.get_precision(); | 837 | 18 | ToDataType::check_type_precision(to_precision); | 838 | 18 | UInt32 to_scale = to_decimal_type.get_scale(); | 839 | 18 | ToDataType::check_type_scale(to_scale); | 840 | | | 841 | 18 | auto from_max_int_digit_count = from_precision - from_scale; | 842 | 18 | auto to_max_int_digit_count = to_precision - to_scale; | 843 | 18 | bool narrow_integral = | 844 | 18 | (to_max_int_digit_count < from_max_int_digit_count) || | 845 | 18 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 846 | | // only in non-strict mode and may overflow, we set nullable | 847 | 18 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 848 | | | 849 | 18 | ColumnUInt8::MutablePtr col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 850 | 18 | NullMap::value_type* null_map_data = col_null_map_to->get_data().data(); | 851 | | | 852 | 18 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 853 | 18 | const auto& vec_from = col_from->get_data(); | 854 | 18 | const auto* vec_from_data = vec_from.data(); | 855 | 18 | auto& vec_to = col_to->get_data(); | 856 | 18 | auto* vec_to_data = vec_to.data(); | 857 | | | 858 | 18 | CastParameters params; | 859 | 18 | params.is_strict = (CastMode == CastModeType::StrictMode); | 860 | 18 | size_t size = vec_from.size(); | 861 | | | 862 | 18 | typename ToFieldType::NativeType scale_multiplier = | 863 | 18 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 864 | 18 | typename ToFieldType::NativeType max_result = | 865 | 18 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 866 | 18 | typename ToFieldType::NativeType min_result = -max_result; | 867 | 18 | for (size_t i = 0; i < size; i++) { | 868 | 18 | if (!CastToDecimal::_from_float<typename FromDataType::FieldType, | 869 | 18 | typename ToDataType::FieldType>( | 870 | 18 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, scale_multiplier, | 871 | 18 | min_result, max_result, params)) { | 872 | 18 | if (set_nullable) { | 873 | 0 | null_map_data[i] = 1; | 874 | 18 | } else { | 875 | 18 | return params.status; | 876 | 18 | } | 877 | 18 | } | 878 | 18 | } | 879 | | | 880 | 0 | block.get_by_position(result).column = | 881 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 882 | 0 | return Status::OK(); | 883 | 18 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE8EEENS_15DataTypeDecimalILS3_28EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 820 | 81 | const NullMap::value_type* null_map = nullptr) const override { | 821 | 81 | using FromFieldType = typename FromDataType::FieldType; | 822 | 81 | using ToFieldType = typename ToDataType::FieldType; | 823 | 81 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 824 | 81 | const auto* col_from = | 825 | 81 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 826 | 81 | if (!col_from) { | 827 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 828 | 0 | named_from.column->get_name()); | 829 | 0 | } | 830 | | | 831 | 81 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 832 | 81 | UInt32 from_scale = 0; | 833 | | | 834 | 81 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 835 | 81 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 836 | 81 | UInt32 to_precision = to_decimal_type.get_precision(); | 837 | 81 | ToDataType::check_type_precision(to_precision); | 838 | 81 | UInt32 to_scale = to_decimal_type.get_scale(); | 839 | 81 | ToDataType::check_type_scale(to_scale); | 840 | | | 841 | 81 | auto from_max_int_digit_count = from_precision - from_scale; | 842 | 81 | auto to_max_int_digit_count = to_precision - to_scale; | 843 | 81 | bool narrow_integral = | 844 | 81 | (to_max_int_digit_count < from_max_int_digit_count) || | 845 | 81 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 846 | | // only in non-strict mode and may overflow, we set nullable | 847 | 81 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 848 | | | 849 | 81 | ColumnUInt8::MutablePtr col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 850 | 81 | NullMap::value_type* null_map_data = col_null_map_to->get_data().data(); | 851 | | | 852 | 81 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 853 | 81 | const auto& vec_from = col_from->get_data(); | 854 | 81 | const auto* vec_from_data = vec_from.data(); | 855 | 81 | auto& vec_to = col_to->get_data(); | 856 | 81 | auto* vec_to_data = vec_to.data(); | 857 | | | 858 | 81 | CastParameters params; | 859 | 81 | params.is_strict = (CastMode == CastModeType::StrictMode); | 860 | 81 | size_t size = vec_from.size(); | 861 | | | 862 | 81 | typename ToFieldType::NativeType scale_multiplier = | 863 | 81 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 864 | 81 | typename ToFieldType::NativeType max_result = | 865 | 81 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 866 | 81 | typename ToFieldType::NativeType min_result = -max_result; | 867 | 491 | for (size_t i = 0; i < size; i++) { | 868 | 410 | if (!CastToDecimal::_from_float<typename FromDataType::FieldType, | 869 | 410 | typename ToDataType::FieldType>( | 870 | 410 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, scale_multiplier, | 871 | 410 | min_result, max_result, params)) { | 872 | 18 | if (set_nullable) { | 873 | 18 | null_map_data[i] = 1; | 874 | 18 | } else { | 875 | 0 | return params.status; | 876 | 0 | } | 877 | 18 | } | 878 | 410 | } | 879 | | | 880 | 81 | block.get_by_position(result).column = | 881 | 81 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 882 | 81 | return Status::OK(); | 883 | 81 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE9EEENS_15DataTypeDecimalILS3_28EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 820 | 18 | const NullMap::value_type* null_map = nullptr) const override { | 821 | 18 | using FromFieldType = typename FromDataType::FieldType; | 822 | 18 | using ToFieldType = typename ToDataType::FieldType; | 823 | 18 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 824 | 18 | const auto* col_from = | 825 | 18 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 826 | 18 | if (!col_from) { | 827 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 828 | 0 | named_from.column->get_name()); | 829 | 0 | } | 830 | | | 831 | 18 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 832 | 18 | UInt32 from_scale = 0; | 833 | | | 834 | 18 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 835 | 18 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 836 | 18 | UInt32 to_precision = to_decimal_type.get_precision(); | 837 | 18 | ToDataType::check_type_precision(to_precision); | 838 | 18 | UInt32 to_scale = to_decimal_type.get_scale(); | 839 | 18 | ToDataType::check_type_scale(to_scale); | 840 | | | 841 | 18 | auto from_max_int_digit_count = from_precision - from_scale; | 842 | 18 | auto to_max_int_digit_count = to_precision - to_scale; | 843 | 18 | bool narrow_integral = | 844 | 18 | (to_max_int_digit_count < from_max_int_digit_count) || | 845 | 18 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 846 | | // only in non-strict mode and may overflow, we set nullable | 847 | 18 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 848 | | | 849 | 18 | ColumnUInt8::MutablePtr col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 850 | 18 | NullMap::value_type* null_map_data = col_null_map_to->get_data().data(); | 851 | | | 852 | 18 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 853 | 18 | const auto& vec_from = col_from->get_data(); | 854 | 18 | const auto* vec_from_data = vec_from.data(); | 855 | 18 | auto& vec_to = col_to->get_data(); | 856 | 18 | auto* vec_to_data = vec_to.data(); | 857 | | | 858 | 18 | CastParameters params; | 859 | 18 | params.is_strict = (CastMode == CastModeType::StrictMode); | 860 | 18 | size_t size = vec_from.size(); | 861 | | | 862 | 18 | typename ToFieldType::NativeType scale_multiplier = | 863 | 18 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 864 | 18 | typename ToFieldType::NativeType max_result = | 865 | 18 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 866 | 18 | typename ToFieldType::NativeType min_result = -max_result; | 867 | 18 | for (size_t i = 0; i < size; i++) { | 868 | 18 | if (!CastToDecimal::_from_float<typename FromDataType::FieldType, | 869 | 18 | typename ToDataType::FieldType>( | 870 | 18 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, scale_multiplier, | 871 | 18 | min_result, max_result, params)) { | 872 | 18 | if (set_nullable) { | 873 | 0 | null_map_data[i] = 1; | 874 | 18 | } else { | 875 | 18 | return params.status; | 876 | 18 | } | 877 | 18 | } | 878 | 18 | } | 879 | | | 880 | 0 | block.get_by_position(result).column = | 881 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 882 | 0 | return Status::OK(); | 883 | 18 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE9EEENS_15DataTypeDecimalILS3_28EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 820 | 85 | const NullMap::value_type* null_map = nullptr) const override { | 821 | 85 | using FromFieldType = typename FromDataType::FieldType; | 822 | 85 | using ToFieldType = typename ToDataType::FieldType; | 823 | 85 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 824 | 85 | const auto* col_from = | 825 | 85 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 826 | 85 | if (!col_from) { | 827 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 828 | 0 | named_from.column->get_name()); | 829 | 0 | } | 830 | | | 831 | 85 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 832 | 85 | UInt32 from_scale = 0; | 833 | | | 834 | 85 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 835 | 85 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 836 | 85 | UInt32 to_precision = to_decimal_type.get_precision(); | 837 | 85 | ToDataType::check_type_precision(to_precision); | 838 | 85 | UInt32 to_scale = to_decimal_type.get_scale(); | 839 | 85 | ToDataType::check_type_scale(to_scale); | 840 | | | 841 | 85 | auto from_max_int_digit_count = from_precision - from_scale; | 842 | 85 | auto to_max_int_digit_count = to_precision - to_scale; | 843 | 85 | bool narrow_integral = | 844 | 85 | (to_max_int_digit_count < from_max_int_digit_count) || | 845 | 85 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 846 | | // only in non-strict mode and may overflow, we set nullable | 847 | 85 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 848 | | | 849 | 85 | ColumnUInt8::MutablePtr col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 850 | 85 | NullMap::value_type* null_map_data = col_null_map_to->get_data().data(); | 851 | | | 852 | 85 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 853 | 85 | const auto& vec_from = col_from->get_data(); | 854 | 85 | const auto* vec_from_data = vec_from.data(); | 855 | 85 | auto& vec_to = col_to->get_data(); | 856 | 85 | auto* vec_to_data = vec_to.data(); | 857 | | | 858 | 85 | CastParameters params; | 859 | 85 | params.is_strict = (CastMode == CastModeType::StrictMode); | 860 | 85 | size_t size = vec_from.size(); | 861 | | | 862 | 85 | typename ToFieldType::NativeType scale_multiplier = | 863 | 85 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 864 | 85 | typename ToFieldType::NativeType max_result = | 865 | 85 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 866 | 85 | typename ToFieldType::NativeType min_result = -max_result; | 867 | 507 | for (size_t i = 0; i < size; i++) { | 868 | 422 | if (!CastToDecimal::_from_float<typename FromDataType::FieldType, | 869 | 422 | typename ToDataType::FieldType>( | 870 | 422 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, scale_multiplier, | 871 | 422 | min_result, max_result, params)) { | 872 | 18 | if (set_nullable) { | 873 | 18 | null_map_data[i] = 1; | 874 | 18 | } else { | 875 | 0 | return params.status; | 876 | 0 | } | 877 | 18 | } | 878 | 422 | } | 879 | | | 880 | 85 | block.get_by_position(result).column = | 881 | 85 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 882 | 85 | return Status::OK(); | 883 | 85 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE8EEENS_15DataTypeDecimalILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 820 | 18 | const NullMap::value_type* null_map = nullptr) const override { | 821 | 18 | using FromFieldType = typename FromDataType::FieldType; | 822 | 18 | using ToFieldType = typename ToDataType::FieldType; | 823 | 18 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 824 | 18 | const auto* col_from = | 825 | 18 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 826 | 18 | if (!col_from) { | 827 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 828 | 0 | named_from.column->get_name()); | 829 | 0 | } | 830 | | | 831 | 18 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 832 | 18 | UInt32 from_scale = 0; | 833 | | | 834 | 18 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 835 | 18 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 836 | 18 | UInt32 to_precision = to_decimal_type.get_precision(); | 837 | 18 | ToDataType::check_type_precision(to_precision); | 838 | 18 | UInt32 to_scale = to_decimal_type.get_scale(); | 839 | 18 | ToDataType::check_type_scale(to_scale); | 840 | | | 841 | 18 | auto from_max_int_digit_count = from_precision - from_scale; | 842 | 18 | auto to_max_int_digit_count = to_precision - to_scale; | 843 | 18 | bool narrow_integral = | 844 | 18 | (to_max_int_digit_count < from_max_int_digit_count) || | 845 | 18 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 846 | | // only in non-strict mode and may overflow, we set nullable | 847 | 18 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 848 | | | 849 | 18 | ColumnUInt8::MutablePtr col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 850 | 18 | NullMap::value_type* null_map_data = col_null_map_to->get_data().data(); | 851 | | | 852 | 18 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 853 | 18 | const auto& vec_from = col_from->get_data(); | 854 | 18 | const auto* vec_from_data = vec_from.data(); | 855 | 18 | auto& vec_to = col_to->get_data(); | 856 | 18 | auto* vec_to_data = vec_to.data(); | 857 | | | 858 | 18 | CastParameters params; | 859 | 18 | params.is_strict = (CastMode == CastModeType::StrictMode); | 860 | 18 | size_t size = vec_from.size(); | 861 | | | 862 | 18 | typename ToFieldType::NativeType scale_multiplier = | 863 | 18 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 864 | 18 | typename ToFieldType::NativeType max_result = | 865 | 18 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 866 | 18 | typename ToFieldType::NativeType min_result = -max_result; | 867 | 18 | for (size_t i = 0; i < size; i++) { | 868 | 18 | if (!CastToDecimal::_from_float<typename FromDataType::FieldType, | 869 | 18 | typename ToDataType::FieldType>( | 870 | 18 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, scale_multiplier, | 871 | 18 | min_result, max_result, params)) { | 872 | 18 | if (set_nullable) { | 873 | 0 | null_map_data[i] = 1; | 874 | 18 | } else { | 875 | 18 | return params.status; | 876 | 18 | } | 877 | 18 | } | 878 | 18 | } | 879 | | | 880 | 0 | block.get_by_position(result).column = | 881 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 882 | 0 | return Status::OK(); | 883 | 18 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE8EEENS_15DataTypeDecimalILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 820 | 81 | const NullMap::value_type* null_map = nullptr) const override { | 821 | 81 | using FromFieldType = typename FromDataType::FieldType; | 822 | 81 | using ToFieldType = typename ToDataType::FieldType; | 823 | 81 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 824 | 81 | const auto* col_from = | 825 | 81 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 826 | 81 | if (!col_from) { | 827 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 828 | 0 | named_from.column->get_name()); | 829 | 0 | } | 830 | | | 831 | 81 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 832 | 81 | UInt32 from_scale = 0; | 833 | | | 834 | 81 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 835 | 81 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 836 | 81 | UInt32 to_precision = to_decimal_type.get_precision(); | 837 | 81 | ToDataType::check_type_precision(to_precision); | 838 | 81 | UInt32 to_scale = to_decimal_type.get_scale(); | 839 | 81 | ToDataType::check_type_scale(to_scale); | 840 | | | 841 | 81 | auto from_max_int_digit_count = from_precision - from_scale; | 842 | 81 | auto to_max_int_digit_count = to_precision - to_scale; | 843 | 81 | bool narrow_integral = | 844 | 81 | (to_max_int_digit_count < from_max_int_digit_count) || | 845 | 81 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 846 | | // only in non-strict mode and may overflow, we set nullable | 847 | 81 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 848 | | | 849 | 81 | ColumnUInt8::MutablePtr col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 850 | 81 | NullMap::value_type* null_map_data = col_null_map_to->get_data().data(); | 851 | | | 852 | 81 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 853 | 81 | const auto& vec_from = col_from->get_data(); | 854 | 81 | const auto* vec_from_data = vec_from.data(); | 855 | 81 | auto& vec_to = col_to->get_data(); | 856 | 81 | auto* vec_to_data = vec_to.data(); | 857 | | | 858 | 81 | CastParameters params; | 859 | 81 | params.is_strict = (CastMode == CastModeType::StrictMode); | 860 | 81 | size_t size = vec_from.size(); | 861 | | | 862 | 81 | typename ToFieldType::NativeType scale_multiplier = | 863 | 81 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 864 | 81 | typename ToFieldType::NativeType max_result = | 865 | 81 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 866 | 81 | typename ToFieldType::NativeType min_result = -max_result; | 867 | 443 | for (size_t i = 0; i < size; i++) { | 868 | 362 | if (!CastToDecimal::_from_float<typename FromDataType::FieldType, | 869 | 362 | typename ToDataType::FieldType>( | 870 | 362 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, scale_multiplier, | 871 | 362 | min_result, max_result, params)) { | 872 | 18 | if (set_nullable) { | 873 | 18 | null_map_data[i] = 1; | 874 | 18 | } else { | 875 | 0 | return params.status; | 876 | 0 | } | 877 | 18 | } | 878 | 362 | } | 879 | | | 880 | 81 | block.get_by_position(result).column = | 881 | 81 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 882 | 81 | return Status::OK(); | 883 | 81 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE9EEENS_15DataTypeDecimalILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 820 | 18 | const NullMap::value_type* null_map = nullptr) const override { | 821 | 18 | using FromFieldType = typename FromDataType::FieldType; | 822 | 18 | using ToFieldType = typename ToDataType::FieldType; | 823 | 18 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 824 | 18 | const auto* col_from = | 825 | 18 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 826 | 18 | if (!col_from) { | 827 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 828 | 0 | named_from.column->get_name()); | 829 | 0 | } | 830 | | | 831 | 18 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 832 | 18 | UInt32 from_scale = 0; | 833 | | | 834 | 18 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 835 | 18 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 836 | 18 | UInt32 to_precision = to_decimal_type.get_precision(); | 837 | 18 | ToDataType::check_type_precision(to_precision); | 838 | 18 | UInt32 to_scale = to_decimal_type.get_scale(); | 839 | 18 | ToDataType::check_type_scale(to_scale); | 840 | | | 841 | 18 | auto from_max_int_digit_count = from_precision - from_scale; | 842 | 18 | auto to_max_int_digit_count = to_precision - to_scale; | 843 | 18 | bool narrow_integral = | 844 | 18 | (to_max_int_digit_count < from_max_int_digit_count) || | 845 | 18 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 846 | | // only in non-strict mode and may overflow, we set nullable | 847 | 18 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 848 | | | 849 | 18 | ColumnUInt8::MutablePtr col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 850 | 18 | NullMap::value_type* null_map_data = col_null_map_to->get_data().data(); | 851 | | | 852 | 18 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 853 | 18 | const auto& vec_from = col_from->get_data(); | 854 | 18 | const auto* vec_from_data = vec_from.data(); | 855 | 18 | auto& vec_to = col_to->get_data(); | 856 | 18 | auto* vec_to_data = vec_to.data(); | 857 | | | 858 | 18 | CastParameters params; | 859 | 18 | params.is_strict = (CastMode == CastModeType::StrictMode); | 860 | 18 | size_t size = vec_from.size(); | 861 | | | 862 | 18 | typename ToFieldType::NativeType scale_multiplier = | 863 | 18 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 864 | 18 | typename ToFieldType::NativeType max_result = | 865 | 18 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 866 | 18 | typename ToFieldType::NativeType min_result = -max_result; | 867 | 18 | for (size_t i = 0; i < size; i++) { | 868 | 18 | if (!CastToDecimal::_from_float<typename FromDataType::FieldType, | 869 | 18 | typename ToDataType::FieldType>( | 870 | 18 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, scale_multiplier, | 871 | 18 | min_result, max_result, params)) { | 872 | 18 | if (set_nullable) { | 873 | 0 | null_map_data[i] = 1; | 874 | 18 | } else { | 875 | 18 | return params.status; | 876 | 18 | } | 877 | 18 | } | 878 | 18 | } | 879 | | | 880 | 0 | block.get_by_position(result).column = | 881 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 882 | 0 | return Status::OK(); | 883 | 18 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE9EEENS_15DataTypeDecimalILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 820 | 81 | const NullMap::value_type* null_map = nullptr) const override { | 821 | 81 | using FromFieldType = typename FromDataType::FieldType; | 822 | 81 | using ToFieldType = typename ToDataType::FieldType; | 823 | 81 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 824 | 81 | const auto* col_from = | 825 | 81 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 826 | 81 | if (!col_from) { | 827 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 828 | 0 | named_from.column->get_name()); | 829 | 0 | } | 830 | | | 831 | 81 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 832 | 81 | UInt32 from_scale = 0; | 833 | | | 834 | 81 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 835 | 81 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 836 | 81 | UInt32 to_precision = to_decimal_type.get_precision(); | 837 | 81 | ToDataType::check_type_precision(to_precision); | 838 | 81 | UInt32 to_scale = to_decimal_type.get_scale(); | 839 | 81 | ToDataType::check_type_scale(to_scale); | 840 | | | 841 | 81 | auto from_max_int_digit_count = from_precision - from_scale; | 842 | 81 | auto to_max_int_digit_count = to_precision - to_scale; | 843 | 81 | bool narrow_integral = | 844 | 81 | (to_max_int_digit_count < from_max_int_digit_count) || | 845 | 81 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 846 | | // only in non-strict mode and may overflow, we set nullable | 847 | 81 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 848 | | | 849 | 81 | ColumnUInt8::MutablePtr col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 850 | 81 | NullMap::value_type* null_map_data = col_null_map_to->get_data().data(); | 851 | | | 852 | 81 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 853 | 81 | const auto& vec_from = col_from->get_data(); | 854 | 81 | const auto* vec_from_data = vec_from.data(); | 855 | 81 | auto& vec_to = col_to->get_data(); | 856 | 81 | auto* vec_to_data = vec_to.data(); | 857 | | | 858 | 81 | CastParameters params; | 859 | 81 | params.is_strict = (CastMode == CastModeType::StrictMode); | 860 | 81 | size_t size = vec_from.size(); | 861 | | | 862 | 81 | typename ToFieldType::NativeType scale_multiplier = | 863 | 81 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 864 | 81 | typename ToFieldType::NativeType max_result = | 865 | 81 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 866 | 81 | typename ToFieldType::NativeType min_result = -max_result; | 867 | 491 | for (size_t i = 0; i < size; i++) { | 868 | 410 | if (!CastToDecimal::_from_float<typename FromDataType::FieldType, | 869 | 410 | typename ToDataType::FieldType>( | 870 | 410 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, scale_multiplier, | 871 | 410 | min_result, max_result, params)) { | 872 | 18 | if (set_nullable) { | 873 | 18 | null_map_data[i] = 1; | 874 | 18 | } else { | 875 | 0 | return params.status; | 876 | 0 | } | 877 | 18 | } | 878 | 410 | } | 879 | | | 880 | 81 | block.get_by_position(result).column = | 881 | 81 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 882 | 81 | return Status::OK(); | 883 | 81 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE8EEENS_15DataTypeDecimalILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 820 | 18 | const NullMap::value_type* null_map = nullptr) const override { | 821 | 18 | using FromFieldType = typename FromDataType::FieldType; | 822 | 18 | using ToFieldType = typename ToDataType::FieldType; | 823 | 18 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 824 | 18 | const auto* col_from = | 825 | 18 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 826 | 18 | if (!col_from) { | 827 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 828 | 0 | named_from.column->get_name()); | 829 | 0 | } | 830 | | | 831 | 18 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 832 | 18 | UInt32 from_scale = 0; | 833 | | | 834 | 18 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 835 | 18 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 836 | 18 | UInt32 to_precision = to_decimal_type.get_precision(); | 837 | 18 | ToDataType::check_type_precision(to_precision); | 838 | 18 | UInt32 to_scale = to_decimal_type.get_scale(); | 839 | 18 | ToDataType::check_type_scale(to_scale); | 840 | | | 841 | 18 | auto from_max_int_digit_count = from_precision - from_scale; | 842 | 18 | auto to_max_int_digit_count = to_precision - to_scale; | 843 | 18 | bool narrow_integral = | 844 | 18 | (to_max_int_digit_count < from_max_int_digit_count) || | 845 | 18 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 846 | | // only in non-strict mode and may overflow, we set nullable | 847 | 18 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 848 | | | 849 | 18 | ColumnUInt8::MutablePtr col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 850 | 18 | NullMap::value_type* null_map_data = col_null_map_to->get_data().data(); | 851 | | | 852 | 18 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 853 | 18 | const auto& vec_from = col_from->get_data(); | 854 | 18 | const auto* vec_from_data = vec_from.data(); | 855 | 18 | auto& vec_to = col_to->get_data(); | 856 | 18 | auto* vec_to_data = vec_to.data(); | 857 | | | 858 | 18 | CastParameters params; | 859 | 18 | params.is_strict = (CastMode == CastModeType::StrictMode); | 860 | 18 | size_t size = vec_from.size(); | 861 | | | 862 | 18 | typename ToFieldType::NativeType scale_multiplier = | 863 | 18 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 864 | 18 | typename ToFieldType::NativeType max_result = | 865 | 18 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 866 | 18 | typename ToFieldType::NativeType min_result = -max_result; | 867 | 18 | for (size_t i = 0; i < size; i++) { | 868 | 18 | if (!CastToDecimal::_from_float<typename FromDataType::FieldType, | 869 | 18 | typename ToDataType::FieldType>( | 870 | 18 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, scale_multiplier, | 871 | 18 | min_result, max_result, params)) { | 872 | 18 | if (set_nullable) { | 873 | 0 | null_map_data[i] = 1; | 874 | 18 | } else { | 875 | 18 | return params.status; | 876 | 18 | } | 877 | 18 | } | 878 | 18 | } | 879 | | | 880 | 0 | block.get_by_position(result).column = | 881 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 882 | 0 | return Status::OK(); | 883 | 18 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE8EEENS_15DataTypeDecimalILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 820 | 89 | const NullMap::value_type* null_map = nullptr) const override { | 821 | 89 | using FromFieldType = typename FromDataType::FieldType; | 822 | 89 | using ToFieldType = typename ToDataType::FieldType; | 823 | 89 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 824 | 89 | const auto* col_from = | 825 | 89 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 826 | 89 | if (!col_from) { | 827 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 828 | 0 | named_from.column->get_name()); | 829 | 0 | } | 830 | | | 831 | 89 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 832 | 89 | UInt32 from_scale = 0; | 833 | | | 834 | 89 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 835 | 89 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 836 | 89 | UInt32 to_precision = to_decimal_type.get_precision(); | 837 | 89 | ToDataType::check_type_precision(to_precision); | 838 | 89 | UInt32 to_scale = to_decimal_type.get_scale(); | 839 | 89 | ToDataType::check_type_scale(to_scale); | 840 | | | 841 | 89 | auto from_max_int_digit_count = from_precision - from_scale; | 842 | 89 | auto to_max_int_digit_count = to_precision - to_scale; | 843 | 89 | bool narrow_integral = | 844 | 89 | (to_max_int_digit_count < from_max_int_digit_count) || | 845 | 89 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 846 | | // only in non-strict mode and may overflow, we set nullable | 847 | 89 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 848 | | | 849 | 89 | ColumnUInt8::MutablePtr col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 850 | 89 | NullMap::value_type* null_map_data = col_null_map_to->get_data().data(); | 851 | | | 852 | 89 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 853 | 89 | const auto& vec_from = col_from->get_data(); | 854 | 89 | const auto* vec_from_data = vec_from.data(); | 855 | 89 | auto& vec_to = col_to->get_data(); | 856 | 89 | auto* vec_to_data = vec_to.data(); | 857 | | | 858 | 89 | CastParameters params; | 859 | 89 | params.is_strict = (CastMode == CastModeType::StrictMode); | 860 | 89 | size_t size = vec_from.size(); | 861 | | | 862 | 89 | typename ToFieldType::NativeType scale_multiplier = | 863 | 89 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 864 | 89 | typename ToFieldType::NativeType max_result = | 865 | 89 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 866 | 89 | typename ToFieldType::NativeType min_result = -max_result; | 867 | 515 | for (size_t i = 0; i < size; i++) { | 868 | 426 | if (!CastToDecimal::_from_float<typename FromDataType::FieldType, | 869 | 426 | typename ToDataType::FieldType>( | 870 | 426 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, scale_multiplier, | 871 | 426 | min_result, max_result, params)) { | 872 | 18 | if (set_nullable) { | 873 | 18 | null_map_data[i] = 1; | 874 | 18 | } else { | 875 | 0 | return params.status; | 876 | 0 | } | 877 | 18 | } | 878 | 426 | } | 879 | | | 880 | 89 | block.get_by_position(result).column = | 881 | 89 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 882 | 89 | return Status::OK(); | 883 | 89 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE9EEENS_15DataTypeDecimalILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 820 | 18 | const NullMap::value_type* null_map = nullptr) const override { | 821 | 18 | using FromFieldType = typename FromDataType::FieldType; | 822 | 18 | using ToFieldType = typename ToDataType::FieldType; | 823 | 18 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 824 | 18 | const auto* col_from = | 825 | 18 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 826 | 18 | if (!col_from) { | 827 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 828 | 0 | named_from.column->get_name()); | 829 | 0 | } | 830 | | | 831 | 18 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 832 | 18 | UInt32 from_scale = 0; | 833 | | | 834 | 18 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 835 | 18 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 836 | 18 | UInt32 to_precision = to_decimal_type.get_precision(); | 837 | 18 | ToDataType::check_type_precision(to_precision); | 838 | 18 | UInt32 to_scale = to_decimal_type.get_scale(); | 839 | 18 | ToDataType::check_type_scale(to_scale); | 840 | | | 841 | 18 | auto from_max_int_digit_count = from_precision - from_scale; | 842 | 18 | auto to_max_int_digit_count = to_precision - to_scale; | 843 | 18 | bool narrow_integral = | 844 | 18 | (to_max_int_digit_count < from_max_int_digit_count) || | 845 | 18 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 846 | | // only in non-strict mode and may overflow, we set nullable | 847 | 18 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 848 | | | 849 | 18 | ColumnUInt8::MutablePtr col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 850 | 18 | NullMap::value_type* null_map_data = col_null_map_to->get_data().data(); | 851 | | | 852 | 18 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 853 | 18 | const auto& vec_from = col_from->get_data(); | 854 | 18 | const auto* vec_from_data = vec_from.data(); | 855 | 18 | auto& vec_to = col_to->get_data(); | 856 | 18 | auto* vec_to_data = vec_to.data(); | 857 | | | 858 | 18 | CastParameters params; | 859 | 18 | params.is_strict = (CastMode == CastModeType::StrictMode); | 860 | 18 | size_t size = vec_from.size(); | 861 | | | 862 | 18 | typename ToFieldType::NativeType scale_multiplier = | 863 | 18 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 864 | 18 | typename ToFieldType::NativeType max_result = | 865 | 18 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 866 | 18 | typename ToFieldType::NativeType min_result = -max_result; | 867 | 18 | for (size_t i = 0; i < size; i++) { | 868 | 18 | if (!CastToDecimal::_from_float<typename FromDataType::FieldType, | 869 | 18 | typename ToDataType::FieldType>( | 870 | 18 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, scale_multiplier, | 871 | 18 | min_result, max_result, params)) { | 872 | 18 | if (set_nullable) { | 873 | 0 | null_map_data[i] = 1; | 874 | 18 | } else { | 875 | 18 | return params.status; | 876 | 18 | } | 877 | 18 | } | 878 | 18 | } | 879 | | | 880 | 0 | block.get_by_position(result).column = | 881 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 882 | 0 | return Status::OK(); | 883 | 18 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE9EEENS_15DataTypeDecimalILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 820 | 73 | const NullMap::value_type* null_map = nullptr) const override { | 821 | 73 | using FromFieldType = typename FromDataType::FieldType; | 822 | 73 | using ToFieldType = typename ToDataType::FieldType; | 823 | 73 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 824 | 73 | const auto* col_from = | 825 | 73 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 826 | 73 | if (!col_from) { | 827 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 828 | 0 | named_from.column->get_name()); | 829 | 0 | } | 830 | | | 831 | 73 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 832 | 73 | UInt32 from_scale = 0; | 833 | | | 834 | 73 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 835 | 73 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 836 | 73 | UInt32 to_precision = to_decimal_type.get_precision(); | 837 | 73 | ToDataType::check_type_precision(to_precision); | 838 | 73 | UInt32 to_scale = to_decimal_type.get_scale(); | 839 | 73 | ToDataType::check_type_scale(to_scale); | 840 | | | 841 | 73 | auto from_max_int_digit_count = from_precision - from_scale; | 842 | 73 | auto to_max_int_digit_count = to_precision - to_scale; | 843 | 73 | bool narrow_integral = | 844 | 73 | (to_max_int_digit_count < from_max_int_digit_count) || | 845 | 73 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 846 | | // only in non-strict mode and may overflow, we set nullable | 847 | 73 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 848 | | | 849 | 73 | ColumnUInt8::MutablePtr col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 850 | 73 | NullMap::value_type* null_map_data = col_null_map_to->get_data().data(); | 851 | | | 852 | 73 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 853 | 73 | const auto& vec_from = col_from->get_data(); | 854 | 73 | const auto* vec_from_data = vec_from.data(); | 855 | 73 | auto& vec_to = col_to->get_data(); | 856 | 73 | auto* vec_to_data = vec_to.data(); | 857 | | | 858 | 73 | CastParameters params; | 859 | 73 | params.is_strict = (CastMode == CastModeType::StrictMode); | 860 | 73 | size_t size = vec_from.size(); | 861 | | | 862 | 73 | typename ToFieldType::NativeType scale_multiplier = | 863 | 73 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 864 | 73 | typename ToFieldType::NativeType max_result = | 865 | 73 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 866 | 73 | typename ToFieldType::NativeType min_result = -max_result; | 867 | 427 | for (size_t i = 0; i < size; i++) { | 868 | 354 | if (!CastToDecimal::_from_float<typename FromDataType::FieldType, | 869 | 354 | typename ToDataType::FieldType>( | 870 | 354 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, scale_multiplier, | 871 | 354 | min_result, max_result, params)) { | 872 | 18 | if (set_nullable) { | 873 | 18 | null_map_data[i] = 1; | 874 | 18 | } else { | 875 | 0 | return params.status; | 876 | 0 | } | 877 | 18 | } | 878 | 354 | } | 879 | | | 880 | 73 | block.get_by_position(result).column = | 881 | 73 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 882 | 73 | return Status::OK(); | 883 | 73 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE8EEENS_15DataTypeDecimalILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 820 | 18 | const NullMap::value_type* null_map = nullptr) const override { | 821 | 18 | using FromFieldType = typename FromDataType::FieldType; | 822 | 18 | using ToFieldType = typename ToDataType::FieldType; | 823 | 18 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 824 | 18 | const auto* col_from = | 825 | 18 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 826 | 18 | if (!col_from) { | 827 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 828 | 0 | named_from.column->get_name()); | 829 | 0 | } | 830 | | | 831 | 18 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 832 | 18 | UInt32 from_scale = 0; | 833 | | | 834 | 18 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 835 | 18 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 836 | 18 | UInt32 to_precision = to_decimal_type.get_precision(); | 837 | 18 | ToDataType::check_type_precision(to_precision); | 838 | 18 | UInt32 to_scale = to_decimal_type.get_scale(); | 839 | 18 | ToDataType::check_type_scale(to_scale); | 840 | | | 841 | 18 | auto from_max_int_digit_count = from_precision - from_scale; | 842 | 18 | auto to_max_int_digit_count = to_precision - to_scale; | 843 | 18 | bool narrow_integral = | 844 | 18 | (to_max_int_digit_count < from_max_int_digit_count) || | 845 | 18 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 846 | | // only in non-strict mode and may overflow, we set nullable | 847 | 18 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 848 | | | 849 | 18 | ColumnUInt8::MutablePtr col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 850 | 18 | NullMap::value_type* null_map_data = col_null_map_to->get_data().data(); | 851 | | | 852 | 18 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 853 | 18 | const auto& vec_from = col_from->get_data(); | 854 | 18 | const auto* vec_from_data = vec_from.data(); | 855 | 18 | auto& vec_to = col_to->get_data(); | 856 | 18 | auto* vec_to_data = vec_to.data(); | 857 | | | 858 | 18 | CastParameters params; | 859 | 18 | params.is_strict = (CastMode == CastModeType::StrictMode); | 860 | 18 | size_t size = vec_from.size(); | 861 | | | 862 | 18 | typename ToFieldType::NativeType scale_multiplier = | 863 | 18 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 864 | 18 | typename ToFieldType::NativeType max_result = | 865 | 18 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 866 | 18 | typename ToFieldType::NativeType min_result = -max_result; | 867 | 18 | for (size_t i = 0; i < size; i++) { | 868 | 18 | if (!CastToDecimal::_from_float<typename FromDataType::FieldType, | 869 | 18 | typename ToDataType::FieldType>( | 870 | 18 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, scale_multiplier, | 871 | 18 | min_result, max_result, params)) { | 872 | 18 | if (set_nullable) { | 873 | 0 | null_map_data[i] = 1; | 874 | 18 | } else { | 875 | 18 | return params.status; | 876 | 18 | } | 877 | 18 | } | 878 | 18 | } | 879 | | | 880 | 0 | block.get_by_position(result).column = | 881 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 882 | 0 | return Status::OK(); | 883 | 18 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE8EEENS_15DataTypeDecimalILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 820 | 69 | const NullMap::value_type* null_map = nullptr) const override { | 821 | 69 | using FromFieldType = typename FromDataType::FieldType; | 822 | 69 | using ToFieldType = typename ToDataType::FieldType; | 823 | 69 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 824 | 69 | const auto* col_from = | 825 | 69 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 826 | 69 | if (!col_from) { | 827 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 828 | 0 | named_from.column->get_name()); | 829 | 0 | } | 830 | | | 831 | 69 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 832 | 69 | UInt32 from_scale = 0; | 833 | | | 834 | 69 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 835 | 69 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 836 | 69 | UInt32 to_precision = to_decimal_type.get_precision(); | 837 | 69 | ToDataType::check_type_precision(to_precision); | 838 | 69 | UInt32 to_scale = to_decimal_type.get_scale(); | 839 | 69 | ToDataType::check_type_scale(to_scale); | 840 | | | 841 | 69 | auto from_max_int_digit_count = from_precision - from_scale; | 842 | 69 | auto to_max_int_digit_count = to_precision - to_scale; | 843 | 69 | bool narrow_integral = | 844 | 69 | (to_max_int_digit_count < from_max_int_digit_count) || | 845 | 69 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 846 | | // only in non-strict mode and may overflow, we set nullable | 847 | 69 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 848 | | | 849 | 69 | ColumnUInt8::MutablePtr col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 850 | 69 | NullMap::value_type* null_map_data = col_null_map_to->get_data().data(); | 851 | | | 852 | 69 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 853 | 69 | const auto& vec_from = col_from->get_data(); | 854 | 69 | const auto* vec_from_data = vec_from.data(); | 855 | 69 | auto& vec_to = col_to->get_data(); | 856 | 69 | auto* vec_to_data = vec_to.data(); | 857 | | | 858 | 69 | CastParameters params; | 859 | 69 | params.is_strict = (CastMode == CastModeType::StrictMode); | 860 | 69 | size_t size = vec_from.size(); | 861 | | | 862 | 69 | typename ToFieldType::NativeType scale_multiplier = | 863 | 69 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 864 | 69 | typename ToFieldType::NativeType max_result = | 865 | 69 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 866 | 69 | typename ToFieldType::NativeType min_result = -max_result; | 867 | 475 | for (size_t i = 0; i < size; i++) { | 868 | 406 | if (!CastToDecimal::_from_float<typename FromDataType::FieldType, | 869 | 406 | typename ToDataType::FieldType>( | 870 | 406 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, scale_multiplier, | 871 | 406 | min_result, max_result, params)) { | 872 | 18 | if (set_nullable) { | 873 | 18 | null_map_data[i] = 1; | 874 | 18 | } else { | 875 | 0 | return params.status; | 876 | 0 | } | 877 | 18 | } | 878 | 406 | } | 879 | | | 880 | 69 | block.get_by_position(result).column = | 881 | 69 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 882 | 69 | return Status::OK(); | 883 | 69 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE9EEENS_15DataTypeDecimalILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 820 | 18 | const NullMap::value_type* null_map = nullptr) const override { | 821 | 18 | using FromFieldType = typename FromDataType::FieldType; | 822 | 18 | using ToFieldType = typename ToDataType::FieldType; | 823 | 18 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 824 | 18 | const auto* col_from = | 825 | 18 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 826 | 18 | if (!col_from) { | 827 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 828 | 0 | named_from.column->get_name()); | 829 | 0 | } | 830 | | | 831 | 18 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 832 | 18 | UInt32 from_scale = 0; | 833 | | | 834 | 18 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 835 | 18 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 836 | 18 | UInt32 to_precision = to_decimal_type.get_precision(); | 837 | 18 | ToDataType::check_type_precision(to_precision); | 838 | 18 | UInt32 to_scale = to_decimal_type.get_scale(); | 839 | 18 | ToDataType::check_type_scale(to_scale); | 840 | | | 841 | 18 | auto from_max_int_digit_count = from_precision - from_scale; | 842 | 18 | auto to_max_int_digit_count = to_precision - to_scale; | 843 | 18 | bool narrow_integral = | 844 | 18 | (to_max_int_digit_count < from_max_int_digit_count) || | 845 | 18 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 846 | | // only in non-strict mode and may overflow, we set nullable | 847 | 18 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 848 | | | 849 | 18 | ColumnUInt8::MutablePtr col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 850 | 18 | NullMap::value_type* null_map_data = col_null_map_to->get_data().data(); | 851 | | | 852 | 18 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 853 | 18 | const auto& vec_from = col_from->get_data(); | 854 | 18 | const auto* vec_from_data = vec_from.data(); | 855 | 18 | auto& vec_to = col_to->get_data(); | 856 | 18 | auto* vec_to_data = vec_to.data(); | 857 | | | 858 | 18 | CastParameters params; | 859 | 18 | params.is_strict = (CastMode == CastModeType::StrictMode); | 860 | 18 | size_t size = vec_from.size(); | 861 | | | 862 | 18 | typename ToFieldType::NativeType scale_multiplier = | 863 | 18 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 864 | 18 | typename ToFieldType::NativeType max_result = | 865 | 18 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 866 | 18 | typename ToFieldType::NativeType min_result = -max_result; | 867 | 18 | for (size_t i = 0; i < size; i++) { | 868 | 18 | if (!CastToDecimal::_from_float<typename FromDataType::FieldType, | 869 | 18 | typename ToDataType::FieldType>( | 870 | 18 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, scale_multiplier, | 871 | 18 | min_result, max_result, params)) { | 872 | 18 | if (set_nullable) { | 873 | 0 | null_map_data[i] = 1; | 874 | 18 | } else { | 875 | 18 | return params.status; | 876 | 18 | } | 877 | 18 | } | 878 | 18 | } | 879 | | | 880 | 0 | block.get_by_position(result).column = | 881 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 882 | 0 | return Status::OK(); | 883 | 18 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE9EEENS_15DataTypeDecimalILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 820 | 81 | const NullMap::value_type* null_map = nullptr) const override { | 821 | 81 | using FromFieldType = typename FromDataType::FieldType; | 822 | 81 | using ToFieldType = typename ToDataType::FieldType; | 823 | 81 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 824 | 81 | const auto* col_from = | 825 | 81 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 826 | 81 | if (!col_from) { | 827 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 828 | 0 | named_from.column->get_name()); | 829 | 0 | } | 830 | | | 831 | 81 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 832 | 81 | UInt32 from_scale = 0; | 833 | | | 834 | 81 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 835 | 81 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 836 | 81 | UInt32 to_precision = to_decimal_type.get_precision(); | 837 | 81 | ToDataType::check_type_precision(to_precision); | 838 | 81 | UInt32 to_scale = to_decimal_type.get_scale(); | 839 | 81 | ToDataType::check_type_scale(to_scale); | 840 | | | 841 | 81 | auto from_max_int_digit_count = from_precision - from_scale; | 842 | 81 | auto to_max_int_digit_count = to_precision - to_scale; | 843 | 81 | bool narrow_integral = | 844 | 81 | (to_max_int_digit_count < from_max_int_digit_count) || | 845 | 81 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 846 | | // only in non-strict mode and may overflow, we set nullable | 847 | 81 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 848 | | | 849 | 81 | ColumnUInt8::MutablePtr col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 850 | 81 | NullMap::value_type* null_map_data = col_null_map_to->get_data().data(); | 851 | | | 852 | 81 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 853 | 81 | const auto& vec_from = col_from->get_data(); | 854 | 81 | const auto* vec_from_data = vec_from.data(); | 855 | 81 | auto& vec_to = col_to->get_data(); | 856 | 81 | auto* vec_to_data = vec_to.data(); | 857 | | | 858 | 81 | CastParameters params; | 859 | 81 | params.is_strict = (CastMode == CastModeType::StrictMode); | 860 | 81 | size_t size = vec_from.size(); | 861 | | | 862 | 81 | typename ToFieldType::NativeType scale_multiplier = | 863 | 81 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 864 | 81 | typename ToFieldType::NativeType max_result = | 865 | 81 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 866 | 81 | typename ToFieldType::NativeType min_result = -max_result; | 867 | 499 | for (size_t i = 0; i < size; i++) { | 868 | 418 | if (!CastToDecimal::_from_float<typename FromDataType::FieldType, | 869 | 418 | typename ToDataType::FieldType>( | 870 | 418 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, scale_multiplier, | 871 | 418 | min_result, max_result, params)) { | 872 | 18 | if (set_nullable) { | 873 | 18 | null_map_data[i] = 1; | 874 | 18 | } else { | 875 | 0 | return params.status; | 876 | 0 | } | 877 | 18 | } | 878 | 418 | } | 879 | | | 880 | 81 | block.get_by_position(result).column = | 881 | 81 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 882 | 81 | return Status::OK(); | 883 | 81 | } |
|
884 | | }; |
885 | | |
886 | | // cast decimalv3 types to decimalv2 types |
887 | | template <CastModeType CastMode, typename FromDataType, typename ToDataType> |
888 | | requires(IsDataTypeDecimalV3<ToDataType> && IsDataTypeDecimalV2<ToDataType>) |
889 | | class CastToImpl<CastMode, FromDataType, ToDataType> : public CastToBase { |
890 | | public: |
891 | | Status execute_impl(FunctionContext* context, Block& block, const ColumnNumbers& arguments, |
892 | | uint32_t result, size_t input_rows_count, |
893 | | const NullMap::value_type* null_map = nullptr) const override { |
894 | | return Status::RuntimeError( |
895 | | "not support {} ", |
896 | | cast_mode_type_to_string(CastMode, block.get_by_position(arguments[0]).type, |
897 | | block.get_by_position(result).type)); |
898 | | } |
899 | | }; |
900 | | |
901 | | // cast decimalv2 types to decimalv3 types |
902 | | template <CastModeType CastMode, typename FromDataType, typename ToDataType> |
903 | | requires(IsDataTypeDecimalV2<FromDataType> && IsDataTypeDecimalV3<ToDataType>) |
904 | | class CastToImpl<CastMode, FromDataType, ToDataType> : public CastToBase { |
905 | | public: |
906 | | Status execute_impl(FunctionContext* context, Block& block, const ColumnNumbers& arguments, |
907 | | uint32_t result, size_t input_rows_count, |
908 | 608 | const NullMap::value_type* null_map = nullptr) const override { |
909 | 608 | using FromFieldType = typename FromDataType::FieldType; |
910 | 608 | using ToFieldType = typename ToDataType::FieldType; |
911 | 608 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); |
912 | 608 | const auto* col_from = |
913 | 608 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); |
914 | 608 | if (!col_from) { |
915 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", |
916 | 0 | named_from.column->get_name()); |
917 | 0 | } |
918 | | |
919 | 608 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); |
920 | 608 | UInt32 from_precision = from_decimal_type.get_precision(); |
921 | 608 | UInt32 from_scale = from_decimal_type.get_scale(); |
922 | 608 | UInt32 from_original_precision = from_decimal_type.get_original_precision(); |
923 | 608 | UInt32 from_original_scale = from_decimal_type.get_original_scale(); |
924 | | |
925 | 608 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); |
926 | 608 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); |
927 | 608 | UInt32 to_precision = to_decimal_type.get_precision(); |
928 | 608 | ToDataType::check_type_precision(to_precision); |
929 | 608 | UInt32 to_scale = to_decimal_type.get_scale(); |
930 | 608 | ToDataType::check_type_scale(to_scale); |
931 | | |
932 | 608 | auto from_max_int_digit_count = from_original_precision - from_original_scale; |
933 | 608 | auto to_max_int_digit_count = to_precision - to_scale; |
934 | 608 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count) || |
935 | 608 | (to_max_int_digit_count == from_max_int_digit_count && |
936 | 216 | to_scale < from_original_scale); |
937 | | // only in non-strict mode and may overflow, we set nullable |
938 | 608 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; |
939 | | |
940 | 608 | size_t size = col_from->size(); |
941 | 608 | ColumnUInt8::MutablePtr col_null_map_to; |
942 | 608 | NullMap::value_type* null_map_data = nullptr; |
943 | 608 | if (narrow_integral) { |
944 | 410 | col_null_map_to = ColumnUInt8::create(size, 0); |
945 | 410 | null_map_data = col_null_map_to->get_data().data(); |
946 | 410 | } |
947 | 608 | CastParameters params; |
948 | 608 | params.is_strict = (CastMode == CastModeType::StrictMode); |
949 | 608 | auto col_to = ToDataType::ColumnType::create(size, to_scale); |
950 | 608 | const auto& vec_from = col_from->get_data(); |
951 | 608 | const auto* vec_from_data = vec_from.data(); |
952 | 608 | auto& vec_to = col_to->get_data(); |
953 | 608 | auto* vec_to_data = vec_to.data(); |
954 | | |
955 | 608 | using MaxFieldType = |
956 | 608 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && |
957 | 608 | (std::is_same_v<ToFieldType, Decimal128V3> || |
958 | 608 | std::is_same_v<FromFieldType, Decimal128V3>), |
959 | 608 | Decimal128V3, |
960 | 608 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), |
961 | 608 | FromFieldType, ToFieldType>>; |
962 | 608 | using MaxNativeType = typename MaxFieldType::NativeType; |
963 | | |
964 | 608 | constexpr UInt32 to_max_digits = |
965 | 608 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); |
966 | 608 | bool multiply_may_overflow = false; |
967 | 608 | if (to_scale > from_scale) { |
968 | 186 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; |
969 | 186 | } |
970 | | |
971 | 608 | typename ToFieldType::NativeType max_result = |
972 | 608 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); |
973 | 608 | typename ToFieldType::NativeType min_result = -max_result; |
974 | | |
975 | 608 | MaxNativeType multiplier {}; |
976 | 608 | if (from_scale < to_scale) { |
977 | 186 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - |
978 | 186 | from_scale); |
979 | 422 | } else if (from_scale > to_scale) { |
980 | 388 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - |
981 | 388 | to_scale); |
982 | 388 | } |
983 | 608 | RETURN_IF_ERROR(std::visit( |
984 | 608 | [&](auto multiply_may_overflow, auto narrow_integral) { |
985 | 608 | for (size_t i = 0; i < size; i++) { |
986 | 608 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, |
987 | 608 | multiply_may_overflow, narrow_integral>( |
988 | 608 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], |
989 | 608 | to_precision, to_scale, min_result, max_result, multiplier, |
990 | 608 | params)) { |
991 | 608 | if (set_nullable) { |
992 | 608 | null_map_data[i] = 1; |
993 | 608 | } else { |
994 | 608 | return params.status; |
995 | 608 | } |
996 | 608 | } |
997 | 608 | } |
998 | 608 | return Status::OK(); |
999 | 608 | }, |
1000 | 608 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); |
1001 | 387 | if (narrow_integral) { |
1002 | 189 | block.get_by_position(result).column = |
1003 | 189 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); |
1004 | 198 | } else { |
1005 | 198 | block.get_by_position(result).column = std::move(col_to); |
1006 | 198 | } |
1007 | 387 | return Status::OK(); |
1008 | 608 | } _ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEENS2_ILS3_28EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 908 | 87 | const NullMap::value_type* null_map = nullptr) const override { | 909 | 87 | using FromFieldType = typename FromDataType::FieldType; | 910 | 87 | using ToFieldType = typename ToDataType::FieldType; | 911 | 87 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 912 | 87 | const auto* col_from = | 913 | 87 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 914 | 87 | if (!col_from) { | 915 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 916 | 0 | named_from.column->get_name()); | 917 | 0 | } | 918 | | | 919 | 87 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 920 | 87 | UInt32 from_precision = from_decimal_type.get_precision(); | 921 | 87 | UInt32 from_scale = from_decimal_type.get_scale(); | 922 | 87 | UInt32 from_original_precision = from_decimal_type.get_original_precision(); | 923 | 87 | UInt32 from_original_scale = from_decimal_type.get_original_scale(); | 924 | | | 925 | 87 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 926 | 87 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 927 | 87 | UInt32 to_precision = to_decimal_type.get_precision(); | 928 | 87 | ToDataType::check_type_precision(to_precision); | 929 | 87 | UInt32 to_scale = to_decimal_type.get_scale(); | 930 | 87 | ToDataType::check_type_scale(to_scale); | 931 | | | 932 | 87 | auto from_max_int_digit_count = from_original_precision - from_original_scale; | 933 | 87 | auto to_max_int_digit_count = to_precision - to_scale; | 934 | 87 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count) || | 935 | 87 | (to_max_int_digit_count == from_max_int_digit_count && | 936 | 0 | to_scale < from_original_scale); | 937 | | // only in non-strict mode and may overflow, we set nullable | 938 | 87 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 939 | | | 940 | 87 | size_t size = col_from->size(); | 941 | 87 | ColumnUInt8::MutablePtr col_null_map_to; | 942 | 87 | NullMap::value_type* null_map_data = nullptr; | 943 | 87 | if (narrow_integral) { | 944 | 87 | col_null_map_to = ColumnUInt8::create(size, 0); | 945 | 87 | null_map_data = col_null_map_to->get_data().data(); | 946 | 87 | } | 947 | 87 | CastParameters params; | 948 | 87 | params.is_strict = (CastMode == CastModeType::StrictMode); | 949 | 87 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 950 | 87 | const auto& vec_from = col_from->get_data(); | 951 | 87 | const auto* vec_from_data = vec_from.data(); | 952 | 87 | auto& vec_to = col_to->get_data(); | 953 | 87 | auto* vec_to_data = vec_to.data(); | 954 | | | 955 | 87 | using MaxFieldType = | 956 | 87 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 957 | 87 | (std::is_same_v<ToFieldType, Decimal128V3> || | 958 | 87 | std::is_same_v<FromFieldType, Decimal128V3>), | 959 | 87 | Decimal128V3, | 960 | 87 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 961 | 87 | FromFieldType, ToFieldType>>; | 962 | 87 | using MaxNativeType = typename MaxFieldType::NativeType; | 963 | | | 964 | 87 | constexpr UInt32 to_max_digits = | 965 | 87 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 966 | 87 | bool multiply_may_overflow = false; | 967 | 87 | if (to_scale > from_scale) { | 968 | 0 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 969 | 0 | } | 970 | | | 971 | 87 | typename ToFieldType::NativeType max_result = | 972 | 87 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 973 | 87 | typename ToFieldType::NativeType min_result = -max_result; | 974 | | | 975 | 87 | MaxNativeType multiplier {}; | 976 | 87 | if (from_scale < to_scale) { | 977 | 0 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 978 | 0 | from_scale); | 979 | 87 | } else if (from_scale > to_scale) { | 980 | 78 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 981 | 78 | to_scale); | 982 | 78 | } | 983 | 87 | RETURN_IF_ERROR(std::visit( | 984 | 87 | [&](auto multiply_may_overflow, auto narrow_integral) { | 985 | 87 | for (size_t i = 0; i < size; i++) { | 986 | 87 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 987 | 87 | multiply_may_overflow, narrow_integral>( | 988 | 87 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 989 | 87 | to_precision, to_scale, min_result, max_result, multiplier, | 990 | 87 | params)) { | 991 | 87 | if (set_nullable) { | 992 | 87 | null_map_data[i] = 1; | 993 | 87 | } else { | 994 | 87 | return params.status; | 995 | 87 | } | 996 | 87 | } | 997 | 87 | } | 998 | 87 | return Status::OK(); | 999 | 87 | }, | 1000 | 87 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1001 | 0 | if (narrow_integral) { | 1002 | 0 | block.get_by_position(result).column = | 1003 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1004 | 0 | } else { | 1005 | 0 | block.get_by_position(result).column = std::move(col_to); | 1006 | 0 | } | 1007 | 0 | return Status::OK(); | 1008 | 87 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEENS2_ILS3_28EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 908 | 74 | const NullMap::value_type* null_map = nullptr) const override { | 909 | 74 | using FromFieldType = typename FromDataType::FieldType; | 910 | 74 | using ToFieldType = typename ToDataType::FieldType; | 911 | 74 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 912 | 74 | const auto* col_from = | 913 | 74 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 914 | 74 | if (!col_from) { | 915 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 916 | 0 | named_from.column->get_name()); | 917 | 0 | } | 918 | | | 919 | 74 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 920 | 74 | UInt32 from_precision = from_decimal_type.get_precision(); | 921 | 74 | UInt32 from_scale = from_decimal_type.get_scale(); | 922 | 74 | UInt32 from_original_precision = from_decimal_type.get_original_precision(); | 923 | 74 | UInt32 from_original_scale = from_decimal_type.get_original_scale(); | 924 | | | 925 | 74 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 926 | 74 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 927 | 74 | UInt32 to_precision = to_decimal_type.get_precision(); | 928 | 74 | ToDataType::check_type_precision(to_precision); | 929 | 74 | UInt32 to_scale = to_decimal_type.get_scale(); | 930 | 74 | ToDataType::check_type_scale(to_scale); | 931 | | | 932 | 74 | auto from_max_int_digit_count = from_original_precision - from_original_scale; | 933 | 74 | auto to_max_int_digit_count = to_precision - to_scale; | 934 | 74 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count) || | 935 | 74 | (to_max_int_digit_count == from_max_int_digit_count && | 936 | 18 | to_scale < from_original_scale); | 937 | | // only in non-strict mode and may overflow, we set nullable | 938 | 74 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 939 | | | 940 | 74 | size_t size = col_from->size(); | 941 | 74 | ColumnUInt8::MutablePtr col_null_map_to; | 942 | 74 | NullMap::value_type* null_map_data = nullptr; | 943 | 74 | if (narrow_integral) { | 944 | 56 | col_null_map_to = ColumnUInt8::create(size, 0); | 945 | 56 | null_map_data = col_null_map_to->get_data().data(); | 946 | 56 | } | 947 | 74 | CastParameters params; | 948 | 74 | params.is_strict = (CastMode == CastModeType::StrictMode); | 949 | 74 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 950 | 74 | const auto& vec_from = col_from->get_data(); | 951 | 74 | const auto* vec_from_data = vec_from.data(); | 952 | 74 | auto& vec_to = col_to->get_data(); | 953 | 74 | auto* vec_to_data = vec_to.data(); | 954 | | | 955 | 74 | using MaxFieldType = | 956 | 74 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 957 | 74 | (std::is_same_v<ToFieldType, Decimal128V3> || | 958 | 74 | std::is_same_v<FromFieldType, Decimal128V3>), | 959 | 74 | Decimal128V3, | 960 | 74 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 961 | 74 | FromFieldType, ToFieldType>>; | 962 | 74 | using MaxNativeType = typename MaxFieldType::NativeType; | 963 | | | 964 | 74 | constexpr UInt32 to_max_digits = | 965 | 74 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 966 | 74 | bool multiply_may_overflow = false; | 967 | 74 | if (to_scale > from_scale) { | 968 | 0 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 969 | 0 | } | 970 | | | 971 | 74 | typename ToFieldType::NativeType max_result = | 972 | 74 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 973 | 74 | typename ToFieldType::NativeType min_result = -max_result; | 974 | | | 975 | 74 | MaxNativeType multiplier {}; | 976 | 74 | if (from_scale < to_scale) { | 977 | 0 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 978 | 0 | from_scale); | 979 | 74 | } else if (from_scale > to_scale) { | 980 | 67 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 981 | 67 | to_scale); | 982 | 67 | } | 983 | 74 | RETURN_IF_ERROR(std::visit( | 984 | 74 | [&](auto multiply_may_overflow, auto narrow_integral) { | 985 | 74 | for (size_t i = 0; i < size; i++) { | 986 | 74 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 987 | 74 | multiply_may_overflow, narrow_integral>( | 988 | 74 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 989 | 74 | to_precision, to_scale, min_result, max_result, multiplier, | 990 | 74 | params)) { | 991 | 74 | if (set_nullable) { | 992 | 74 | null_map_data[i] = 1; | 993 | 74 | } else { | 994 | 74 | return params.status; | 995 | 74 | } | 996 | 74 | } | 997 | 74 | } | 998 | 74 | return Status::OK(); | 999 | 74 | }, | 1000 | 74 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1001 | 74 | if (narrow_integral) { | 1002 | 56 | block.get_by_position(result).column = | 1003 | 56 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1004 | 56 | } else { | 1005 | 18 | block.get_by_position(result).column = std::move(col_to); | 1006 | 18 | } | 1007 | 74 | return Status::OK(); | 1008 | 74 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEENS2_ILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 908 | 72 | const NullMap::value_type* null_map = nullptr) const override { | 909 | 72 | using FromFieldType = typename FromDataType::FieldType; | 910 | 72 | using ToFieldType = typename ToDataType::FieldType; | 911 | 72 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 912 | 72 | const auto* col_from = | 913 | 72 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 914 | 72 | if (!col_from) { | 915 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 916 | 0 | named_from.column->get_name()); | 917 | 0 | } | 918 | | | 919 | 72 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 920 | 72 | UInt32 from_precision = from_decimal_type.get_precision(); | 921 | 72 | UInt32 from_scale = from_decimal_type.get_scale(); | 922 | 72 | UInt32 from_original_precision = from_decimal_type.get_original_precision(); | 923 | 72 | UInt32 from_original_scale = from_decimal_type.get_original_scale(); | 924 | | | 925 | 72 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 926 | 72 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 927 | 72 | UInt32 to_precision = to_decimal_type.get_precision(); | 928 | 72 | ToDataType::check_type_precision(to_precision); | 929 | 72 | UInt32 to_scale = to_decimal_type.get_scale(); | 930 | 72 | ToDataType::check_type_scale(to_scale); | 931 | | | 932 | 72 | auto from_max_int_digit_count = from_original_precision - from_original_scale; | 933 | 72 | auto to_max_int_digit_count = to_precision - to_scale; | 934 | 72 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count) || | 935 | 72 | (to_max_int_digit_count == from_max_int_digit_count && | 936 | 2 | to_scale < from_original_scale); | 937 | | // only in non-strict mode and may overflow, we set nullable | 938 | 72 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 939 | | | 940 | 72 | size_t size = col_from->size(); | 941 | 72 | ColumnUInt8::MutablePtr col_null_map_to; | 942 | 72 | NullMap::value_type* null_map_data = nullptr; | 943 | 72 | if (narrow_integral) { | 944 | 72 | col_null_map_to = ColumnUInt8::create(size, 0); | 945 | 72 | null_map_data = col_null_map_to->get_data().data(); | 946 | 72 | } | 947 | 72 | CastParameters params; | 948 | 72 | params.is_strict = (CastMode == CastModeType::StrictMode); | 949 | 72 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 950 | 72 | const auto& vec_from = col_from->get_data(); | 951 | 72 | const auto* vec_from_data = vec_from.data(); | 952 | 72 | auto& vec_to = col_to->get_data(); | 953 | 72 | auto* vec_to_data = vec_to.data(); | 954 | | | 955 | 72 | using MaxFieldType = | 956 | 72 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 957 | 72 | (std::is_same_v<ToFieldType, Decimal128V3> || | 958 | 72 | std::is_same_v<FromFieldType, Decimal128V3>), | 959 | 72 | Decimal128V3, | 960 | 72 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 961 | 72 | FromFieldType, ToFieldType>>; | 962 | 72 | using MaxNativeType = typename MaxFieldType::NativeType; | 963 | | | 964 | 72 | constexpr UInt32 to_max_digits = | 965 | 72 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 966 | 72 | bool multiply_may_overflow = false; | 967 | 72 | if (to_scale > from_scale) { | 968 | 24 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 969 | 24 | } | 970 | | | 971 | 72 | typename ToFieldType::NativeType max_result = | 972 | 72 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 973 | 72 | typename ToFieldType::NativeType min_result = -max_result; | 974 | | | 975 | 72 | MaxNativeType multiplier {}; | 976 | 72 | if (from_scale < to_scale) { | 977 | 24 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 978 | 24 | from_scale); | 979 | 48 | } else if (from_scale > to_scale) { | 980 | 42 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 981 | 42 | to_scale); | 982 | 42 | } | 983 | 72 | RETURN_IF_ERROR(std::visit( | 984 | 72 | [&](auto multiply_may_overflow, auto narrow_integral) { | 985 | 72 | for (size_t i = 0; i < size; i++) { | 986 | 72 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 987 | 72 | multiply_may_overflow, narrow_integral>( | 988 | 72 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 989 | 72 | to_precision, to_scale, min_result, max_result, multiplier, | 990 | 72 | params)) { | 991 | 72 | if (set_nullable) { | 992 | 72 | null_map_data[i] = 1; | 993 | 72 | } else { | 994 | 72 | return params.status; | 995 | 72 | } | 996 | 72 | } | 997 | 72 | } | 998 | 72 | return Status::OK(); | 999 | 72 | }, | 1000 | 72 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1001 | 0 | if (narrow_integral) { | 1002 | 0 | block.get_by_position(result).column = | 1003 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1004 | 0 | } else { | 1005 | 0 | block.get_by_position(result).column = std::move(col_to); | 1006 | 0 | } | 1007 | 0 | return Status::OK(); | 1008 | 72 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEENS2_ILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 908 | 108 | const NullMap::value_type* null_map = nullptr) const override { | 909 | 108 | using FromFieldType = typename FromDataType::FieldType; | 910 | 108 | using ToFieldType = typename ToDataType::FieldType; | 911 | 108 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 912 | 108 | const auto* col_from = | 913 | 108 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 914 | 108 | if (!col_from) { | 915 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 916 | 0 | named_from.column->get_name()); | 917 | 0 | } | 918 | | | 919 | 108 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 920 | 108 | UInt32 from_precision = from_decimal_type.get_precision(); | 921 | 108 | UInt32 from_scale = from_decimal_type.get_scale(); | 922 | 108 | UInt32 from_original_precision = from_decimal_type.get_original_precision(); | 923 | 108 | UInt32 from_original_scale = from_decimal_type.get_original_scale(); | 924 | | | 925 | 108 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 926 | 108 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 927 | 108 | UInt32 to_precision = to_decimal_type.get_precision(); | 928 | 108 | ToDataType::check_type_precision(to_precision); | 929 | 108 | UInt32 to_scale = to_decimal_type.get_scale(); | 930 | 108 | ToDataType::check_type_scale(to_scale); | 931 | | | 932 | 108 | auto from_max_int_digit_count = from_original_precision - from_original_scale; | 933 | 108 | auto to_max_int_digit_count = to_precision - to_scale; | 934 | 108 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count) || | 935 | 108 | (to_max_int_digit_count == from_max_int_digit_count && | 936 | 45 | to_scale < from_original_scale); | 937 | | // only in non-strict mode and may overflow, we set nullable | 938 | 108 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 939 | | | 940 | 108 | size_t size = col_from->size(); | 941 | 108 | ColumnUInt8::MutablePtr col_null_map_to; | 942 | 108 | NullMap::value_type* null_map_data = nullptr; | 943 | 108 | if (narrow_integral) { | 944 | 70 | col_null_map_to = ColumnUInt8::create(size, 0); | 945 | 70 | null_map_data = col_null_map_to->get_data().data(); | 946 | 70 | } | 947 | 108 | CastParameters params; | 948 | 108 | params.is_strict = (CastMode == CastModeType::StrictMode); | 949 | 108 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 950 | 108 | const auto& vec_from = col_from->get_data(); | 951 | 108 | const auto* vec_from_data = vec_from.data(); | 952 | 108 | auto& vec_to = col_to->get_data(); | 953 | 108 | auto* vec_to_data = vec_to.data(); | 954 | | | 955 | 108 | using MaxFieldType = | 956 | 108 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 957 | 108 | (std::is_same_v<ToFieldType, Decimal128V3> || | 958 | 108 | std::is_same_v<FromFieldType, Decimal128V3>), | 959 | 108 | Decimal128V3, | 960 | 108 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 961 | 108 | FromFieldType, ToFieldType>>; | 962 | 108 | using MaxNativeType = typename MaxFieldType::NativeType; | 963 | | | 964 | 108 | constexpr UInt32 to_max_digits = | 965 | 108 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 966 | 108 | bool multiply_may_overflow = false; | 967 | 108 | if (to_scale > from_scale) { | 968 | 26 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 969 | 26 | } | 970 | | | 971 | 108 | typename ToFieldType::NativeType max_result = | 972 | 108 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 973 | 108 | typename ToFieldType::NativeType min_result = -max_result; | 974 | | | 975 | 108 | MaxNativeType multiplier {}; | 976 | 108 | if (from_scale < to_scale) { | 977 | 26 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 978 | 26 | from_scale); | 979 | 82 | } else if (from_scale > to_scale) { | 980 | 70 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 981 | 70 | to_scale); | 982 | 70 | } | 983 | 108 | RETURN_IF_ERROR(std::visit( | 984 | 108 | [&](auto multiply_may_overflow, auto narrow_integral) { | 985 | 108 | for (size_t i = 0; i < size; i++) { | 986 | 108 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 987 | 108 | multiply_may_overflow, narrow_integral>( | 988 | 108 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 989 | 108 | to_precision, to_scale, min_result, max_result, multiplier, | 990 | 108 | params)) { | 991 | 108 | if (set_nullable) { | 992 | 108 | null_map_data[i] = 1; | 993 | 108 | } else { | 994 | 108 | return params.status; | 995 | 108 | } | 996 | 108 | } | 997 | 108 | } | 998 | 108 | return Status::OK(); | 999 | 108 | }, | 1000 | 108 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1001 | 108 | if (narrow_integral) { | 1002 | 70 | block.get_by_position(result).column = | 1003 | 70 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1004 | 70 | } else { | 1005 | 38 | block.get_by_position(result).column = std::move(col_to); | 1006 | 38 | } | 1007 | 108 | return Status::OK(); | 1008 | 108 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEENS2_ILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 908 | 32 | const NullMap::value_type* null_map = nullptr) const override { | 909 | 32 | using FromFieldType = typename FromDataType::FieldType; | 910 | 32 | using ToFieldType = typename ToDataType::FieldType; | 911 | 32 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 912 | 32 | const auto* col_from = | 913 | 32 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 914 | 32 | if (!col_from) { | 915 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 916 | 0 | named_from.column->get_name()); | 917 | 0 | } | 918 | | | 919 | 32 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 920 | 32 | UInt32 from_precision = from_decimal_type.get_precision(); | 921 | 32 | UInt32 from_scale = from_decimal_type.get_scale(); | 922 | 32 | UInt32 from_original_precision = from_decimal_type.get_original_precision(); | 923 | 32 | UInt32 from_original_scale = from_decimal_type.get_original_scale(); | 924 | | | 925 | 32 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 926 | 32 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 927 | 32 | UInt32 to_precision = to_decimal_type.get_precision(); | 928 | 32 | ToDataType::check_type_precision(to_precision); | 929 | 32 | UInt32 to_scale = to_decimal_type.get_scale(); | 930 | 32 | ToDataType::check_type_scale(to_scale); | 931 | | | 932 | 32 | auto from_max_int_digit_count = from_original_precision - from_original_scale; | 933 | 32 | auto to_max_int_digit_count = to_precision - to_scale; | 934 | 32 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count) || | 935 | 32 | (to_max_int_digit_count == from_max_int_digit_count && | 936 | 2 | to_scale < from_original_scale); | 937 | | // only in non-strict mode and may overflow, we set nullable | 938 | 32 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 939 | | | 940 | 32 | size_t size = col_from->size(); | 941 | 32 | ColumnUInt8::MutablePtr col_null_map_to; | 942 | 32 | NullMap::value_type* null_map_data = nullptr; | 943 | 32 | if (narrow_integral) { | 944 | 32 | col_null_map_to = ColumnUInt8::create(size, 0); | 945 | 32 | null_map_data = col_null_map_to->get_data().data(); | 946 | 32 | } | 947 | 32 | CastParameters params; | 948 | 32 | params.is_strict = (CastMode == CastModeType::StrictMode); | 949 | 32 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 950 | 32 | const auto& vec_from = col_from->get_data(); | 951 | 32 | const auto* vec_from_data = vec_from.data(); | 952 | 32 | auto& vec_to = col_to->get_data(); | 953 | 32 | auto* vec_to_data = vec_to.data(); | 954 | | | 955 | 32 | using MaxFieldType = | 956 | 32 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 957 | 32 | (std::is_same_v<ToFieldType, Decimal128V3> || | 958 | 32 | std::is_same_v<FromFieldType, Decimal128V3>), | 959 | 32 | Decimal128V3, | 960 | 32 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 961 | 32 | FromFieldType, ToFieldType>>; | 962 | 32 | using MaxNativeType = typename MaxFieldType::NativeType; | 963 | | | 964 | 32 | constexpr UInt32 to_max_digits = | 965 | 32 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 966 | 32 | bool multiply_may_overflow = false; | 967 | 32 | if (to_scale > from_scale) { | 968 | 30 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 969 | 30 | } | 970 | | | 971 | 32 | typename ToFieldType::NativeType max_result = | 972 | 32 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 973 | 32 | typename ToFieldType::NativeType min_result = -max_result; | 974 | | | 975 | 32 | MaxNativeType multiplier {}; | 976 | 32 | if (from_scale < to_scale) { | 977 | 30 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 978 | 30 | from_scale); | 979 | 30 | } else if (from_scale > to_scale) { | 980 | 2 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 981 | 2 | to_scale); | 982 | 2 | } | 983 | 32 | RETURN_IF_ERROR(std::visit( | 984 | 32 | [&](auto multiply_may_overflow, auto narrow_integral) { | 985 | 32 | for (size_t i = 0; i < size; i++) { | 986 | 32 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 987 | 32 | multiply_may_overflow, narrow_integral>( | 988 | 32 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 989 | 32 | to_precision, to_scale, min_result, max_result, multiplier, | 990 | 32 | params)) { | 991 | 32 | if (set_nullable) { | 992 | 32 | null_map_data[i] = 1; | 993 | 32 | } else { | 994 | 32 | return params.status; | 995 | 32 | } | 996 | 32 | } | 997 | 32 | } | 998 | 32 | return Status::OK(); | 999 | 32 | }, | 1000 | 32 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1001 | 0 | if (narrow_integral) { | 1002 | 0 | block.get_by_position(result).column = | 1003 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1004 | 0 | } else { | 1005 | 0 | block.get_by_position(result).column = std::move(col_to); | 1006 | 0 | } | 1007 | 0 | return Status::OK(); | 1008 | 32 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEENS2_ILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 908 | 103 | const NullMap::value_type* null_map = nullptr) const override { | 909 | 103 | using FromFieldType = typename FromDataType::FieldType; | 910 | 103 | using ToFieldType = typename ToDataType::FieldType; | 911 | 103 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 912 | 103 | const auto* col_from = | 913 | 103 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 914 | 103 | if (!col_from) { | 915 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 916 | 0 | named_from.column->get_name()); | 917 | 0 | } | 918 | | | 919 | 103 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 920 | 103 | UInt32 from_precision = from_decimal_type.get_precision(); | 921 | 103 | UInt32 from_scale = from_decimal_type.get_scale(); | 922 | 103 | UInt32 from_original_precision = from_decimal_type.get_original_precision(); | 923 | 103 | UInt32 from_original_scale = from_decimal_type.get_original_scale(); | 924 | | | 925 | 103 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 926 | 103 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 927 | 103 | UInt32 to_precision = to_decimal_type.get_precision(); | 928 | 103 | ToDataType::check_type_precision(to_precision); | 929 | 103 | UInt32 to_scale = to_decimal_type.get_scale(); | 930 | 103 | ToDataType::check_type_scale(to_scale); | 931 | | | 932 | 103 | auto from_max_int_digit_count = from_original_precision - from_original_scale; | 933 | 103 | auto to_max_int_digit_count = to_precision - to_scale; | 934 | 103 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count) || | 935 | 103 | (to_max_int_digit_count == from_max_int_digit_count && | 936 | 75 | to_scale < from_original_scale); | 937 | | // only in non-strict mode and may overflow, we set nullable | 938 | 103 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 939 | | | 940 | 103 | size_t size = col_from->size(); | 941 | 103 | ColumnUInt8::MutablePtr col_null_map_to; | 942 | 103 | NullMap::value_type* null_map_data = nullptr; | 943 | 103 | if (narrow_integral) { | 944 | 35 | col_null_map_to = ColumnUInt8::create(size, 0); | 945 | 35 | null_map_data = col_null_map_to->get_data().data(); | 946 | 35 | } | 947 | 103 | CastParameters params; | 948 | 103 | params.is_strict = (CastMode == CastModeType::StrictMode); | 949 | 103 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 950 | 103 | const auto& vec_from = col_from->get_data(); | 951 | 103 | const auto* vec_from_data = vec_from.data(); | 952 | 103 | auto& vec_to = col_to->get_data(); | 953 | 103 | auto* vec_to_data = vec_to.data(); | 954 | | | 955 | 103 | using MaxFieldType = | 956 | 103 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 957 | 103 | (std::is_same_v<ToFieldType, Decimal128V3> || | 958 | 103 | std::is_same_v<FromFieldType, Decimal128V3>), | 959 | 103 | Decimal128V3, | 960 | 103 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 961 | 103 | FromFieldType, ToFieldType>>; | 962 | 103 | using MaxNativeType = typename MaxFieldType::NativeType; | 963 | | | 964 | 103 | constexpr UInt32 to_max_digits = | 965 | 103 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 966 | 103 | bool multiply_may_overflow = false; | 967 | 103 | if (to_scale > from_scale) { | 968 | 38 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 969 | 38 | } | 970 | | | 971 | 103 | typename ToFieldType::NativeType max_result = | 972 | 103 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 973 | 103 | typename ToFieldType::NativeType min_result = -max_result; | 974 | | | 975 | 103 | MaxNativeType multiplier {}; | 976 | 103 | if (from_scale < to_scale) { | 977 | 38 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 978 | 38 | from_scale); | 979 | 65 | } else if (from_scale > to_scale) { | 980 | 65 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 981 | 65 | to_scale); | 982 | 65 | } | 983 | 103 | RETURN_IF_ERROR(std::visit( | 984 | 103 | [&](auto multiply_may_overflow, auto narrow_integral) { | 985 | 103 | for (size_t i = 0; i < size; i++) { | 986 | 103 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 987 | 103 | multiply_may_overflow, narrow_integral>( | 988 | 103 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 989 | 103 | to_precision, to_scale, min_result, max_result, multiplier, | 990 | 103 | params)) { | 991 | 103 | if (set_nullable) { | 992 | 103 | null_map_data[i] = 1; | 993 | 103 | } else { | 994 | 103 | return params.status; | 995 | 103 | } | 996 | 103 | } | 997 | 103 | } | 998 | 103 | return Status::OK(); | 999 | 103 | }, | 1000 | 103 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1001 | 103 | if (narrow_integral) { | 1002 | 35 | block.get_by_position(result).column = | 1003 | 35 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1004 | 68 | } else { | 1005 | 68 | block.get_by_position(result).column = std::move(col_to); | 1006 | 68 | } | 1007 | 103 | return Status::OK(); | 1008 | 103 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEENS2_ILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 908 | 30 | const NullMap::value_type* null_map = nullptr) const override { | 909 | 30 | using FromFieldType = typename FromDataType::FieldType; | 910 | 30 | using ToFieldType = typename ToDataType::FieldType; | 911 | 30 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 912 | 30 | const auto* col_from = | 913 | 30 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 914 | 30 | if (!col_from) { | 915 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 916 | 0 | named_from.column->get_name()); | 917 | 0 | } | 918 | | | 919 | 30 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 920 | 30 | UInt32 from_precision = from_decimal_type.get_precision(); | 921 | 30 | UInt32 from_scale = from_decimal_type.get_scale(); | 922 | 30 | UInt32 from_original_precision = from_decimal_type.get_original_precision(); | 923 | 30 | UInt32 from_original_scale = from_decimal_type.get_original_scale(); | 924 | | | 925 | 30 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 926 | 30 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 927 | 30 | UInt32 to_precision = to_decimal_type.get_precision(); | 928 | 30 | ToDataType::check_type_precision(to_precision); | 929 | 30 | UInt32 to_scale = to_decimal_type.get_scale(); | 930 | 30 | ToDataType::check_type_scale(to_scale); | 931 | | | 932 | 30 | auto from_max_int_digit_count = from_original_precision - from_original_scale; | 933 | 30 | auto to_max_int_digit_count = to_precision - to_scale; | 934 | 30 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count) || | 935 | 30 | (to_max_int_digit_count == from_max_int_digit_count && | 936 | 0 | to_scale < from_original_scale); | 937 | | // only in non-strict mode and may overflow, we set nullable | 938 | 30 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 939 | | | 940 | 30 | size_t size = col_from->size(); | 941 | 30 | ColumnUInt8::MutablePtr col_null_map_to; | 942 | 30 | NullMap::value_type* null_map_data = nullptr; | 943 | 30 | if (narrow_integral) { | 944 | 30 | col_null_map_to = ColumnUInt8::create(size, 0); | 945 | 30 | null_map_data = col_null_map_to->get_data().data(); | 946 | 30 | } | 947 | 30 | CastParameters params; | 948 | 30 | params.is_strict = (CastMode == CastModeType::StrictMode); | 949 | 30 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 950 | 30 | const auto& vec_from = col_from->get_data(); | 951 | 30 | const auto* vec_from_data = vec_from.data(); | 952 | 30 | auto& vec_to = col_to->get_data(); | 953 | 30 | auto* vec_to_data = vec_to.data(); | 954 | | | 955 | 30 | using MaxFieldType = | 956 | 30 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 957 | 30 | (std::is_same_v<ToFieldType, Decimal128V3> || | 958 | 30 | std::is_same_v<FromFieldType, Decimal128V3>), | 959 | 30 | Decimal128V3, | 960 | 30 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 961 | 30 | FromFieldType, ToFieldType>>; | 962 | 30 | using MaxNativeType = typename MaxFieldType::NativeType; | 963 | | | 964 | 30 | constexpr UInt32 to_max_digits = | 965 | 30 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 966 | 30 | bool multiply_may_overflow = false; | 967 | 30 | if (to_scale > from_scale) { | 968 | 30 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 969 | 30 | } | 970 | | | 971 | 30 | typename ToFieldType::NativeType max_result = | 972 | 30 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 973 | 30 | typename ToFieldType::NativeType min_result = -max_result; | 974 | | | 975 | 30 | MaxNativeType multiplier {}; | 976 | 30 | if (from_scale < to_scale) { | 977 | 30 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 978 | 30 | from_scale); | 979 | 30 | } else if (from_scale > to_scale) { | 980 | 0 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 981 | 0 | to_scale); | 982 | 0 | } | 983 | 30 | RETURN_IF_ERROR(std::visit( | 984 | 30 | [&](auto multiply_may_overflow, auto narrow_integral) { | 985 | 30 | for (size_t i = 0; i < size; i++) { | 986 | 30 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 987 | 30 | multiply_may_overflow, narrow_integral>( | 988 | 30 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 989 | 30 | to_precision, to_scale, min_result, max_result, multiplier, | 990 | 30 | params)) { | 991 | 30 | if (set_nullable) { | 992 | 30 | null_map_data[i] = 1; | 993 | 30 | } else { | 994 | 30 | return params.status; | 995 | 30 | } | 996 | 30 | } | 997 | 30 | } | 998 | 30 | return Status::OK(); | 999 | 30 | }, | 1000 | 30 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1001 | 0 | if (narrow_integral) { | 1002 | 0 | block.get_by_position(result).column = | 1003 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1004 | 0 | } else { | 1005 | 0 | block.get_by_position(result).column = std::move(col_to); | 1006 | 0 | } | 1007 | 0 | return Status::OK(); | 1008 | 30 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEENS2_ILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 908 | 102 | const NullMap::value_type* null_map = nullptr) const override { | 909 | 102 | using FromFieldType = typename FromDataType::FieldType; | 910 | 102 | using ToFieldType = typename ToDataType::FieldType; | 911 | 102 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 912 | 102 | const auto* col_from = | 913 | 102 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 914 | 102 | if (!col_from) { | 915 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 916 | 0 | named_from.column->get_name()); | 917 | 0 | } | 918 | | | 919 | 102 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 920 | 102 | UInt32 from_precision = from_decimal_type.get_precision(); | 921 | 102 | UInt32 from_scale = from_decimal_type.get_scale(); | 922 | 102 | UInt32 from_original_precision = from_decimal_type.get_original_precision(); | 923 | 102 | UInt32 from_original_scale = from_decimal_type.get_original_scale(); | 924 | | | 925 | 102 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 926 | 102 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 927 | 102 | UInt32 to_precision = to_decimal_type.get_precision(); | 928 | 102 | ToDataType::check_type_precision(to_precision); | 929 | 102 | UInt32 to_scale = to_decimal_type.get_scale(); | 930 | 102 | ToDataType::check_type_scale(to_scale); | 931 | | | 932 | 102 | auto from_max_int_digit_count = from_original_precision - from_original_scale; | 933 | 102 | auto to_max_int_digit_count = to_precision - to_scale; | 934 | 102 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count) || | 935 | 102 | (to_max_int_digit_count == from_max_int_digit_count && | 936 | 74 | to_scale < from_original_scale); | 937 | | // only in non-strict mode and may overflow, we set nullable | 938 | 102 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 939 | | | 940 | 102 | size_t size = col_from->size(); | 941 | 102 | ColumnUInt8::MutablePtr col_null_map_to; | 942 | 102 | NullMap::value_type* null_map_data = nullptr; | 943 | 102 | if (narrow_integral) { | 944 | 28 | col_null_map_to = ColumnUInt8::create(size, 0); | 945 | 28 | null_map_data = col_null_map_to->get_data().data(); | 946 | 28 | } | 947 | 102 | CastParameters params; | 948 | 102 | params.is_strict = (CastMode == CastModeType::StrictMode); | 949 | 102 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 950 | 102 | const auto& vec_from = col_from->get_data(); | 951 | 102 | const auto* vec_from_data = vec_from.data(); | 952 | 102 | auto& vec_to = col_to->get_data(); | 953 | 102 | auto* vec_to_data = vec_to.data(); | 954 | | | 955 | 102 | using MaxFieldType = | 956 | 102 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 957 | 102 | (std::is_same_v<ToFieldType, Decimal128V3> || | 958 | 102 | std::is_same_v<FromFieldType, Decimal128V3>), | 959 | 102 | Decimal128V3, | 960 | 102 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 961 | 102 | FromFieldType, ToFieldType>>; | 962 | 102 | using MaxNativeType = typename MaxFieldType::NativeType; | 963 | | | 964 | 102 | constexpr UInt32 to_max_digits = | 965 | 102 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 966 | 102 | bool multiply_may_overflow = false; | 967 | 102 | if (to_scale > from_scale) { | 968 | 38 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 969 | 38 | } | 970 | | | 971 | 102 | typename ToFieldType::NativeType max_result = | 972 | 102 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 973 | 102 | typename ToFieldType::NativeType min_result = -max_result; | 974 | | | 975 | 102 | MaxNativeType multiplier {}; | 976 | 102 | if (from_scale < to_scale) { | 977 | 38 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 978 | 38 | from_scale); | 979 | 64 | } else if (from_scale > to_scale) { | 980 | 64 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 981 | 64 | to_scale); | 982 | 64 | } | 983 | 102 | RETURN_IF_ERROR(std::visit( | 984 | 102 | [&](auto multiply_may_overflow, auto narrow_integral) { | 985 | 102 | for (size_t i = 0; i < size; i++) { | 986 | 102 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 987 | 102 | multiply_may_overflow, narrow_integral>( | 988 | 102 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 989 | 102 | to_precision, to_scale, min_result, max_result, multiplier, | 990 | 102 | params)) { | 991 | 102 | if (set_nullable) { | 992 | 102 | null_map_data[i] = 1; | 993 | 102 | } else { | 994 | 102 | return params.status; | 995 | 102 | } | 996 | 102 | } | 997 | 102 | } | 998 | 102 | return Status::OK(); | 999 | 102 | }, | 1000 | 102 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1001 | 102 | if (narrow_integral) { | 1002 | 28 | block.get_by_position(result).column = | 1003 | 28 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1004 | 74 | } else { | 1005 | 74 | block.get_by_position(result).column = std::move(col_to); | 1006 | 74 | } | 1007 | 102 | return Status::OK(); | 1008 | 102 | } |
|
1009 | | }; |
1010 | | |
1011 | | // cast between decimalv3 types |
1012 | | template <CastModeType CastMode, typename FromDataType, typename ToDataType> |
1013 | | requires(IsDataTypeDecimalV3<ToDataType> && IsDataTypeDecimalV3<FromDataType>) |
1014 | | class CastToImpl<CastMode, FromDataType, ToDataType> : public CastToBase { |
1015 | | public: |
1016 | | Status execute_impl(FunctionContext* context, Block& block, const ColumnNumbers& arguments, |
1017 | | uint32_t result, size_t input_rows_count, |
1018 | 4.27k | const NullMap::value_type* null_map = nullptr) const override { |
1019 | 4.27k | using FromFieldType = typename FromDataType::FieldType; |
1020 | 4.27k | using ToFieldType = typename ToDataType::FieldType; |
1021 | 4.27k | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); |
1022 | 4.27k | const auto* col_from = |
1023 | 4.27k | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); |
1024 | 4.27k | if (!col_from) { |
1025 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", |
1026 | 0 | named_from.column->get_name()); |
1027 | 0 | } |
1028 | | |
1029 | 4.27k | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); |
1030 | 4.27k | UInt32 from_precision = from_decimal_type.get_precision(); |
1031 | 4.27k | UInt32 from_scale = from_decimal_type.get_scale(); |
1032 | | |
1033 | 4.27k | const ColumnWithTypeAndName& named_to = block.get_by_position(result); |
1034 | 4.27k | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); |
1035 | 4.27k | UInt32 to_precision = to_decimal_type.get_precision(); |
1036 | 4.27k | ToDataType::check_type_precision(to_precision); |
1037 | 4.27k | UInt32 to_scale = to_decimal_type.get_scale(); |
1038 | 4.27k | ToDataType::check_type_scale(to_scale); |
1039 | | |
1040 | 4.27k | auto from_max_int_digit_count = from_precision - from_scale; |
1041 | 4.27k | auto to_max_int_digit_count = to_precision - to_scale; |
1042 | 4.27k | bool narrow_integral = |
1043 | 4.27k | (to_max_int_digit_count < from_max_int_digit_count) || |
1044 | 4.27k | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); |
1045 | | // only in non-strict mode and may overflow, we set nullable |
1046 | 4.27k | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; |
1047 | | |
1048 | 4.27k | size_t size = col_from->size(); |
1049 | 4.27k | ColumnUInt8::MutablePtr col_null_map_to; |
1050 | 4.27k | NullMap::value_type* null_map_data = nullptr; |
1051 | 4.27k | if (narrow_integral) { |
1052 | 3.10k | col_null_map_to = ColumnUInt8::create(size, 0); |
1053 | 3.10k | null_map_data = col_null_map_to->get_data().data(); |
1054 | 3.10k | } |
1055 | 4.27k | CastParameters params; |
1056 | 4.27k | params.is_strict = (CastMode == CastModeType::StrictMode); |
1057 | 4.27k | auto col_to = ToDataType::ColumnType::create(size, to_scale); |
1058 | 4.27k | const auto& vec_from = col_from->get_data(); |
1059 | 4.27k | const auto* vec_from_data = vec_from.data(); |
1060 | 4.27k | auto& vec_to = col_to->get_data(); |
1061 | 4.27k | auto* vec_to_data = vec_to.data(); |
1062 | | |
1063 | 4.27k | using MaxFieldType = |
1064 | 4.27k | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && |
1065 | 4.27k | (std::is_same_v<ToFieldType, Decimal128V3> || |
1066 | 4.27k | std::is_same_v<FromFieldType, Decimal128V3>), |
1067 | 4.27k | Decimal128V3, |
1068 | 4.27k | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), |
1069 | 4.27k | FromFieldType, ToFieldType>>; |
1070 | 4.27k | using MaxNativeType = typename MaxFieldType::NativeType; |
1071 | | |
1072 | 4.27k | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); |
1073 | 4.27k | bool multiply_may_overflow = false; |
1074 | 4.27k | if (to_scale > from_scale) { |
1075 | 1.95k | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; |
1076 | 1.95k | } |
1077 | | |
1078 | 4.27k | typename ToFieldType::NativeType max_result = |
1079 | 4.27k | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); |
1080 | 4.27k | typename ToFieldType::NativeType min_result = -max_result; |
1081 | | |
1082 | 4.27k | MaxNativeType multiplier {}; |
1083 | 4.27k | if (from_scale < to_scale) { |
1084 | 1.95k | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - |
1085 | 1.95k | from_scale); |
1086 | 2.31k | } else if (from_scale > to_scale) { |
1087 | 1.51k | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - |
1088 | 1.51k | to_scale); |
1089 | 1.51k | } |
1090 | 4.27k | RETURN_IF_ERROR(std::visit( |
1091 | 4.27k | [&](auto multiply_may_overflow, auto narrow_integral) { |
1092 | 4.27k | for (size_t i = 0; i < size; i++) { |
1093 | 4.27k | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, |
1094 | 4.27k | multiply_may_overflow, narrow_integral>( |
1095 | 4.27k | vec_from_data[i], from_precision, from_scale, vec_to_data[i], |
1096 | 4.27k | to_precision, to_scale, min_result, max_result, multiplier, |
1097 | 4.27k | params)) { |
1098 | 4.27k | if (set_nullable) { |
1099 | 4.27k | null_map_data[i] = 1; |
1100 | 4.27k | } else { |
1101 | 4.27k | return params.status; |
1102 | 4.27k | } |
1103 | 4.27k | } |
1104 | 4.27k | } |
1105 | 4.27k | return Status::OK(); |
1106 | 4.27k | }, |
1107 | 4.27k | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); |
1108 | 2.77k | if (narrow_integral) { |
1109 | 1.60k | block.get_by_position(result).column = |
1110 | 1.60k | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); |
1111 | 1.60k | } else { |
1112 | 1.17k | block.get_by_position(result).column = std::move(col_to); |
1113 | 1.17k | } |
1114 | 2.77k | return Status::OK(); |
1115 | 4.27k | } _ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEES4_E12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 1018 | 53 | const NullMap::value_type* null_map = nullptr) const override { | 1019 | 53 | using FromFieldType = typename FromDataType::FieldType; | 1020 | 53 | using ToFieldType = typename ToDataType::FieldType; | 1021 | 53 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 1022 | 53 | const auto* col_from = | 1023 | 53 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 1024 | 53 | if (!col_from) { | 1025 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 1026 | 0 | named_from.column->get_name()); | 1027 | 0 | } | 1028 | | | 1029 | 53 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 1030 | 53 | UInt32 from_precision = from_decimal_type.get_precision(); | 1031 | 53 | UInt32 from_scale = from_decimal_type.get_scale(); | 1032 | | | 1033 | 53 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 1034 | 53 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 1035 | 53 | UInt32 to_precision = to_decimal_type.get_precision(); | 1036 | 53 | ToDataType::check_type_precision(to_precision); | 1037 | 53 | UInt32 to_scale = to_decimal_type.get_scale(); | 1038 | 53 | ToDataType::check_type_scale(to_scale); | 1039 | | | 1040 | 53 | auto from_max_int_digit_count = from_precision - from_scale; | 1041 | 53 | auto to_max_int_digit_count = to_precision - to_scale; | 1042 | 53 | bool narrow_integral = | 1043 | 53 | (to_max_int_digit_count < from_max_int_digit_count) || | 1044 | 53 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1045 | | // only in non-strict mode and may overflow, we set nullable | 1046 | 53 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1047 | | | 1048 | 53 | size_t size = col_from->size(); | 1049 | 53 | ColumnUInt8::MutablePtr col_null_map_to; | 1050 | 53 | NullMap::value_type* null_map_data = nullptr; | 1051 | 53 | if (narrow_integral) { | 1052 | 53 | col_null_map_to = ColumnUInt8::create(size, 0); | 1053 | 53 | null_map_data = col_null_map_to->get_data().data(); | 1054 | 53 | } | 1055 | 53 | CastParameters params; | 1056 | 53 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1057 | 53 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1058 | 53 | const auto& vec_from = col_from->get_data(); | 1059 | 53 | const auto* vec_from_data = vec_from.data(); | 1060 | 53 | auto& vec_to = col_to->get_data(); | 1061 | 53 | auto* vec_to_data = vec_to.data(); | 1062 | | | 1063 | 53 | using MaxFieldType = | 1064 | 53 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1065 | 53 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1066 | 53 | std::is_same_v<FromFieldType, Decimal128V3>), | 1067 | 53 | Decimal128V3, | 1068 | 53 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1069 | 53 | FromFieldType, ToFieldType>>; | 1070 | 53 | using MaxNativeType = typename MaxFieldType::NativeType; | 1071 | | | 1072 | 53 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1073 | 53 | bool multiply_may_overflow = false; | 1074 | 53 | if (to_scale > from_scale) { | 1075 | 27 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1076 | 27 | } | 1077 | | | 1078 | 53 | typename ToFieldType::NativeType max_result = | 1079 | 53 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1080 | 53 | typename ToFieldType::NativeType min_result = -max_result; | 1081 | | | 1082 | 53 | MaxNativeType multiplier {}; | 1083 | 53 | if (from_scale < to_scale) { | 1084 | 27 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1085 | 27 | from_scale); | 1086 | 27 | } else if (from_scale > to_scale) { | 1087 | 20 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1088 | 20 | to_scale); | 1089 | 20 | } | 1090 | 53 | RETURN_IF_ERROR(std::visit( | 1091 | 53 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1092 | 53 | for (size_t i = 0; i < size; i++) { | 1093 | 53 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1094 | 53 | multiply_may_overflow, narrow_integral>( | 1095 | 53 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1096 | 53 | to_precision, to_scale, min_result, max_result, multiplier, | 1097 | 53 | params)) { | 1098 | 53 | if (set_nullable) { | 1099 | 53 | null_map_data[i] = 1; | 1100 | 53 | } else { | 1101 | 53 | return params.status; | 1102 | 53 | } | 1103 | 53 | } | 1104 | 53 | } | 1105 | 53 | return Status::OK(); | 1106 | 53 | }, | 1107 | 53 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1108 | 0 | if (narrow_integral) { | 1109 | 0 | block.get_by_position(result).column = | 1110 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1111 | 0 | } else { | 1112 | 0 | block.get_by_position(result).column = std::move(col_to); | 1113 | 0 | } | 1114 | 0 | return Status::OK(); | 1115 | 53 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEES4_E12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 1018 | 75 | const NullMap::value_type* null_map = nullptr) const override { | 1019 | 75 | using FromFieldType = typename FromDataType::FieldType; | 1020 | 75 | using ToFieldType = typename ToDataType::FieldType; | 1021 | 75 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 1022 | 75 | const auto* col_from = | 1023 | 75 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 1024 | 75 | if (!col_from) { | 1025 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 1026 | 0 | named_from.column->get_name()); | 1027 | 0 | } | 1028 | | | 1029 | 75 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 1030 | 75 | UInt32 from_precision = from_decimal_type.get_precision(); | 1031 | 75 | UInt32 from_scale = from_decimal_type.get_scale(); | 1032 | | | 1033 | 75 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 1034 | 75 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 1035 | 75 | UInt32 to_precision = to_decimal_type.get_precision(); | 1036 | 75 | ToDataType::check_type_precision(to_precision); | 1037 | 75 | UInt32 to_scale = to_decimal_type.get_scale(); | 1038 | 75 | ToDataType::check_type_scale(to_scale); | 1039 | | | 1040 | 75 | auto from_max_int_digit_count = from_precision - from_scale; | 1041 | 75 | auto to_max_int_digit_count = to_precision - to_scale; | 1042 | 75 | bool narrow_integral = | 1043 | 75 | (to_max_int_digit_count < from_max_int_digit_count) || | 1044 | 75 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1045 | | // only in non-strict mode and may overflow, we set nullable | 1046 | 75 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1047 | | | 1048 | 75 | size_t size = col_from->size(); | 1049 | 75 | ColumnUInt8::MutablePtr col_null_map_to; | 1050 | 75 | NullMap::value_type* null_map_data = nullptr; | 1051 | 75 | if (narrow_integral) { | 1052 | 45 | col_null_map_to = ColumnUInt8::create(size, 0); | 1053 | 45 | null_map_data = col_null_map_to->get_data().data(); | 1054 | 45 | } | 1055 | 75 | CastParameters params; | 1056 | 75 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1057 | 75 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1058 | 75 | const auto& vec_from = col_from->get_data(); | 1059 | 75 | const auto* vec_from_data = vec_from.data(); | 1060 | 75 | auto& vec_to = col_to->get_data(); | 1061 | 75 | auto* vec_to_data = vec_to.data(); | 1062 | | | 1063 | 75 | using MaxFieldType = | 1064 | 75 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1065 | 75 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1066 | 75 | std::is_same_v<FromFieldType, Decimal128V3>), | 1067 | 75 | Decimal128V3, | 1068 | 75 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1069 | 75 | FromFieldType, ToFieldType>>; | 1070 | 75 | using MaxNativeType = typename MaxFieldType::NativeType; | 1071 | | | 1072 | 75 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1073 | 75 | bool multiply_may_overflow = false; | 1074 | 75 | if (to_scale > from_scale) { | 1075 | 35 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1076 | 35 | } | 1077 | | | 1078 | 75 | typename ToFieldType::NativeType max_result = | 1079 | 75 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1080 | 75 | typename ToFieldType::NativeType min_result = -max_result; | 1081 | | | 1082 | 75 | MaxNativeType multiplier {}; | 1083 | 75 | if (from_scale < to_scale) { | 1084 | 35 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1085 | 35 | from_scale); | 1086 | 40 | } else if (from_scale > to_scale) { | 1087 | 30 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1088 | 30 | to_scale); | 1089 | 30 | } | 1090 | 75 | RETURN_IF_ERROR(std::visit( | 1091 | 75 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1092 | 75 | for (size_t i = 0; i < size; i++) { | 1093 | 75 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1094 | 75 | multiply_may_overflow, narrow_integral>( | 1095 | 75 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1096 | 75 | to_precision, to_scale, min_result, max_result, multiplier, | 1097 | 75 | params)) { | 1098 | 75 | if (set_nullable) { | 1099 | 75 | null_map_data[i] = 1; | 1100 | 75 | } else { | 1101 | 75 | return params.status; | 1102 | 75 | } | 1103 | 75 | } | 1104 | 75 | } | 1105 | 75 | return Status::OK(); | 1106 | 75 | }, | 1107 | 75 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1108 | 75 | if (narrow_integral) { | 1109 | 45 | block.get_by_position(result).column = | 1110 | 45 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1111 | 45 | } else { | 1112 | 30 | block.get_by_position(result).column = std::move(col_to); | 1113 | 30 | } | 1114 | 75 | return Status::OK(); | 1115 | 75 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEENS2_ILS3_28EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 1018 | 129 | const NullMap::value_type* null_map = nullptr) const override { | 1019 | 129 | using FromFieldType = typename FromDataType::FieldType; | 1020 | 129 | using ToFieldType = typename ToDataType::FieldType; | 1021 | 129 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 1022 | 129 | const auto* col_from = | 1023 | 129 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 1024 | 129 | if (!col_from) { | 1025 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 1026 | 0 | named_from.column->get_name()); | 1027 | 0 | } | 1028 | | | 1029 | 129 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 1030 | 129 | UInt32 from_precision = from_decimal_type.get_precision(); | 1031 | 129 | UInt32 from_scale = from_decimal_type.get_scale(); | 1032 | | | 1033 | 129 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 1034 | 129 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 1035 | 129 | UInt32 to_precision = to_decimal_type.get_precision(); | 1036 | 129 | ToDataType::check_type_precision(to_precision); | 1037 | 129 | UInt32 to_scale = to_decimal_type.get_scale(); | 1038 | 129 | ToDataType::check_type_scale(to_scale); | 1039 | | | 1040 | 129 | auto from_max_int_digit_count = from_precision - from_scale; | 1041 | 129 | auto to_max_int_digit_count = to_precision - to_scale; | 1042 | 129 | bool narrow_integral = | 1043 | 129 | (to_max_int_digit_count < from_max_int_digit_count) || | 1044 | 129 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1045 | | // only in non-strict mode and may overflow, we set nullable | 1046 | 129 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1047 | | | 1048 | 129 | size_t size = col_from->size(); | 1049 | 129 | ColumnUInt8::MutablePtr col_null_map_to; | 1050 | 129 | NullMap::value_type* null_map_data = nullptr; | 1051 | 129 | if (narrow_integral) { | 1052 | 129 | col_null_map_to = ColumnUInt8::create(size, 0); | 1053 | 129 | null_map_data = col_null_map_to->get_data().data(); | 1054 | 129 | } | 1055 | 129 | CastParameters params; | 1056 | 129 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1057 | 129 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1058 | 129 | const auto& vec_from = col_from->get_data(); | 1059 | 129 | const auto* vec_from_data = vec_from.data(); | 1060 | 129 | auto& vec_to = col_to->get_data(); | 1061 | 129 | auto* vec_to_data = vec_to.data(); | 1062 | | | 1063 | 129 | using MaxFieldType = | 1064 | 129 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1065 | 129 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1066 | 129 | std::is_same_v<FromFieldType, Decimal128V3>), | 1067 | 129 | Decimal128V3, | 1068 | 129 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1069 | 129 | FromFieldType, ToFieldType>>; | 1070 | 129 | using MaxNativeType = typename MaxFieldType::NativeType; | 1071 | | | 1072 | 129 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1073 | 129 | bool multiply_may_overflow = false; | 1074 | 129 | if (to_scale > from_scale) { | 1075 | 36 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1076 | 36 | } | 1077 | | | 1078 | 129 | typename ToFieldType::NativeType max_result = | 1079 | 129 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1080 | 129 | typename ToFieldType::NativeType min_result = -max_result; | 1081 | | | 1082 | 129 | MaxNativeType multiplier {}; | 1083 | 129 | if (from_scale < to_scale) { | 1084 | 36 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1085 | 36 | from_scale); | 1086 | 93 | } else if (from_scale > to_scale) { | 1087 | 66 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1088 | 66 | to_scale); | 1089 | 66 | } | 1090 | 129 | RETURN_IF_ERROR(std::visit( | 1091 | 129 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1092 | 129 | for (size_t i = 0; i < size; i++) { | 1093 | 129 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1094 | 129 | multiply_may_overflow, narrow_integral>( | 1095 | 129 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1096 | 129 | to_precision, to_scale, min_result, max_result, multiplier, | 1097 | 129 | params)) { | 1098 | 129 | if (set_nullable) { | 1099 | 129 | null_map_data[i] = 1; | 1100 | 129 | } else { | 1101 | 129 | return params.status; | 1102 | 129 | } | 1103 | 129 | } | 1104 | 129 | } | 1105 | 129 | return Status::OK(); | 1106 | 129 | }, | 1107 | 129 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1108 | 0 | if (narrow_integral) { | 1109 | 0 | block.get_by_position(result).column = | 1110 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1111 | 0 | } else { | 1112 | 0 | block.get_by_position(result).column = std::move(col_to); | 1113 | 0 | } | 1114 | 0 | return Status::OK(); | 1115 | 129 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEENS2_ILS3_28EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 1018 | 156 | const NullMap::value_type* null_map = nullptr) const override { | 1019 | 156 | using FromFieldType = typename FromDataType::FieldType; | 1020 | 156 | using ToFieldType = typename ToDataType::FieldType; | 1021 | 156 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 1022 | 156 | const auto* col_from = | 1023 | 156 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 1024 | 156 | if (!col_from) { | 1025 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 1026 | 0 | named_from.column->get_name()); | 1027 | 0 | } | 1028 | | | 1029 | 156 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 1030 | 156 | UInt32 from_precision = from_decimal_type.get_precision(); | 1031 | 156 | UInt32 from_scale = from_decimal_type.get_scale(); | 1032 | | | 1033 | 156 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 1034 | 156 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 1035 | 156 | UInt32 to_precision = to_decimal_type.get_precision(); | 1036 | 156 | ToDataType::check_type_precision(to_precision); | 1037 | 156 | UInt32 to_scale = to_decimal_type.get_scale(); | 1038 | 156 | ToDataType::check_type_scale(to_scale); | 1039 | | | 1040 | 156 | auto from_max_int_digit_count = from_precision - from_scale; | 1041 | 156 | auto to_max_int_digit_count = to_precision - to_scale; | 1042 | 156 | bool narrow_integral = | 1043 | 156 | (to_max_int_digit_count < from_max_int_digit_count) || | 1044 | 156 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1045 | | // only in non-strict mode and may overflow, we set nullable | 1046 | 156 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1047 | | | 1048 | 156 | size_t size = col_from->size(); | 1049 | 156 | ColumnUInt8::MutablePtr col_null_map_to; | 1050 | 156 | NullMap::value_type* null_map_data = nullptr; | 1051 | 156 | if (narrow_integral) { | 1052 | 136 | col_null_map_to = ColumnUInt8::create(size, 0); | 1053 | 136 | null_map_data = col_null_map_to->get_data().data(); | 1054 | 136 | } | 1055 | 156 | CastParameters params; | 1056 | 156 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1057 | 156 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1058 | 156 | const auto& vec_from = col_from->get_data(); | 1059 | 156 | const auto* vec_from_data = vec_from.data(); | 1060 | 156 | auto& vec_to = col_to->get_data(); | 1061 | 156 | auto* vec_to_data = vec_to.data(); | 1062 | | | 1063 | 156 | using MaxFieldType = | 1064 | 156 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1065 | 156 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1066 | 156 | std::is_same_v<FromFieldType, Decimal128V3>), | 1067 | 156 | Decimal128V3, | 1068 | 156 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1069 | 156 | FromFieldType, ToFieldType>>; | 1070 | 156 | using MaxNativeType = typename MaxFieldType::NativeType; | 1071 | | | 1072 | 156 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1073 | 156 | bool multiply_may_overflow = false; | 1074 | 156 | if (to_scale > from_scale) { | 1075 | 42 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1076 | 42 | } | 1077 | | | 1078 | 156 | typename ToFieldType::NativeType max_result = | 1079 | 156 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1080 | 156 | typename ToFieldType::NativeType min_result = -max_result; | 1081 | | | 1082 | 156 | MaxNativeType multiplier {}; | 1083 | 156 | if (from_scale < to_scale) { | 1084 | 42 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1085 | 42 | from_scale); | 1086 | 114 | } else if (from_scale > to_scale) { | 1087 | 72 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1088 | 72 | to_scale); | 1089 | 72 | } | 1090 | 156 | RETURN_IF_ERROR(std::visit( | 1091 | 156 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1092 | 156 | for (size_t i = 0; i < size; i++) { | 1093 | 156 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1094 | 156 | multiply_may_overflow, narrow_integral>( | 1095 | 156 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1096 | 156 | to_precision, to_scale, min_result, max_result, multiplier, | 1097 | 156 | params)) { | 1098 | 156 | if (set_nullable) { | 1099 | 156 | null_map_data[i] = 1; | 1100 | 156 | } else { | 1101 | 156 | return params.status; | 1102 | 156 | } | 1103 | 156 | } | 1104 | 156 | } | 1105 | 156 | return Status::OK(); | 1106 | 156 | }, | 1107 | 156 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1108 | 156 | if (narrow_integral) { | 1109 | 136 | block.get_by_position(result).column = | 1110 | 136 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1111 | 136 | } else { | 1112 | 20 | block.get_by_position(result).column = std::move(col_to); | 1113 | 20 | } | 1114 | 156 | return Status::OK(); | 1115 | 156 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEENS2_ILS3_28EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 1018 | 140 | const NullMap::value_type* null_map = nullptr) const override { | 1019 | 140 | using FromFieldType = typename FromDataType::FieldType; | 1020 | 140 | using ToFieldType = typename ToDataType::FieldType; | 1021 | 140 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 1022 | 140 | const auto* col_from = | 1023 | 140 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 1024 | 140 | if (!col_from) { | 1025 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 1026 | 0 | named_from.column->get_name()); | 1027 | 0 | } | 1028 | | | 1029 | 140 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 1030 | 140 | UInt32 from_precision = from_decimal_type.get_precision(); | 1031 | 140 | UInt32 from_scale = from_decimal_type.get_scale(); | 1032 | | | 1033 | 140 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 1034 | 140 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 1035 | 140 | UInt32 to_precision = to_decimal_type.get_precision(); | 1036 | 140 | ToDataType::check_type_precision(to_precision); | 1037 | 140 | UInt32 to_scale = to_decimal_type.get_scale(); | 1038 | 140 | ToDataType::check_type_scale(to_scale); | 1039 | | | 1040 | 140 | auto from_max_int_digit_count = from_precision - from_scale; | 1041 | 140 | auto to_max_int_digit_count = to_precision - to_scale; | 1042 | 140 | bool narrow_integral = | 1043 | 140 | (to_max_int_digit_count < from_max_int_digit_count) || | 1044 | 140 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1045 | | // only in non-strict mode and may overflow, we set nullable | 1046 | 140 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1047 | | | 1048 | 140 | size_t size = col_from->size(); | 1049 | 140 | ColumnUInt8::MutablePtr col_null_map_to; | 1050 | 140 | NullMap::value_type* null_map_data = nullptr; | 1051 | 140 | if (narrow_integral) { | 1052 | 140 | col_null_map_to = ColumnUInt8::create(size, 0); | 1053 | 140 | null_map_data = col_null_map_to->get_data().data(); | 1054 | 140 | } | 1055 | 140 | CastParameters params; | 1056 | 140 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1057 | 140 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1058 | 140 | const auto& vec_from = col_from->get_data(); | 1059 | 140 | const auto* vec_from_data = vec_from.data(); | 1060 | 140 | auto& vec_to = col_to->get_data(); | 1061 | 140 | auto* vec_to_data = vec_to.data(); | 1062 | | | 1063 | 140 | using MaxFieldType = | 1064 | 140 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1065 | 140 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1066 | 140 | std::is_same_v<FromFieldType, Decimal128V3>), | 1067 | 140 | Decimal128V3, | 1068 | 140 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1069 | 140 | FromFieldType, ToFieldType>>; | 1070 | 140 | using MaxNativeType = typename MaxFieldType::NativeType; | 1071 | | | 1072 | 140 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1073 | 140 | bool multiply_may_overflow = false; | 1074 | 140 | if (to_scale > from_scale) { | 1075 | 36 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1076 | 36 | } | 1077 | | | 1078 | 140 | typename ToFieldType::NativeType max_result = | 1079 | 140 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1080 | 140 | typename ToFieldType::NativeType min_result = -max_result; | 1081 | | | 1082 | 140 | MaxNativeType multiplier {}; | 1083 | 140 | if (from_scale < to_scale) { | 1084 | 36 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1085 | 36 | from_scale); | 1086 | 104 | } else if (from_scale > to_scale) { | 1087 | 80 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1088 | 80 | to_scale); | 1089 | 80 | } | 1090 | 140 | RETURN_IF_ERROR(std::visit( | 1091 | 140 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1092 | 140 | for (size_t i = 0; i < size; i++) { | 1093 | 140 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1094 | 140 | multiply_may_overflow, narrow_integral>( | 1095 | 140 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1096 | 140 | to_precision, to_scale, min_result, max_result, multiplier, | 1097 | 140 | params)) { | 1098 | 140 | if (set_nullable) { | 1099 | 140 | null_map_data[i] = 1; | 1100 | 140 | } else { | 1101 | 140 | return params.status; | 1102 | 140 | } | 1103 | 140 | } | 1104 | 140 | } | 1105 | 140 | return Status::OK(); | 1106 | 140 | }, | 1107 | 140 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1108 | 0 | if (narrow_integral) { | 1109 | 0 | block.get_by_position(result).column = | 1110 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1111 | 0 | } else { | 1112 | 0 | block.get_by_position(result).column = std::move(col_to); | 1113 | 0 | } | 1114 | 0 | return Status::OK(); | 1115 | 140 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEENS2_ILS3_28EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 1018 | 156 | const NullMap::value_type* null_map = nullptr) const override { | 1019 | 156 | using FromFieldType = typename FromDataType::FieldType; | 1020 | 156 | using ToFieldType = typename ToDataType::FieldType; | 1021 | 156 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 1022 | 156 | const auto* col_from = | 1023 | 156 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 1024 | 156 | if (!col_from) { | 1025 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 1026 | 0 | named_from.column->get_name()); | 1027 | 0 | } | 1028 | | | 1029 | 156 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 1030 | 156 | UInt32 from_precision = from_decimal_type.get_precision(); | 1031 | 156 | UInt32 from_scale = from_decimal_type.get_scale(); | 1032 | | | 1033 | 156 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 1034 | 156 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 1035 | 156 | UInt32 to_precision = to_decimal_type.get_precision(); | 1036 | 156 | ToDataType::check_type_precision(to_precision); | 1037 | 156 | UInt32 to_scale = to_decimal_type.get_scale(); | 1038 | 156 | ToDataType::check_type_scale(to_scale); | 1039 | | | 1040 | 156 | auto from_max_int_digit_count = from_precision - from_scale; | 1041 | 156 | auto to_max_int_digit_count = to_precision - to_scale; | 1042 | 156 | bool narrow_integral = | 1043 | 156 | (to_max_int_digit_count < from_max_int_digit_count) || | 1044 | 156 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1045 | | // only in non-strict mode and may overflow, we set nullable | 1046 | 156 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1047 | | | 1048 | 156 | size_t size = col_from->size(); | 1049 | 156 | ColumnUInt8::MutablePtr col_null_map_to; | 1050 | 156 | NullMap::value_type* null_map_data = nullptr; | 1051 | 156 | if (narrow_integral) { | 1052 | 136 | col_null_map_to = ColumnUInt8::create(size, 0); | 1053 | 136 | null_map_data = col_null_map_to->get_data().data(); | 1054 | 136 | } | 1055 | 156 | CastParameters params; | 1056 | 156 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1057 | 156 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1058 | 156 | const auto& vec_from = col_from->get_data(); | 1059 | 156 | const auto* vec_from_data = vec_from.data(); | 1060 | 156 | auto& vec_to = col_to->get_data(); | 1061 | 156 | auto* vec_to_data = vec_to.data(); | 1062 | | | 1063 | 156 | using MaxFieldType = | 1064 | 156 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1065 | 156 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1066 | 156 | std::is_same_v<FromFieldType, Decimal128V3>), | 1067 | 156 | Decimal128V3, | 1068 | 156 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1069 | 156 | FromFieldType, ToFieldType>>; | 1070 | 156 | using MaxNativeType = typename MaxFieldType::NativeType; | 1071 | | | 1072 | 156 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1073 | 156 | bool multiply_may_overflow = false; | 1074 | 156 | if (to_scale > from_scale) { | 1075 | 42 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1076 | 42 | } | 1077 | | | 1078 | 156 | typename ToFieldType::NativeType max_result = | 1079 | 156 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1080 | 156 | typename ToFieldType::NativeType min_result = -max_result; | 1081 | | | 1082 | 156 | MaxNativeType multiplier {}; | 1083 | 156 | if (from_scale < to_scale) { | 1084 | 42 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1085 | 42 | from_scale); | 1086 | 114 | } else if (from_scale > to_scale) { | 1087 | 74 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1088 | 74 | to_scale); | 1089 | 74 | } | 1090 | 156 | RETURN_IF_ERROR(std::visit( | 1091 | 156 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1092 | 156 | for (size_t i = 0; i < size; i++) { | 1093 | 156 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1094 | 156 | multiply_may_overflow, narrow_integral>( | 1095 | 156 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1096 | 156 | to_precision, to_scale, min_result, max_result, multiplier, | 1097 | 156 | params)) { | 1098 | 156 | if (set_nullable) { | 1099 | 156 | null_map_data[i] = 1; | 1100 | 156 | } else { | 1101 | 156 | return params.status; | 1102 | 156 | } | 1103 | 156 | } | 1104 | 156 | } | 1105 | 156 | return Status::OK(); | 1106 | 156 | }, | 1107 | 156 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1108 | 156 | if (narrow_integral) { | 1109 | 136 | block.get_by_position(result).column = | 1110 | 136 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1111 | 136 | } else { | 1112 | 20 | block.get_by_position(result).column = std::move(col_to); | 1113 | 20 | } | 1114 | 156 | return Status::OK(); | 1115 | 156 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEENS2_ILS3_28EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 1018 | 140 | const NullMap::value_type* null_map = nullptr) const override { | 1019 | 140 | using FromFieldType = typename FromDataType::FieldType; | 1020 | 140 | using ToFieldType = typename ToDataType::FieldType; | 1021 | 140 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 1022 | 140 | const auto* col_from = | 1023 | 140 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 1024 | 140 | if (!col_from) { | 1025 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 1026 | 0 | named_from.column->get_name()); | 1027 | 0 | } | 1028 | | | 1029 | 140 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 1030 | 140 | UInt32 from_precision = from_decimal_type.get_precision(); | 1031 | 140 | UInt32 from_scale = from_decimal_type.get_scale(); | 1032 | | | 1033 | 140 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 1034 | 140 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 1035 | 140 | UInt32 to_precision = to_decimal_type.get_precision(); | 1036 | 140 | ToDataType::check_type_precision(to_precision); | 1037 | 140 | UInt32 to_scale = to_decimal_type.get_scale(); | 1038 | 140 | ToDataType::check_type_scale(to_scale); | 1039 | | | 1040 | 140 | auto from_max_int_digit_count = from_precision - from_scale; | 1041 | 140 | auto to_max_int_digit_count = to_precision - to_scale; | 1042 | 140 | bool narrow_integral = | 1043 | 140 | (to_max_int_digit_count < from_max_int_digit_count) || | 1044 | 140 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1045 | | // only in non-strict mode and may overflow, we set nullable | 1046 | 140 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1047 | | | 1048 | 140 | size_t size = col_from->size(); | 1049 | 140 | ColumnUInt8::MutablePtr col_null_map_to; | 1050 | 140 | NullMap::value_type* null_map_data = nullptr; | 1051 | 140 | if (narrow_integral) { | 1052 | 140 | col_null_map_to = ColumnUInt8::create(size, 0); | 1053 | 140 | null_map_data = col_null_map_to->get_data().data(); | 1054 | 140 | } | 1055 | 140 | CastParameters params; | 1056 | 140 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1057 | 140 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1058 | 140 | const auto& vec_from = col_from->get_data(); | 1059 | 140 | const auto* vec_from_data = vec_from.data(); | 1060 | 140 | auto& vec_to = col_to->get_data(); | 1061 | 140 | auto* vec_to_data = vec_to.data(); | 1062 | | | 1063 | 140 | using MaxFieldType = | 1064 | 140 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1065 | 140 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1066 | 140 | std::is_same_v<FromFieldType, Decimal128V3>), | 1067 | 140 | Decimal128V3, | 1068 | 140 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1069 | 140 | FromFieldType, ToFieldType>>; | 1070 | 140 | using MaxNativeType = typename MaxFieldType::NativeType; | 1071 | | | 1072 | 140 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1073 | 140 | bool multiply_may_overflow = false; | 1074 | 140 | if (to_scale > from_scale) { | 1075 | 36 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1076 | 36 | } | 1077 | | | 1078 | 140 | typename ToFieldType::NativeType max_result = | 1079 | 140 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1080 | 140 | typename ToFieldType::NativeType min_result = -max_result; | 1081 | | | 1082 | 140 | MaxNativeType multiplier {}; | 1083 | 140 | if (from_scale < to_scale) { | 1084 | 36 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1085 | 36 | from_scale); | 1086 | 104 | } else if (from_scale > to_scale) { | 1087 | 80 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1088 | 80 | to_scale); | 1089 | 80 | } | 1090 | 140 | RETURN_IF_ERROR(std::visit( | 1091 | 140 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1092 | 140 | for (size_t i = 0; i < size; i++) { | 1093 | 140 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1094 | 140 | multiply_may_overflow, narrow_integral>( | 1095 | 140 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1096 | 140 | to_precision, to_scale, min_result, max_result, multiplier, | 1097 | 140 | params)) { | 1098 | 140 | if (set_nullable) { | 1099 | 140 | null_map_data[i] = 1; | 1100 | 140 | } else { | 1101 | 140 | return params.status; | 1102 | 140 | } | 1103 | 140 | } | 1104 | 140 | } | 1105 | 140 | return Status::OK(); | 1106 | 140 | }, | 1107 | 140 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1108 | 0 | if (narrow_integral) { | 1109 | 0 | block.get_by_position(result).column = | 1110 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1111 | 0 | } else { | 1112 | 0 | block.get_by_position(result).column = std::move(col_to); | 1113 | 0 | } | 1114 | 0 | return Status::OK(); | 1115 | 140 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEENS2_ILS3_28EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 1018 | 156 | const NullMap::value_type* null_map = nullptr) const override { | 1019 | 156 | using FromFieldType = typename FromDataType::FieldType; | 1020 | 156 | using ToFieldType = typename ToDataType::FieldType; | 1021 | 156 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 1022 | 156 | const auto* col_from = | 1023 | 156 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 1024 | 156 | if (!col_from) { | 1025 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 1026 | 0 | named_from.column->get_name()); | 1027 | 0 | } | 1028 | | | 1029 | 156 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 1030 | 156 | UInt32 from_precision = from_decimal_type.get_precision(); | 1031 | 156 | UInt32 from_scale = from_decimal_type.get_scale(); | 1032 | | | 1033 | 156 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 1034 | 156 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 1035 | 156 | UInt32 to_precision = to_decimal_type.get_precision(); | 1036 | 156 | ToDataType::check_type_precision(to_precision); | 1037 | 156 | UInt32 to_scale = to_decimal_type.get_scale(); | 1038 | 156 | ToDataType::check_type_scale(to_scale); | 1039 | | | 1040 | 156 | auto from_max_int_digit_count = from_precision - from_scale; | 1041 | 156 | auto to_max_int_digit_count = to_precision - to_scale; | 1042 | 156 | bool narrow_integral = | 1043 | 156 | (to_max_int_digit_count < from_max_int_digit_count) || | 1044 | 156 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1045 | | // only in non-strict mode and may overflow, we set nullable | 1046 | 156 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1047 | | | 1048 | 156 | size_t size = col_from->size(); | 1049 | 156 | ColumnUInt8::MutablePtr col_null_map_to; | 1050 | 156 | NullMap::value_type* null_map_data = nullptr; | 1051 | 156 | if (narrow_integral) { | 1052 | 136 | col_null_map_to = ColumnUInt8::create(size, 0); | 1053 | 136 | null_map_data = col_null_map_to->get_data().data(); | 1054 | 136 | } | 1055 | 156 | CastParameters params; | 1056 | 156 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1057 | 156 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1058 | 156 | const auto& vec_from = col_from->get_data(); | 1059 | 156 | const auto* vec_from_data = vec_from.data(); | 1060 | 156 | auto& vec_to = col_to->get_data(); | 1061 | 156 | auto* vec_to_data = vec_to.data(); | 1062 | | | 1063 | 156 | using MaxFieldType = | 1064 | 156 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1065 | 156 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1066 | 156 | std::is_same_v<FromFieldType, Decimal128V3>), | 1067 | 156 | Decimal128V3, | 1068 | 156 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1069 | 156 | FromFieldType, ToFieldType>>; | 1070 | 156 | using MaxNativeType = typename MaxFieldType::NativeType; | 1071 | | | 1072 | 156 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1073 | 156 | bool multiply_may_overflow = false; | 1074 | 156 | if (to_scale > from_scale) { | 1075 | 42 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1076 | 42 | } | 1077 | | | 1078 | 156 | typename ToFieldType::NativeType max_result = | 1079 | 156 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1080 | 156 | typename ToFieldType::NativeType min_result = -max_result; | 1081 | | | 1082 | 156 | MaxNativeType multiplier {}; | 1083 | 156 | if (from_scale < to_scale) { | 1084 | 42 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1085 | 42 | from_scale); | 1086 | 114 | } else if (from_scale > to_scale) { | 1087 | 74 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1088 | 74 | to_scale); | 1089 | 74 | } | 1090 | 156 | RETURN_IF_ERROR(std::visit( | 1091 | 156 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1092 | 156 | for (size_t i = 0; i < size; i++) { | 1093 | 156 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1094 | 156 | multiply_may_overflow, narrow_integral>( | 1095 | 156 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1096 | 156 | to_precision, to_scale, min_result, max_result, multiplier, | 1097 | 156 | params)) { | 1098 | 156 | if (set_nullable) { | 1099 | 156 | null_map_data[i] = 1; | 1100 | 156 | } else { | 1101 | 156 | return params.status; | 1102 | 156 | } | 1103 | 156 | } | 1104 | 156 | } | 1105 | 156 | return Status::OK(); | 1106 | 156 | }, | 1107 | 156 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1108 | 156 | if (narrow_integral) { | 1109 | 136 | block.get_by_position(result).column = | 1110 | 136 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1111 | 136 | } else { | 1112 | 20 | block.get_by_position(result).column = std::move(col_to); | 1113 | 20 | } | 1114 | 156 | return Status::OK(); | 1115 | 156 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEENS2_ILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 1018 | 36 | const NullMap::value_type* null_map = nullptr) const override { | 1019 | 36 | using FromFieldType = typename FromDataType::FieldType; | 1020 | 36 | using ToFieldType = typename ToDataType::FieldType; | 1021 | 36 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 1022 | 36 | const auto* col_from = | 1023 | 36 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 1024 | 36 | if (!col_from) { | 1025 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 1026 | 0 | named_from.column->get_name()); | 1027 | 0 | } | 1028 | | | 1029 | 36 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 1030 | 36 | UInt32 from_precision = from_decimal_type.get_precision(); | 1031 | 36 | UInt32 from_scale = from_decimal_type.get_scale(); | 1032 | | | 1033 | 36 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 1034 | 36 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 1035 | 36 | UInt32 to_precision = to_decimal_type.get_precision(); | 1036 | 36 | ToDataType::check_type_precision(to_precision); | 1037 | 36 | UInt32 to_scale = to_decimal_type.get_scale(); | 1038 | 36 | ToDataType::check_type_scale(to_scale); | 1039 | | | 1040 | 36 | auto from_max_int_digit_count = from_precision - from_scale; | 1041 | 36 | auto to_max_int_digit_count = to_precision - to_scale; | 1042 | 36 | bool narrow_integral = | 1043 | 36 | (to_max_int_digit_count < from_max_int_digit_count) || | 1044 | 36 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1045 | | // only in non-strict mode and may overflow, we set nullable | 1046 | 36 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1047 | | | 1048 | 36 | size_t size = col_from->size(); | 1049 | 36 | ColumnUInt8::MutablePtr col_null_map_to; | 1050 | 36 | NullMap::value_type* null_map_data = nullptr; | 1051 | 36 | if (narrow_integral) { | 1052 | 36 | col_null_map_to = ColumnUInt8::create(size, 0); | 1053 | 36 | null_map_data = col_null_map_to->get_data().data(); | 1054 | 36 | } | 1055 | 36 | CastParameters params; | 1056 | 36 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1057 | 36 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1058 | 36 | const auto& vec_from = col_from->get_data(); | 1059 | 36 | const auto* vec_from_data = vec_from.data(); | 1060 | 36 | auto& vec_to = col_to->get_data(); | 1061 | 36 | auto* vec_to_data = vec_to.data(); | 1062 | | | 1063 | 36 | using MaxFieldType = | 1064 | 36 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1065 | 36 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1066 | 36 | std::is_same_v<FromFieldType, Decimal128V3>), | 1067 | 36 | Decimal128V3, | 1068 | 36 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1069 | 36 | FromFieldType, ToFieldType>>; | 1070 | 36 | using MaxNativeType = typename MaxFieldType::NativeType; | 1071 | | | 1072 | 36 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1073 | 36 | bool multiply_may_overflow = false; | 1074 | 36 | if (to_scale > from_scale) { | 1075 | 36 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1076 | 36 | } | 1077 | | | 1078 | 36 | typename ToFieldType::NativeType max_result = | 1079 | 36 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1080 | 36 | typename ToFieldType::NativeType min_result = -max_result; | 1081 | | | 1082 | 36 | MaxNativeType multiplier {}; | 1083 | 36 | if (from_scale < to_scale) { | 1084 | 36 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1085 | 36 | from_scale); | 1086 | 36 | } else if (from_scale > to_scale) { | 1087 | 0 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1088 | 0 | to_scale); | 1089 | 0 | } | 1090 | 36 | RETURN_IF_ERROR(std::visit( | 1091 | 36 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1092 | 36 | for (size_t i = 0; i < size; i++) { | 1093 | 36 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1094 | 36 | multiply_may_overflow, narrow_integral>( | 1095 | 36 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1096 | 36 | to_precision, to_scale, min_result, max_result, multiplier, | 1097 | 36 | params)) { | 1098 | 36 | if (set_nullable) { | 1099 | 36 | null_map_data[i] = 1; | 1100 | 36 | } else { | 1101 | 36 | return params.status; | 1102 | 36 | } | 1103 | 36 | } | 1104 | 36 | } | 1105 | 36 | return Status::OK(); | 1106 | 36 | }, | 1107 | 36 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1108 | 0 | if (narrow_integral) { | 1109 | 0 | block.get_by_position(result).column = | 1110 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1111 | 0 | } else { | 1112 | 0 | block.get_by_position(result).column = std::move(col_to); | 1113 | 0 | } | 1114 | 0 | return Status::OK(); | 1115 | 36 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEENS2_ILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 1018 | 132 | const NullMap::value_type* null_map = nullptr) const override { | 1019 | 132 | using FromFieldType = typename FromDataType::FieldType; | 1020 | 132 | using ToFieldType = typename ToDataType::FieldType; | 1021 | 132 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 1022 | 132 | const auto* col_from = | 1023 | 132 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 1024 | 132 | if (!col_from) { | 1025 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 1026 | 0 | named_from.column->get_name()); | 1027 | 0 | } | 1028 | | | 1029 | 132 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 1030 | 132 | UInt32 from_precision = from_decimal_type.get_precision(); | 1031 | 132 | UInt32 from_scale = from_decimal_type.get_scale(); | 1032 | | | 1033 | 132 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 1034 | 132 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 1035 | 132 | UInt32 to_precision = to_decimal_type.get_precision(); | 1036 | 132 | ToDataType::check_type_precision(to_precision); | 1037 | 132 | UInt32 to_scale = to_decimal_type.get_scale(); | 1038 | 132 | ToDataType::check_type_scale(to_scale); | 1039 | | | 1040 | 132 | auto from_max_int_digit_count = from_precision - from_scale; | 1041 | 132 | auto to_max_int_digit_count = to_precision - to_scale; | 1042 | 132 | bool narrow_integral = | 1043 | 132 | (to_max_int_digit_count < from_max_int_digit_count) || | 1044 | 132 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1045 | | // only in non-strict mode and may overflow, we set nullable | 1046 | 132 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1047 | | | 1048 | 132 | size_t size = col_from->size(); | 1049 | 132 | ColumnUInt8::MutablePtr col_null_map_to; | 1050 | 132 | NullMap::value_type* null_map_data = nullptr; | 1051 | 132 | if (narrow_integral) { | 1052 | 32 | col_null_map_to = ColumnUInt8::create(size, 0); | 1053 | 32 | null_map_data = col_null_map_to->get_data().data(); | 1054 | 32 | } | 1055 | 132 | CastParameters params; | 1056 | 132 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1057 | 132 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1058 | 132 | const auto& vec_from = col_from->get_data(); | 1059 | 132 | const auto* vec_from_data = vec_from.data(); | 1060 | 132 | auto& vec_to = col_to->get_data(); | 1061 | 132 | auto* vec_to_data = vec_to.data(); | 1062 | | | 1063 | 132 | using MaxFieldType = | 1064 | 132 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1065 | 132 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1066 | 132 | std::is_same_v<FromFieldType, Decimal128V3>), | 1067 | 132 | Decimal128V3, | 1068 | 132 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1069 | 132 | FromFieldType, ToFieldType>>; | 1070 | 132 | using MaxNativeType = typename MaxFieldType::NativeType; | 1071 | | | 1072 | 132 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1073 | 132 | bool multiply_may_overflow = false; | 1074 | 132 | if (to_scale > from_scale) { | 1075 | 69 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1076 | 69 | } | 1077 | | | 1078 | 132 | typename ToFieldType::NativeType max_result = | 1079 | 132 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1080 | 132 | typename ToFieldType::NativeType min_result = -max_result; | 1081 | | | 1082 | 132 | MaxNativeType multiplier {}; | 1083 | 132 | if (from_scale < to_scale) { | 1084 | 69 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1085 | 69 | from_scale); | 1086 | 69 | } else if (from_scale > to_scale) { | 1087 | 30 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1088 | 30 | to_scale); | 1089 | 30 | } | 1090 | 132 | RETURN_IF_ERROR(std::visit( | 1091 | 132 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1092 | 132 | for (size_t i = 0; i < size; i++) { | 1093 | 132 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1094 | 132 | multiply_may_overflow, narrow_integral>( | 1095 | 132 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1096 | 132 | to_precision, to_scale, min_result, max_result, multiplier, | 1097 | 132 | params)) { | 1098 | 132 | if (set_nullable) { | 1099 | 132 | null_map_data[i] = 1; | 1100 | 132 | } else { | 1101 | 132 | return params.status; | 1102 | 132 | } | 1103 | 132 | } | 1104 | 132 | } | 1105 | 132 | return Status::OK(); | 1106 | 132 | }, | 1107 | 132 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1108 | 132 | if (narrow_integral) { | 1109 | 32 | block.get_by_position(result).column = | 1110 | 32 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1111 | 100 | } else { | 1112 | 100 | block.get_by_position(result).column = std::move(col_to); | 1113 | 100 | } | 1114 | 132 | return Status::OK(); | 1115 | 132 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEES4_E12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 1018 | 92 | const NullMap::value_type* null_map = nullptr) const override { | 1019 | 92 | using FromFieldType = typename FromDataType::FieldType; | 1020 | 92 | using ToFieldType = typename ToDataType::FieldType; | 1021 | 92 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 1022 | 92 | const auto* col_from = | 1023 | 92 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 1024 | 92 | if (!col_from) { | 1025 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 1026 | 0 | named_from.column->get_name()); | 1027 | 0 | } | 1028 | | | 1029 | 92 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 1030 | 92 | UInt32 from_precision = from_decimal_type.get_precision(); | 1031 | 92 | UInt32 from_scale = from_decimal_type.get_scale(); | 1032 | | | 1033 | 92 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 1034 | 92 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 1035 | 92 | UInt32 to_precision = to_decimal_type.get_precision(); | 1036 | 92 | ToDataType::check_type_precision(to_precision); | 1037 | 92 | UInt32 to_scale = to_decimal_type.get_scale(); | 1038 | 92 | ToDataType::check_type_scale(to_scale); | 1039 | | | 1040 | 92 | auto from_max_int_digit_count = from_precision - from_scale; | 1041 | 92 | auto to_max_int_digit_count = to_precision - to_scale; | 1042 | 92 | bool narrow_integral = | 1043 | 92 | (to_max_int_digit_count < from_max_int_digit_count) || | 1044 | 92 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1045 | | // only in non-strict mode and may overflow, we set nullable | 1046 | 92 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1047 | | | 1048 | 92 | size_t size = col_from->size(); | 1049 | 92 | ColumnUInt8::MutablePtr col_null_map_to; | 1050 | 92 | NullMap::value_type* null_map_data = nullptr; | 1051 | 92 | if (narrow_integral) { | 1052 | 92 | col_null_map_to = ColumnUInt8::create(size, 0); | 1053 | 92 | null_map_data = col_null_map_to->get_data().data(); | 1054 | 92 | } | 1055 | 92 | CastParameters params; | 1056 | 92 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1057 | 92 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1058 | 92 | const auto& vec_from = col_from->get_data(); | 1059 | 92 | const auto* vec_from_data = vec_from.data(); | 1060 | 92 | auto& vec_to = col_to->get_data(); | 1061 | 92 | auto* vec_to_data = vec_to.data(); | 1062 | | | 1063 | 92 | using MaxFieldType = | 1064 | 92 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1065 | 92 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1066 | 92 | std::is_same_v<FromFieldType, Decimal128V3>), | 1067 | 92 | Decimal128V3, | 1068 | 92 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1069 | 92 | FromFieldType, ToFieldType>>; | 1070 | 92 | using MaxNativeType = typename MaxFieldType::NativeType; | 1071 | | | 1072 | 92 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1073 | 92 | bool multiply_may_overflow = false; | 1074 | 92 | if (to_scale > from_scale) { | 1075 | 66 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1076 | 66 | } | 1077 | | | 1078 | 92 | typename ToFieldType::NativeType max_result = | 1079 | 92 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1080 | 92 | typename ToFieldType::NativeType min_result = -max_result; | 1081 | | | 1082 | 92 | MaxNativeType multiplier {}; | 1083 | 92 | if (from_scale < to_scale) { | 1084 | 66 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1085 | 66 | from_scale); | 1086 | 66 | } else if (from_scale > to_scale) { | 1087 | 20 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1088 | 20 | to_scale); | 1089 | 20 | } | 1090 | 92 | RETURN_IF_ERROR(std::visit( | 1091 | 92 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1092 | 92 | for (size_t i = 0; i < size; i++) { | 1093 | 92 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1094 | 92 | multiply_may_overflow, narrow_integral>( | 1095 | 92 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1096 | 92 | to_precision, to_scale, min_result, max_result, multiplier, | 1097 | 92 | params)) { | 1098 | 92 | if (set_nullable) { | 1099 | 92 | null_map_data[i] = 1; | 1100 | 92 | } else { | 1101 | 92 | return params.status; | 1102 | 92 | } | 1103 | 92 | } | 1104 | 92 | } | 1105 | 92 | return Status::OK(); | 1106 | 92 | }, | 1107 | 92 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1108 | 0 | if (narrow_integral) { | 1109 | 0 | block.get_by_position(result).column = | 1110 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1111 | 0 | } else { | 1112 | 0 | block.get_by_position(result).column = std::move(col_to); | 1113 | 0 | } | 1114 | 0 | return Status::OK(); | 1115 | 92 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEES4_E12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 1018 | 180 | const NullMap::value_type* null_map = nullptr) const override { | 1019 | 180 | using FromFieldType = typename FromDataType::FieldType; | 1020 | 180 | using ToFieldType = typename ToDataType::FieldType; | 1021 | 180 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 1022 | 180 | const auto* col_from = | 1023 | 180 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 1024 | 180 | if (!col_from) { | 1025 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 1026 | 0 | named_from.column->get_name()); | 1027 | 0 | } | 1028 | | | 1029 | 180 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 1030 | 180 | UInt32 from_precision = from_decimal_type.get_precision(); | 1031 | 180 | UInt32 from_scale = from_decimal_type.get_scale(); | 1032 | | | 1033 | 180 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 1034 | 180 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 1035 | 180 | UInt32 to_precision = to_decimal_type.get_precision(); | 1036 | 180 | ToDataType::check_type_precision(to_precision); | 1037 | 180 | UInt32 to_scale = to_decimal_type.get_scale(); | 1038 | 180 | ToDataType::check_type_scale(to_scale); | 1039 | | | 1040 | 180 | auto from_max_int_digit_count = from_precision - from_scale; | 1041 | 180 | auto to_max_int_digit_count = to_precision - to_scale; | 1042 | 180 | bool narrow_integral = | 1043 | 180 | (to_max_int_digit_count < from_max_int_digit_count) || | 1044 | 180 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1045 | | // only in non-strict mode and may overflow, we set nullable | 1046 | 180 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1047 | | | 1048 | 180 | size_t size = col_from->size(); | 1049 | 180 | ColumnUInt8::MutablePtr col_null_map_to; | 1050 | 180 | NullMap::value_type* null_map_data = nullptr; | 1051 | 180 | if (narrow_integral) { | 1052 | 104 | col_null_map_to = ColumnUInt8::create(size, 0); | 1053 | 104 | null_map_data = col_null_map_to->get_data().data(); | 1054 | 104 | } | 1055 | 180 | CastParameters params; | 1056 | 180 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1057 | 180 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1058 | 180 | const auto& vec_from = col_from->get_data(); | 1059 | 180 | const auto* vec_from_data = vec_from.data(); | 1060 | 180 | auto& vec_to = col_to->get_data(); | 1061 | 180 | auto* vec_to_data = vec_to.data(); | 1062 | | | 1063 | 180 | using MaxFieldType = | 1064 | 180 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1065 | 180 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1066 | 180 | std::is_same_v<FromFieldType, Decimal128V3>), | 1067 | 180 | Decimal128V3, | 1068 | 180 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1069 | 180 | FromFieldType, ToFieldType>>; | 1070 | 180 | using MaxNativeType = typename MaxFieldType::NativeType; | 1071 | | | 1072 | 180 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1073 | 180 | bool multiply_may_overflow = false; | 1074 | 180 | if (to_scale > from_scale) { | 1075 | 86 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1076 | 86 | } | 1077 | | | 1078 | 180 | typename ToFieldType::NativeType max_result = | 1079 | 180 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1080 | 180 | typename ToFieldType::NativeType min_result = -max_result; | 1081 | | | 1082 | 180 | MaxNativeType multiplier {}; | 1083 | 180 | if (from_scale < to_scale) { | 1084 | 86 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1085 | 86 | from_scale); | 1086 | 94 | } else if (from_scale > to_scale) { | 1087 | 68 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1088 | 68 | to_scale); | 1089 | 68 | } | 1090 | 180 | RETURN_IF_ERROR(std::visit( | 1091 | 180 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1092 | 180 | for (size_t i = 0; i < size; i++) { | 1093 | 180 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1094 | 180 | multiply_may_overflow, narrow_integral>( | 1095 | 180 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1096 | 180 | to_precision, to_scale, min_result, max_result, multiplier, | 1097 | 180 | params)) { | 1098 | 180 | if (set_nullable) { | 1099 | 180 | null_map_data[i] = 1; | 1100 | 180 | } else { | 1101 | 180 | return params.status; | 1102 | 180 | } | 1103 | 180 | } | 1104 | 180 | } | 1105 | 180 | return Status::OK(); | 1106 | 180 | }, | 1107 | 180 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1108 | 180 | if (narrow_integral) { | 1109 | 104 | block.get_by_position(result).column = | 1110 | 104 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1111 | 104 | } else { | 1112 | 76 | block.get_by_position(result).column = std::move(col_to); | 1113 | 76 | } | 1114 | 180 | return Status::OK(); | 1115 | 180 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEENS2_ILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 1018 | 153 | const NullMap::value_type* null_map = nullptr) const override { | 1019 | 153 | using FromFieldType = typename FromDataType::FieldType; | 1020 | 153 | using ToFieldType = typename ToDataType::FieldType; | 1021 | 153 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 1022 | 153 | const auto* col_from = | 1023 | 153 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 1024 | 153 | if (!col_from) { | 1025 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 1026 | 0 | named_from.column->get_name()); | 1027 | 0 | } | 1028 | | | 1029 | 153 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 1030 | 153 | UInt32 from_precision = from_decimal_type.get_precision(); | 1031 | 153 | UInt32 from_scale = from_decimal_type.get_scale(); | 1032 | | | 1033 | 153 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 1034 | 153 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 1035 | 153 | UInt32 to_precision = to_decimal_type.get_precision(); | 1036 | 153 | ToDataType::check_type_precision(to_precision); | 1037 | 153 | UInt32 to_scale = to_decimal_type.get_scale(); | 1038 | 153 | ToDataType::check_type_scale(to_scale); | 1039 | | | 1040 | 153 | auto from_max_int_digit_count = from_precision - from_scale; | 1041 | 153 | auto to_max_int_digit_count = to_precision - to_scale; | 1042 | 153 | bool narrow_integral = | 1043 | 153 | (to_max_int_digit_count < from_max_int_digit_count) || | 1044 | 153 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1045 | | // only in non-strict mode and may overflow, we set nullable | 1046 | 153 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1047 | | | 1048 | 153 | size_t size = col_from->size(); | 1049 | 153 | ColumnUInt8::MutablePtr col_null_map_to; | 1050 | 153 | NullMap::value_type* null_map_data = nullptr; | 1051 | 153 | if (narrow_integral) { | 1052 | 153 | col_null_map_to = ColumnUInt8::create(size, 0); | 1053 | 153 | null_map_data = col_null_map_to->get_data().data(); | 1054 | 153 | } | 1055 | 153 | CastParameters params; | 1056 | 153 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1057 | 153 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1058 | 153 | const auto& vec_from = col_from->get_data(); | 1059 | 153 | const auto* vec_from_data = vec_from.data(); | 1060 | 153 | auto& vec_to = col_to->get_data(); | 1061 | 153 | auto* vec_to_data = vec_to.data(); | 1062 | | | 1063 | 153 | using MaxFieldType = | 1064 | 153 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1065 | 153 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1066 | 153 | std::is_same_v<FromFieldType, Decimal128V3>), | 1067 | 153 | Decimal128V3, | 1068 | 153 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1069 | 153 | FromFieldType, ToFieldType>>; | 1070 | 153 | using MaxNativeType = typename MaxFieldType::NativeType; | 1071 | | | 1072 | 153 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1073 | 153 | bool multiply_may_overflow = false; | 1074 | 153 | if (to_scale > from_scale) { | 1075 | 60 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1076 | 60 | } | 1077 | | | 1078 | 153 | typename ToFieldType::NativeType max_result = | 1079 | 153 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1080 | 153 | typename ToFieldType::NativeType min_result = -max_result; | 1081 | | | 1082 | 153 | MaxNativeType multiplier {}; | 1083 | 153 | if (from_scale < to_scale) { | 1084 | 60 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1085 | 60 | from_scale); | 1086 | 93 | } else if (from_scale > to_scale) { | 1087 | 66 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1088 | 66 | to_scale); | 1089 | 66 | } | 1090 | 153 | RETURN_IF_ERROR(std::visit( | 1091 | 153 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1092 | 153 | for (size_t i = 0; i < size; i++) { | 1093 | 153 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1094 | 153 | multiply_may_overflow, narrow_integral>( | 1095 | 153 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1096 | 153 | to_precision, to_scale, min_result, max_result, multiplier, | 1097 | 153 | params)) { | 1098 | 153 | if (set_nullable) { | 1099 | 153 | null_map_data[i] = 1; | 1100 | 153 | } else { | 1101 | 153 | return params.status; | 1102 | 153 | } | 1103 | 153 | } | 1104 | 153 | } | 1105 | 153 | return Status::OK(); | 1106 | 153 | }, | 1107 | 153 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1108 | 0 | if (narrow_integral) { | 1109 | 0 | block.get_by_position(result).column = | 1110 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1111 | 0 | } else { | 1112 | 0 | block.get_by_position(result).column = std::move(col_to); | 1113 | 0 | } | 1114 | 0 | return Status::OK(); | 1115 | 153 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEENS2_ILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 1018 | 228 | const NullMap::value_type* null_map = nullptr) const override { | 1019 | 228 | using FromFieldType = typename FromDataType::FieldType; | 1020 | 228 | using ToFieldType = typename ToDataType::FieldType; | 1021 | 228 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 1022 | 228 | const auto* col_from = | 1023 | 228 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 1024 | 228 | if (!col_from) { | 1025 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 1026 | 0 | named_from.column->get_name()); | 1027 | 0 | } | 1028 | | | 1029 | 228 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 1030 | 228 | UInt32 from_precision = from_decimal_type.get_precision(); | 1031 | 228 | UInt32 from_scale = from_decimal_type.get_scale(); | 1032 | | | 1033 | 228 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 1034 | 228 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 1035 | 228 | UInt32 to_precision = to_decimal_type.get_precision(); | 1036 | 228 | ToDataType::check_type_precision(to_precision); | 1037 | 228 | UInt32 to_scale = to_decimal_type.get_scale(); | 1038 | 228 | ToDataType::check_type_scale(to_scale); | 1039 | | | 1040 | 228 | auto from_max_int_digit_count = from_precision - from_scale; | 1041 | 228 | auto to_max_int_digit_count = to_precision - to_scale; | 1042 | 228 | bool narrow_integral = | 1043 | 228 | (to_max_int_digit_count < from_max_int_digit_count) || | 1044 | 228 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1045 | | // only in non-strict mode and may overflow, we set nullable | 1046 | 228 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1047 | | | 1048 | 228 | size_t size = col_from->size(); | 1049 | 228 | ColumnUInt8::MutablePtr col_null_map_to; | 1050 | 228 | NullMap::value_type* null_map_data = nullptr; | 1051 | 228 | if (narrow_integral) { | 1052 | 192 | col_null_map_to = ColumnUInt8::create(size, 0); | 1053 | 192 | null_map_data = col_null_map_to->get_data().data(); | 1054 | 192 | } | 1055 | 228 | CastParameters params; | 1056 | 228 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1057 | 228 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1058 | 228 | const auto& vec_from = col_from->get_data(); | 1059 | 228 | const auto* vec_from_data = vec_from.data(); | 1060 | 228 | auto& vec_to = col_to->get_data(); | 1061 | 228 | auto* vec_to_data = vec_to.data(); | 1062 | | | 1063 | 228 | using MaxFieldType = | 1064 | 228 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1065 | 228 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1066 | 228 | std::is_same_v<FromFieldType, Decimal128V3>), | 1067 | 228 | Decimal128V3, | 1068 | 228 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1069 | 228 | FromFieldType, ToFieldType>>; | 1070 | 228 | using MaxNativeType = typename MaxFieldType::NativeType; | 1071 | | | 1072 | 228 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1073 | 228 | bool multiply_may_overflow = false; | 1074 | 228 | if (to_scale > from_scale) { | 1075 | 76 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1076 | 76 | } | 1077 | | | 1078 | 228 | typename ToFieldType::NativeType max_result = | 1079 | 228 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1080 | 228 | typename ToFieldType::NativeType min_result = -max_result; | 1081 | | | 1082 | 228 | MaxNativeType multiplier {}; | 1083 | 228 | if (from_scale < to_scale) { | 1084 | 76 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1085 | 76 | from_scale); | 1086 | 152 | } else if (from_scale > to_scale) { | 1087 | 94 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1088 | 94 | to_scale); | 1089 | 94 | } | 1090 | 228 | RETURN_IF_ERROR(std::visit( | 1091 | 228 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1092 | 228 | for (size_t i = 0; i < size; i++) { | 1093 | 228 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1094 | 228 | multiply_may_overflow, narrow_integral>( | 1095 | 228 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1096 | 228 | to_precision, to_scale, min_result, max_result, multiplier, | 1097 | 228 | params)) { | 1098 | 228 | if (set_nullable) { | 1099 | 228 | null_map_data[i] = 1; | 1100 | 228 | } else { | 1101 | 228 | return params.status; | 1102 | 228 | } | 1103 | 228 | } | 1104 | 228 | } | 1105 | 228 | return Status::OK(); | 1106 | 228 | }, | 1107 | 228 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1108 | 228 | if (narrow_integral) { | 1109 | 192 | block.get_by_position(result).column = | 1110 | 192 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1111 | 192 | } else { | 1112 | 36 | block.get_by_position(result).column = std::move(col_to); | 1113 | 36 | } | 1114 | 228 | return Status::OK(); | 1115 | 228 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEENS2_ILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 1018 | 164 | const NullMap::value_type* null_map = nullptr) const override { | 1019 | 164 | using FromFieldType = typename FromDataType::FieldType; | 1020 | 164 | using ToFieldType = typename ToDataType::FieldType; | 1021 | 164 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 1022 | 164 | const auto* col_from = | 1023 | 164 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 1024 | 164 | if (!col_from) { | 1025 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 1026 | 0 | named_from.column->get_name()); | 1027 | 0 | } | 1028 | | | 1029 | 164 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 1030 | 164 | UInt32 from_precision = from_decimal_type.get_precision(); | 1031 | 164 | UInt32 from_scale = from_decimal_type.get_scale(); | 1032 | | | 1033 | 164 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 1034 | 164 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 1035 | 164 | UInt32 to_precision = to_decimal_type.get_precision(); | 1036 | 164 | ToDataType::check_type_precision(to_precision); | 1037 | 164 | UInt32 to_scale = to_decimal_type.get_scale(); | 1038 | 164 | ToDataType::check_type_scale(to_scale); | 1039 | | | 1040 | 164 | auto from_max_int_digit_count = from_precision - from_scale; | 1041 | 164 | auto to_max_int_digit_count = to_precision - to_scale; | 1042 | 164 | bool narrow_integral = | 1043 | 164 | (to_max_int_digit_count < from_max_int_digit_count) || | 1044 | 164 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1045 | | // only in non-strict mode and may overflow, we set nullable | 1046 | 164 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1047 | | | 1048 | 164 | size_t size = col_from->size(); | 1049 | 164 | ColumnUInt8::MutablePtr col_null_map_to; | 1050 | 164 | NullMap::value_type* null_map_data = nullptr; | 1051 | 164 | if (narrow_integral) { | 1052 | 164 | col_null_map_to = ColumnUInt8::create(size, 0); | 1053 | 164 | null_map_data = col_null_map_to->get_data().data(); | 1054 | 164 | } | 1055 | 164 | CastParameters params; | 1056 | 164 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1057 | 164 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1058 | 164 | const auto& vec_from = col_from->get_data(); | 1059 | 164 | const auto* vec_from_data = vec_from.data(); | 1060 | 164 | auto& vec_to = col_to->get_data(); | 1061 | 164 | auto* vec_to_data = vec_to.data(); | 1062 | | | 1063 | 164 | using MaxFieldType = | 1064 | 164 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1065 | 164 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1066 | 164 | std::is_same_v<FromFieldType, Decimal128V3>), | 1067 | 164 | Decimal128V3, | 1068 | 164 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1069 | 164 | FromFieldType, ToFieldType>>; | 1070 | 164 | using MaxNativeType = typename MaxFieldType::NativeType; | 1071 | | | 1072 | 164 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1073 | 164 | bool multiply_may_overflow = false; | 1074 | 164 | if (to_scale > from_scale) { | 1075 | 60 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1076 | 60 | } | 1077 | | | 1078 | 164 | typename ToFieldType::NativeType max_result = | 1079 | 164 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1080 | 164 | typename ToFieldType::NativeType min_result = -max_result; | 1081 | | | 1082 | 164 | MaxNativeType multiplier {}; | 1083 | 164 | if (from_scale < to_scale) { | 1084 | 60 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1085 | 60 | from_scale); | 1086 | 104 | } else if (from_scale > to_scale) { | 1087 | 80 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1088 | 80 | to_scale); | 1089 | 80 | } | 1090 | 164 | RETURN_IF_ERROR(std::visit( | 1091 | 164 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1092 | 164 | for (size_t i = 0; i < size; i++) { | 1093 | 164 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1094 | 164 | multiply_may_overflow, narrow_integral>( | 1095 | 164 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1096 | 164 | to_precision, to_scale, min_result, max_result, multiplier, | 1097 | 164 | params)) { | 1098 | 164 | if (set_nullable) { | 1099 | 164 | null_map_data[i] = 1; | 1100 | 164 | } else { | 1101 | 164 | return params.status; | 1102 | 164 | } | 1103 | 164 | } | 1104 | 164 | } | 1105 | 164 | return Status::OK(); | 1106 | 164 | }, | 1107 | 164 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1108 | 0 | if (narrow_integral) { | 1109 | 0 | block.get_by_position(result).column = | 1110 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1111 | 0 | } else { | 1112 | 0 | block.get_by_position(result).column = std::move(col_to); | 1113 | 0 | } | 1114 | 0 | return Status::OK(); | 1115 | 164 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEENS2_ILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 1018 | 228 | const NullMap::value_type* null_map = nullptr) const override { | 1019 | 228 | using FromFieldType = typename FromDataType::FieldType; | 1020 | 228 | using ToFieldType = typename ToDataType::FieldType; | 1021 | 228 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 1022 | 228 | const auto* col_from = | 1023 | 228 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 1024 | 228 | if (!col_from) { | 1025 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 1026 | 0 | named_from.column->get_name()); | 1027 | 0 | } | 1028 | | | 1029 | 228 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 1030 | 228 | UInt32 from_precision = from_decimal_type.get_precision(); | 1031 | 228 | UInt32 from_scale = from_decimal_type.get_scale(); | 1032 | | | 1033 | 228 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 1034 | 228 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 1035 | 228 | UInt32 to_precision = to_decimal_type.get_precision(); | 1036 | 228 | ToDataType::check_type_precision(to_precision); | 1037 | 228 | UInt32 to_scale = to_decimal_type.get_scale(); | 1038 | 228 | ToDataType::check_type_scale(to_scale); | 1039 | | | 1040 | 228 | auto from_max_int_digit_count = from_precision - from_scale; | 1041 | 228 | auto to_max_int_digit_count = to_precision - to_scale; | 1042 | 228 | bool narrow_integral = | 1043 | 228 | (to_max_int_digit_count < from_max_int_digit_count) || | 1044 | 228 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1045 | | // only in non-strict mode and may overflow, we set nullable | 1046 | 228 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1047 | | | 1048 | 228 | size_t size = col_from->size(); | 1049 | 228 | ColumnUInt8::MutablePtr col_null_map_to; | 1050 | 228 | NullMap::value_type* null_map_data = nullptr; | 1051 | 228 | if (narrow_integral) { | 1052 | 192 | col_null_map_to = ColumnUInt8::create(size, 0); | 1053 | 192 | null_map_data = col_null_map_to->get_data().data(); | 1054 | 192 | } | 1055 | 228 | CastParameters params; | 1056 | 228 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1057 | 228 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1058 | 228 | const auto& vec_from = col_from->get_data(); | 1059 | 228 | const auto* vec_from_data = vec_from.data(); | 1060 | 228 | auto& vec_to = col_to->get_data(); | 1061 | 228 | auto* vec_to_data = vec_to.data(); | 1062 | | | 1063 | 228 | using MaxFieldType = | 1064 | 228 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1065 | 228 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1066 | 228 | std::is_same_v<FromFieldType, Decimal128V3>), | 1067 | 228 | Decimal128V3, | 1068 | 228 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1069 | 228 | FromFieldType, ToFieldType>>; | 1070 | 228 | using MaxNativeType = typename MaxFieldType::NativeType; | 1071 | | | 1072 | 228 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1073 | 228 | bool multiply_may_overflow = false; | 1074 | 228 | if (to_scale > from_scale) { | 1075 | 76 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1076 | 76 | } | 1077 | | | 1078 | 228 | typename ToFieldType::NativeType max_result = | 1079 | 228 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1080 | 228 | typename ToFieldType::NativeType min_result = -max_result; | 1081 | | | 1082 | 228 | MaxNativeType multiplier {}; | 1083 | 228 | if (from_scale < to_scale) { | 1084 | 76 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1085 | 76 | from_scale); | 1086 | 152 | } else if (from_scale > to_scale) { | 1087 | 96 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1088 | 96 | to_scale); | 1089 | 96 | } | 1090 | 228 | RETURN_IF_ERROR(std::visit( | 1091 | 228 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1092 | 228 | for (size_t i = 0; i < size; i++) { | 1093 | 228 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1094 | 228 | multiply_may_overflow, narrow_integral>( | 1095 | 228 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1096 | 228 | to_precision, to_scale, min_result, max_result, multiplier, | 1097 | 228 | params)) { | 1098 | 228 | if (set_nullable) { | 1099 | 228 | null_map_data[i] = 1; | 1100 | 228 | } else { | 1101 | 228 | return params.status; | 1102 | 228 | } | 1103 | 228 | } | 1104 | 228 | } | 1105 | 228 | return Status::OK(); | 1106 | 228 | }, | 1107 | 228 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1108 | 228 | if (narrow_integral) { | 1109 | 192 | block.get_by_position(result).column = | 1110 | 192 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1111 | 192 | } else { | 1112 | 36 | block.get_by_position(result).column = std::move(col_to); | 1113 | 36 | } | 1114 | 228 | return Status::OK(); | 1115 | 228 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEENS2_ILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 1018 | 36 | const NullMap::value_type* null_map = nullptr) const override { | 1019 | 36 | using FromFieldType = typename FromDataType::FieldType; | 1020 | 36 | using ToFieldType = typename ToDataType::FieldType; | 1021 | 36 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 1022 | 36 | const auto* col_from = | 1023 | 36 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 1024 | 36 | if (!col_from) { | 1025 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 1026 | 0 | named_from.column->get_name()); | 1027 | 0 | } | 1028 | | | 1029 | 36 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 1030 | 36 | UInt32 from_precision = from_decimal_type.get_precision(); | 1031 | 36 | UInt32 from_scale = from_decimal_type.get_scale(); | 1032 | | | 1033 | 36 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 1034 | 36 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 1035 | 36 | UInt32 to_precision = to_decimal_type.get_precision(); | 1036 | 36 | ToDataType::check_type_precision(to_precision); | 1037 | 36 | UInt32 to_scale = to_decimal_type.get_scale(); | 1038 | 36 | ToDataType::check_type_scale(to_scale); | 1039 | | | 1040 | 36 | auto from_max_int_digit_count = from_precision - from_scale; | 1041 | 36 | auto to_max_int_digit_count = to_precision - to_scale; | 1042 | 36 | bool narrow_integral = | 1043 | 36 | (to_max_int_digit_count < from_max_int_digit_count) || | 1044 | 36 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1045 | | // only in non-strict mode and may overflow, we set nullable | 1046 | 36 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1047 | | | 1048 | 36 | size_t size = col_from->size(); | 1049 | 36 | ColumnUInt8::MutablePtr col_null_map_to; | 1050 | 36 | NullMap::value_type* null_map_data = nullptr; | 1051 | 36 | if (narrow_integral) { | 1052 | 36 | col_null_map_to = ColumnUInt8::create(size, 0); | 1053 | 36 | null_map_data = col_null_map_to->get_data().data(); | 1054 | 36 | } | 1055 | 36 | CastParameters params; | 1056 | 36 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1057 | 36 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1058 | 36 | const auto& vec_from = col_from->get_data(); | 1059 | 36 | const auto* vec_from_data = vec_from.data(); | 1060 | 36 | auto& vec_to = col_to->get_data(); | 1061 | 36 | auto* vec_to_data = vec_to.data(); | 1062 | | | 1063 | 36 | using MaxFieldType = | 1064 | 36 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1065 | 36 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1066 | 36 | std::is_same_v<FromFieldType, Decimal128V3>), | 1067 | 36 | Decimal128V3, | 1068 | 36 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1069 | 36 | FromFieldType, ToFieldType>>; | 1070 | 36 | using MaxNativeType = typename MaxFieldType::NativeType; | 1071 | | | 1072 | 36 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1073 | 36 | bool multiply_may_overflow = false; | 1074 | 36 | if (to_scale > from_scale) { | 1075 | 36 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1076 | 36 | } | 1077 | | | 1078 | 36 | typename ToFieldType::NativeType max_result = | 1079 | 36 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1080 | 36 | typename ToFieldType::NativeType min_result = -max_result; | 1081 | | | 1082 | 36 | MaxNativeType multiplier {}; | 1083 | 36 | if (from_scale < to_scale) { | 1084 | 36 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1085 | 36 | from_scale); | 1086 | 36 | } else if (from_scale > to_scale) { | 1087 | 0 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1088 | 0 | to_scale); | 1089 | 0 | } | 1090 | 36 | RETURN_IF_ERROR(std::visit( | 1091 | 36 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1092 | 36 | for (size_t i = 0; i < size; i++) { | 1093 | 36 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1094 | 36 | multiply_may_overflow, narrow_integral>( | 1095 | 36 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1096 | 36 | to_precision, to_scale, min_result, max_result, multiplier, | 1097 | 36 | params)) { | 1098 | 36 | if (set_nullable) { | 1099 | 36 | null_map_data[i] = 1; | 1100 | 36 | } else { | 1101 | 36 | return params.status; | 1102 | 36 | } | 1103 | 36 | } | 1104 | 36 | } | 1105 | 36 | return Status::OK(); | 1106 | 36 | }, | 1107 | 36 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1108 | 0 | if (narrow_integral) { | 1109 | 0 | block.get_by_position(result).column = | 1110 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1111 | 0 | } else { | 1112 | 0 | block.get_by_position(result).column = std::move(col_to); | 1113 | 0 | } | 1114 | 0 | return Status::OK(); | 1115 | 36 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEENS2_ILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 1018 | 132 | const NullMap::value_type* null_map = nullptr) const override { | 1019 | 132 | using FromFieldType = typename FromDataType::FieldType; | 1020 | 132 | using ToFieldType = typename ToDataType::FieldType; | 1021 | 132 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 1022 | 132 | const auto* col_from = | 1023 | 132 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 1024 | 132 | if (!col_from) { | 1025 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 1026 | 0 | named_from.column->get_name()); | 1027 | 0 | } | 1028 | | | 1029 | 132 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 1030 | 132 | UInt32 from_precision = from_decimal_type.get_precision(); | 1031 | 132 | UInt32 from_scale = from_decimal_type.get_scale(); | 1032 | | | 1033 | 132 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 1034 | 132 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 1035 | 132 | UInt32 to_precision = to_decimal_type.get_precision(); | 1036 | 132 | ToDataType::check_type_precision(to_precision); | 1037 | 132 | UInt32 to_scale = to_decimal_type.get_scale(); | 1038 | 132 | ToDataType::check_type_scale(to_scale); | 1039 | | | 1040 | 132 | auto from_max_int_digit_count = from_precision - from_scale; | 1041 | 132 | auto to_max_int_digit_count = to_precision - to_scale; | 1042 | 132 | bool narrow_integral = | 1043 | 132 | (to_max_int_digit_count < from_max_int_digit_count) || | 1044 | 132 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1045 | | // only in non-strict mode and may overflow, we set nullable | 1046 | 132 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1047 | | | 1048 | 132 | size_t size = col_from->size(); | 1049 | 132 | ColumnUInt8::MutablePtr col_null_map_to; | 1050 | 132 | NullMap::value_type* null_map_data = nullptr; | 1051 | 132 | if (narrow_integral) { | 1052 | 32 | col_null_map_to = ColumnUInt8::create(size, 0); | 1053 | 32 | null_map_data = col_null_map_to->get_data().data(); | 1054 | 32 | } | 1055 | 132 | CastParameters params; | 1056 | 132 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1057 | 132 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1058 | 132 | const auto& vec_from = col_from->get_data(); | 1059 | 132 | const auto* vec_from_data = vec_from.data(); | 1060 | 132 | auto& vec_to = col_to->get_data(); | 1061 | 132 | auto* vec_to_data = vec_to.data(); | 1062 | | | 1063 | 132 | using MaxFieldType = | 1064 | 132 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1065 | 132 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1066 | 132 | std::is_same_v<FromFieldType, Decimal128V3>), | 1067 | 132 | Decimal128V3, | 1068 | 132 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1069 | 132 | FromFieldType, ToFieldType>>; | 1070 | 132 | using MaxNativeType = typename MaxFieldType::NativeType; | 1071 | | | 1072 | 132 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1073 | 132 | bool multiply_may_overflow = false; | 1074 | 132 | if (to_scale > from_scale) { | 1075 | 70 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1076 | 70 | } | 1077 | | | 1078 | 132 | typename ToFieldType::NativeType max_result = | 1079 | 132 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1080 | 132 | typename ToFieldType::NativeType min_result = -max_result; | 1081 | | | 1082 | 132 | MaxNativeType multiplier {}; | 1083 | 132 | if (from_scale < to_scale) { | 1084 | 70 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1085 | 70 | from_scale); | 1086 | 70 | } else if (from_scale > to_scale) { | 1087 | 30 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1088 | 30 | to_scale); | 1089 | 30 | } | 1090 | 132 | RETURN_IF_ERROR(std::visit( | 1091 | 132 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1092 | 132 | for (size_t i = 0; i < size; i++) { | 1093 | 132 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1094 | 132 | multiply_may_overflow, narrow_integral>( | 1095 | 132 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1096 | 132 | to_precision, to_scale, min_result, max_result, multiplier, | 1097 | 132 | params)) { | 1098 | 132 | if (set_nullable) { | 1099 | 132 | null_map_data[i] = 1; | 1100 | 132 | } else { | 1101 | 132 | return params.status; | 1102 | 132 | } | 1103 | 132 | } | 1104 | 132 | } | 1105 | 132 | return Status::OK(); | 1106 | 132 | }, | 1107 | 132 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1108 | 132 | if (narrow_integral) { | 1109 | 32 | block.get_by_position(result).column = | 1110 | 32 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1111 | 100 | } else { | 1112 | 100 | block.get_by_position(result).column = std::move(col_to); | 1113 | 100 | } | 1114 | 132 | return Status::OK(); | 1115 | 132 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEENS2_ILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 1018 | 60 | const NullMap::value_type* null_map = nullptr) const override { | 1019 | 60 | using FromFieldType = typename FromDataType::FieldType; | 1020 | 60 | using ToFieldType = typename ToDataType::FieldType; | 1021 | 60 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 1022 | 60 | const auto* col_from = | 1023 | 60 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 1024 | 60 | if (!col_from) { | 1025 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 1026 | 0 | named_from.column->get_name()); | 1027 | 0 | } | 1028 | | | 1029 | 60 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 1030 | 60 | UInt32 from_precision = from_decimal_type.get_precision(); | 1031 | 60 | UInt32 from_scale = from_decimal_type.get_scale(); | 1032 | | | 1033 | 60 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 1034 | 60 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 1035 | 60 | UInt32 to_precision = to_decimal_type.get_precision(); | 1036 | 60 | ToDataType::check_type_precision(to_precision); | 1037 | 60 | UInt32 to_scale = to_decimal_type.get_scale(); | 1038 | 60 | ToDataType::check_type_scale(to_scale); | 1039 | | | 1040 | 60 | auto from_max_int_digit_count = from_precision - from_scale; | 1041 | 60 | auto to_max_int_digit_count = to_precision - to_scale; | 1042 | 60 | bool narrow_integral = | 1043 | 60 | (to_max_int_digit_count < from_max_int_digit_count) || | 1044 | 60 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1045 | | // only in non-strict mode and may overflow, we set nullable | 1046 | 60 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1047 | | | 1048 | 60 | size_t size = col_from->size(); | 1049 | 60 | ColumnUInt8::MutablePtr col_null_map_to; | 1050 | 60 | NullMap::value_type* null_map_data = nullptr; | 1051 | 60 | if (narrow_integral) { | 1052 | 60 | col_null_map_to = ColumnUInt8::create(size, 0); | 1053 | 60 | null_map_data = col_null_map_to->get_data().data(); | 1054 | 60 | } | 1055 | 60 | CastParameters params; | 1056 | 60 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1057 | 60 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1058 | 60 | const auto& vec_from = col_from->get_data(); | 1059 | 60 | const auto* vec_from_data = vec_from.data(); | 1060 | 60 | auto& vec_to = col_to->get_data(); | 1061 | 60 | auto* vec_to_data = vec_to.data(); | 1062 | | | 1063 | 60 | using MaxFieldType = | 1064 | 60 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1065 | 60 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1066 | 60 | std::is_same_v<FromFieldType, Decimal128V3>), | 1067 | 60 | Decimal128V3, | 1068 | 60 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1069 | 60 | FromFieldType, ToFieldType>>; | 1070 | 60 | using MaxNativeType = typename MaxFieldType::NativeType; | 1071 | | | 1072 | 60 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1073 | 60 | bool multiply_may_overflow = false; | 1074 | 60 | if (to_scale > from_scale) { | 1075 | 60 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1076 | 60 | } | 1077 | | | 1078 | 60 | typename ToFieldType::NativeType max_result = | 1079 | 60 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1080 | 60 | typename ToFieldType::NativeType min_result = -max_result; | 1081 | | | 1082 | 60 | MaxNativeType multiplier {}; | 1083 | 60 | if (from_scale < to_scale) { | 1084 | 60 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1085 | 60 | from_scale); | 1086 | 60 | } else if (from_scale > to_scale) { | 1087 | 0 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1088 | 0 | to_scale); | 1089 | 0 | } | 1090 | 60 | RETURN_IF_ERROR(std::visit( | 1091 | 60 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1092 | 60 | for (size_t i = 0; i < size; i++) { | 1093 | 60 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1094 | 60 | multiply_may_overflow, narrow_integral>( | 1095 | 60 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1096 | 60 | to_precision, to_scale, min_result, max_result, multiplier, | 1097 | 60 | params)) { | 1098 | 60 | if (set_nullable) { | 1099 | 60 | null_map_data[i] = 1; | 1100 | 60 | } else { | 1101 | 60 | return params.status; | 1102 | 60 | } | 1103 | 60 | } | 1104 | 60 | } | 1105 | 60 | return Status::OK(); | 1106 | 60 | }, | 1107 | 60 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1108 | 0 | if (narrow_integral) { | 1109 | 0 | block.get_by_position(result).column = | 1110 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1111 | 0 | } else { | 1112 | 0 | block.get_by_position(result).column = std::move(col_to); | 1113 | 0 | } | 1114 | 0 | return Status::OK(); | 1115 | 60 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEENS2_ILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 1018 | 204 | const NullMap::value_type* null_map = nullptr) const override { | 1019 | 204 | using FromFieldType = typename FromDataType::FieldType; | 1020 | 204 | using ToFieldType = typename ToDataType::FieldType; | 1021 | 204 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 1022 | 204 | const auto* col_from = | 1023 | 204 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 1024 | 204 | if (!col_from) { | 1025 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 1026 | 0 | named_from.column->get_name()); | 1027 | 0 | } | 1028 | | | 1029 | 204 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 1030 | 204 | UInt32 from_precision = from_decimal_type.get_precision(); | 1031 | 204 | UInt32 from_scale = from_decimal_type.get_scale(); | 1032 | | | 1033 | 204 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 1034 | 204 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 1035 | 204 | UInt32 to_precision = to_decimal_type.get_precision(); | 1036 | 204 | ToDataType::check_type_precision(to_precision); | 1037 | 204 | UInt32 to_scale = to_decimal_type.get_scale(); | 1038 | 204 | ToDataType::check_type_scale(to_scale); | 1039 | | | 1040 | 204 | auto from_max_int_digit_count = from_precision - from_scale; | 1041 | 204 | auto to_max_int_digit_count = to_precision - to_scale; | 1042 | 204 | bool narrow_integral = | 1043 | 204 | (to_max_int_digit_count < from_max_int_digit_count) || | 1044 | 204 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1045 | | // only in non-strict mode and may overflow, we set nullable | 1046 | 204 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1047 | | | 1048 | 204 | size_t size = col_from->size(); | 1049 | 204 | ColumnUInt8::MutablePtr col_null_map_to; | 1050 | 204 | NullMap::value_type* null_map_data = nullptr; | 1051 | 204 | if (narrow_integral) { | 1052 | 56 | col_null_map_to = ColumnUInt8::create(size, 0); | 1053 | 56 | null_map_data = col_null_map_to->get_data().data(); | 1054 | 56 | } | 1055 | 204 | CastParameters params; | 1056 | 204 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1057 | 204 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1058 | 204 | const auto& vec_from = col_from->get_data(); | 1059 | 204 | const auto* vec_from_data = vec_from.data(); | 1060 | 204 | auto& vec_to = col_to->get_data(); | 1061 | 204 | auto* vec_to_data = vec_to.data(); | 1062 | | | 1063 | 204 | using MaxFieldType = | 1064 | 204 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1065 | 204 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1066 | 204 | std::is_same_v<FromFieldType, Decimal128V3>), | 1067 | 204 | Decimal128V3, | 1068 | 204 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1069 | 204 | FromFieldType, ToFieldType>>; | 1070 | 204 | using MaxNativeType = typename MaxFieldType::NativeType; | 1071 | | | 1072 | 204 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1073 | 204 | bool multiply_may_overflow = false; | 1074 | 204 | if (to_scale > from_scale) { | 1075 | 99 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1076 | 99 | } | 1077 | | | 1078 | 204 | typename ToFieldType::NativeType max_result = | 1079 | 204 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1080 | 204 | typename ToFieldType::NativeType min_result = -max_result; | 1081 | | | 1082 | 204 | MaxNativeType multiplier {}; | 1083 | 204 | if (from_scale < to_scale) { | 1084 | 99 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1085 | 99 | from_scale); | 1086 | 105 | } else if (from_scale > to_scale) { | 1087 | 56 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1088 | 56 | to_scale); | 1089 | 56 | } | 1090 | 204 | RETURN_IF_ERROR(std::visit( | 1091 | 204 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1092 | 204 | for (size_t i = 0; i < size; i++) { | 1093 | 204 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1094 | 204 | multiply_may_overflow, narrow_integral>( | 1095 | 204 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1096 | 204 | to_precision, to_scale, min_result, max_result, multiplier, | 1097 | 204 | params)) { | 1098 | 204 | if (set_nullable) { | 1099 | 204 | null_map_data[i] = 1; | 1100 | 204 | } else { | 1101 | 204 | return params.status; | 1102 | 204 | } | 1103 | 204 | } | 1104 | 204 | } | 1105 | 204 | return Status::OK(); | 1106 | 204 | }, | 1107 | 204 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1108 | 204 | if (narrow_integral) { | 1109 | 56 | block.get_by_position(result).column = | 1110 | 56 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1111 | 148 | } else { | 1112 | 148 | block.get_by_position(result).column = std::move(col_to); | 1113 | 148 | } | 1114 | 204 | return Status::OK(); | 1115 | 204 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEES4_E12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 1018 | 92 | const NullMap::value_type* null_map = nullptr) const override { | 1019 | 92 | using FromFieldType = typename FromDataType::FieldType; | 1020 | 92 | using ToFieldType = typename ToDataType::FieldType; | 1021 | 92 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 1022 | 92 | const auto* col_from = | 1023 | 92 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 1024 | 92 | if (!col_from) { | 1025 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 1026 | 0 | named_from.column->get_name()); | 1027 | 0 | } | 1028 | | | 1029 | 92 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 1030 | 92 | UInt32 from_precision = from_decimal_type.get_precision(); | 1031 | 92 | UInt32 from_scale = from_decimal_type.get_scale(); | 1032 | | | 1033 | 92 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 1034 | 92 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 1035 | 92 | UInt32 to_precision = to_decimal_type.get_precision(); | 1036 | 92 | ToDataType::check_type_precision(to_precision); | 1037 | 92 | UInt32 to_scale = to_decimal_type.get_scale(); | 1038 | 92 | ToDataType::check_type_scale(to_scale); | 1039 | | | 1040 | 92 | auto from_max_int_digit_count = from_precision - from_scale; | 1041 | 92 | auto to_max_int_digit_count = to_precision - to_scale; | 1042 | 92 | bool narrow_integral = | 1043 | 92 | (to_max_int_digit_count < from_max_int_digit_count) || | 1044 | 92 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1045 | | // only in non-strict mode and may overflow, we set nullable | 1046 | 92 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1047 | | | 1048 | 92 | size_t size = col_from->size(); | 1049 | 92 | ColumnUInt8::MutablePtr col_null_map_to; | 1050 | 92 | NullMap::value_type* null_map_data = nullptr; | 1051 | 92 | if (narrow_integral) { | 1052 | 92 | col_null_map_to = ColumnUInt8::create(size, 0); | 1053 | 92 | null_map_data = col_null_map_to->get_data().data(); | 1054 | 92 | } | 1055 | 92 | CastParameters params; | 1056 | 92 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1057 | 92 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1058 | 92 | const auto& vec_from = col_from->get_data(); | 1059 | 92 | const auto* vec_from_data = vec_from.data(); | 1060 | 92 | auto& vec_to = col_to->get_data(); | 1061 | 92 | auto* vec_to_data = vec_to.data(); | 1062 | | | 1063 | 92 | using MaxFieldType = | 1064 | 92 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1065 | 92 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1066 | 92 | std::is_same_v<FromFieldType, Decimal128V3>), | 1067 | 92 | Decimal128V3, | 1068 | 92 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1069 | 92 | FromFieldType, ToFieldType>>; | 1070 | 92 | using MaxNativeType = typename MaxFieldType::NativeType; | 1071 | | | 1072 | 92 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1073 | 92 | bool multiply_may_overflow = false; | 1074 | 92 | if (to_scale > from_scale) { | 1075 | 66 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1076 | 66 | } | 1077 | | | 1078 | 92 | typename ToFieldType::NativeType max_result = | 1079 | 92 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1080 | 92 | typename ToFieldType::NativeType min_result = -max_result; | 1081 | | | 1082 | 92 | MaxNativeType multiplier {}; | 1083 | 92 | if (from_scale < to_scale) { | 1084 | 66 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1085 | 66 | from_scale); | 1086 | 66 | } else if (from_scale > to_scale) { | 1087 | 20 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1088 | 20 | to_scale); | 1089 | 20 | } | 1090 | 92 | RETURN_IF_ERROR(std::visit( | 1091 | 92 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1092 | 92 | for (size_t i = 0; i < size; i++) { | 1093 | 92 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1094 | 92 | multiply_may_overflow, narrow_integral>( | 1095 | 92 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1096 | 92 | to_precision, to_scale, min_result, max_result, multiplier, | 1097 | 92 | params)) { | 1098 | 92 | if (set_nullable) { | 1099 | 92 | null_map_data[i] = 1; | 1100 | 92 | } else { | 1101 | 92 | return params.status; | 1102 | 92 | } | 1103 | 92 | } | 1104 | 92 | } | 1105 | 92 | return Status::OK(); | 1106 | 92 | }, | 1107 | 92 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1108 | 0 | if (narrow_integral) { | 1109 | 0 | block.get_by_position(result).column = | 1110 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1111 | 0 | } else { | 1112 | 0 | block.get_by_position(result).column = std::move(col_to); | 1113 | 0 | } | 1114 | 0 | return Status::OK(); | 1115 | 92 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEES4_E12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 1018 | 180 | const NullMap::value_type* null_map = nullptr) const override { | 1019 | 180 | using FromFieldType = typename FromDataType::FieldType; | 1020 | 180 | using ToFieldType = typename ToDataType::FieldType; | 1021 | 180 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 1022 | 180 | const auto* col_from = | 1023 | 180 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 1024 | 180 | if (!col_from) { | 1025 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 1026 | 0 | named_from.column->get_name()); | 1027 | 0 | } | 1028 | | | 1029 | 180 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 1030 | 180 | UInt32 from_precision = from_decimal_type.get_precision(); | 1031 | 180 | UInt32 from_scale = from_decimal_type.get_scale(); | 1032 | | | 1033 | 180 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 1034 | 180 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 1035 | 180 | UInt32 to_precision = to_decimal_type.get_precision(); | 1036 | 180 | ToDataType::check_type_precision(to_precision); | 1037 | 180 | UInt32 to_scale = to_decimal_type.get_scale(); | 1038 | 180 | ToDataType::check_type_scale(to_scale); | 1039 | | | 1040 | 180 | auto from_max_int_digit_count = from_precision - from_scale; | 1041 | 180 | auto to_max_int_digit_count = to_precision - to_scale; | 1042 | 180 | bool narrow_integral = | 1043 | 180 | (to_max_int_digit_count < from_max_int_digit_count) || | 1044 | 180 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1045 | | // only in non-strict mode and may overflow, we set nullable | 1046 | 180 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1047 | | | 1048 | 180 | size_t size = col_from->size(); | 1049 | 180 | ColumnUInt8::MutablePtr col_null_map_to; | 1050 | 180 | NullMap::value_type* null_map_data = nullptr; | 1051 | 180 | if (narrow_integral) { | 1052 | 104 | col_null_map_to = ColumnUInt8::create(size, 0); | 1053 | 104 | null_map_data = col_null_map_to->get_data().data(); | 1054 | 104 | } | 1055 | 180 | CastParameters params; | 1056 | 180 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1057 | 180 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1058 | 180 | const auto& vec_from = col_from->get_data(); | 1059 | 180 | const auto* vec_from_data = vec_from.data(); | 1060 | 180 | auto& vec_to = col_to->get_data(); | 1061 | 180 | auto* vec_to_data = vec_to.data(); | 1062 | | | 1063 | 180 | using MaxFieldType = | 1064 | 180 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1065 | 180 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1066 | 180 | std::is_same_v<FromFieldType, Decimal128V3>), | 1067 | 180 | Decimal128V3, | 1068 | 180 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1069 | 180 | FromFieldType, ToFieldType>>; | 1070 | 180 | using MaxNativeType = typename MaxFieldType::NativeType; | 1071 | | | 1072 | 180 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1073 | 180 | bool multiply_may_overflow = false; | 1074 | 180 | if (to_scale > from_scale) { | 1075 | 86 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1076 | 86 | } | 1077 | | | 1078 | 180 | typename ToFieldType::NativeType max_result = | 1079 | 180 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1080 | 180 | typename ToFieldType::NativeType min_result = -max_result; | 1081 | | | 1082 | 180 | MaxNativeType multiplier {}; | 1083 | 180 | if (from_scale < to_scale) { | 1084 | 86 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1085 | 86 | from_scale); | 1086 | 94 | } else if (from_scale > to_scale) { | 1087 | 68 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1088 | 68 | to_scale); | 1089 | 68 | } | 1090 | 180 | RETURN_IF_ERROR(std::visit( | 1091 | 180 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1092 | 180 | for (size_t i = 0; i < size; i++) { | 1093 | 180 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1094 | 180 | multiply_may_overflow, narrow_integral>( | 1095 | 180 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1096 | 180 | to_precision, to_scale, min_result, max_result, multiplier, | 1097 | 180 | params)) { | 1098 | 180 | if (set_nullable) { | 1099 | 180 | null_map_data[i] = 1; | 1100 | 180 | } else { | 1101 | 180 | return params.status; | 1102 | 180 | } | 1103 | 180 | } | 1104 | 180 | } | 1105 | 180 | return Status::OK(); | 1106 | 180 | }, | 1107 | 180 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1108 | 180 | if (narrow_integral) { | 1109 | 104 | block.get_by_position(result).column = | 1110 | 104 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1111 | 104 | } else { | 1112 | 76 | block.get_by_position(result).column = std::move(col_to); | 1113 | 76 | } | 1114 | 180 | return Status::OK(); | 1115 | 180 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEENS2_ILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 1018 | 153 | const NullMap::value_type* null_map = nullptr) const override { | 1019 | 153 | using FromFieldType = typename FromDataType::FieldType; | 1020 | 153 | using ToFieldType = typename ToDataType::FieldType; | 1021 | 153 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 1022 | 153 | const auto* col_from = | 1023 | 153 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 1024 | 153 | if (!col_from) { | 1025 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 1026 | 0 | named_from.column->get_name()); | 1027 | 0 | } | 1028 | | | 1029 | 153 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 1030 | 153 | UInt32 from_precision = from_decimal_type.get_precision(); | 1031 | 153 | UInt32 from_scale = from_decimal_type.get_scale(); | 1032 | | | 1033 | 153 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 1034 | 153 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 1035 | 153 | UInt32 to_precision = to_decimal_type.get_precision(); | 1036 | 153 | ToDataType::check_type_precision(to_precision); | 1037 | 153 | UInt32 to_scale = to_decimal_type.get_scale(); | 1038 | 153 | ToDataType::check_type_scale(to_scale); | 1039 | | | 1040 | 153 | auto from_max_int_digit_count = from_precision - from_scale; | 1041 | 153 | auto to_max_int_digit_count = to_precision - to_scale; | 1042 | 153 | bool narrow_integral = | 1043 | 153 | (to_max_int_digit_count < from_max_int_digit_count) || | 1044 | 153 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1045 | | // only in non-strict mode and may overflow, we set nullable | 1046 | 153 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1047 | | | 1048 | 153 | size_t size = col_from->size(); | 1049 | 153 | ColumnUInt8::MutablePtr col_null_map_to; | 1050 | 153 | NullMap::value_type* null_map_data = nullptr; | 1051 | 153 | if (narrow_integral) { | 1052 | 153 | col_null_map_to = ColumnUInt8::create(size, 0); | 1053 | 153 | null_map_data = col_null_map_to->get_data().data(); | 1054 | 153 | } | 1055 | 153 | CastParameters params; | 1056 | 153 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1057 | 153 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1058 | 153 | const auto& vec_from = col_from->get_data(); | 1059 | 153 | const auto* vec_from_data = vec_from.data(); | 1060 | 153 | auto& vec_to = col_to->get_data(); | 1061 | 153 | auto* vec_to_data = vec_to.data(); | 1062 | | | 1063 | 153 | using MaxFieldType = | 1064 | 153 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1065 | 153 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1066 | 153 | std::is_same_v<FromFieldType, Decimal128V3>), | 1067 | 153 | Decimal128V3, | 1068 | 153 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1069 | 153 | FromFieldType, ToFieldType>>; | 1070 | 153 | using MaxNativeType = typename MaxFieldType::NativeType; | 1071 | | | 1072 | 153 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1073 | 153 | bool multiply_may_overflow = false; | 1074 | 153 | if (to_scale > from_scale) { | 1075 | 60 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1076 | 60 | } | 1077 | | | 1078 | 153 | typename ToFieldType::NativeType max_result = | 1079 | 153 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1080 | 153 | typename ToFieldType::NativeType min_result = -max_result; | 1081 | | | 1082 | 153 | MaxNativeType multiplier {}; | 1083 | 153 | if (from_scale < to_scale) { | 1084 | 60 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1085 | 60 | from_scale); | 1086 | 93 | } else if (from_scale > to_scale) { | 1087 | 66 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1088 | 66 | to_scale); | 1089 | 66 | } | 1090 | 153 | RETURN_IF_ERROR(std::visit( | 1091 | 153 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1092 | 153 | for (size_t i = 0; i < size; i++) { | 1093 | 153 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1094 | 153 | multiply_may_overflow, narrow_integral>( | 1095 | 153 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1096 | 153 | to_precision, to_scale, min_result, max_result, multiplier, | 1097 | 153 | params)) { | 1098 | 153 | if (set_nullable) { | 1099 | 153 | null_map_data[i] = 1; | 1100 | 153 | } else { | 1101 | 153 | return params.status; | 1102 | 153 | } | 1103 | 153 | } | 1104 | 153 | } | 1105 | 153 | return Status::OK(); | 1106 | 153 | }, | 1107 | 153 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1108 | 0 | if (narrow_integral) { | 1109 | 0 | block.get_by_position(result).column = | 1110 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1111 | 0 | } else { | 1112 | 0 | block.get_by_position(result).column = std::move(col_to); | 1113 | 0 | } | 1114 | 0 | return Status::OK(); | 1115 | 153 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEENS2_ILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 1018 | 228 | const NullMap::value_type* null_map = nullptr) const override { | 1019 | 228 | using FromFieldType = typename FromDataType::FieldType; | 1020 | 228 | using ToFieldType = typename ToDataType::FieldType; | 1021 | 228 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 1022 | 228 | const auto* col_from = | 1023 | 228 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 1024 | 228 | if (!col_from) { | 1025 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 1026 | 0 | named_from.column->get_name()); | 1027 | 0 | } | 1028 | | | 1029 | 228 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 1030 | 228 | UInt32 from_precision = from_decimal_type.get_precision(); | 1031 | 228 | UInt32 from_scale = from_decimal_type.get_scale(); | 1032 | | | 1033 | 228 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 1034 | 228 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 1035 | 228 | UInt32 to_precision = to_decimal_type.get_precision(); | 1036 | 228 | ToDataType::check_type_precision(to_precision); | 1037 | 228 | UInt32 to_scale = to_decimal_type.get_scale(); | 1038 | 228 | ToDataType::check_type_scale(to_scale); | 1039 | | | 1040 | 228 | auto from_max_int_digit_count = from_precision - from_scale; | 1041 | 228 | auto to_max_int_digit_count = to_precision - to_scale; | 1042 | 228 | bool narrow_integral = | 1043 | 228 | (to_max_int_digit_count < from_max_int_digit_count) || | 1044 | 228 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1045 | | // only in non-strict mode and may overflow, we set nullable | 1046 | 228 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1047 | | | 1048 | 228 | size_t size = col_from->size(); | 1049 | 228 | ColumnUInt8::MutablePtr col_null_map_to; | 1050 | 228 | NullMap::value_type* null_map_data = nullptr; | 1051 | 228 | if (narrow_integral) { | 1052 | 192 | col_null_map_to = ColumnUInt8::create(size, 0); | 1053 | 192 | null_map_data = col_null_map_to->get_data().data(); | 1054 | 192 | } | 1055 | 228 | CastParameters params; | 1056 | 228 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1057 | 228 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1058 | 228 | const auto& vec_from = col_from->get_data(); | 1059 | 228 | const auto* vec_from_data = vec_from.data(); | 1060 | 228 | auto& vec_to = col_to->get_data(); | 1061 | 228 | auto* vec_to_data = vec_to.data(); | 1062 | | | 1063 | 228 | using MaxFieldType = | 1064 | 228 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1065 | 228 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1066 | 228 | std::is_same_v<FromFieldType, Decimal128V3>), | 1067 | 228 | Decimal128V3, | 1068 | 228 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1069 | 228 | FromFieldType, ToFieldType>>; | 1070 | 228 | using MaxNativeType = typename MaxFieldType::NativeType; | 1071 | | | 1072 | 228 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1073 | 228 | bool multiply_may_overflow = false; | 1074 | 228 | if (to_scale > from_scale) { | 1075 | 76 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1076 | 76 | } | 1077 | | | 1078 | 228 | typename ToFieldType::NativeType max_result = | 1079 | 228 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1080 | 228 | typename ToFieldType::NativeType min_result = -max_result; | 1081 | | | 1082 | 228 | MaxNativeType multiplier {}; | 1083 | 228 | if (from_scale < to_scale) { | 1084 | 76 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1085 | 76 | from_scale); | 1086 | 152 | } else if (from_scale > to_scale) { | 1087 | 94 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1088 | 94 | to_scale); | 1089 | 94 | } | 1090 | 228 | RETURN_IF_ERROR(std::visit( | 1091 | 228 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1092 | 228 | for (size_t i = 0; i < size; i++) { | 1093 | 228 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1094 | 228 | multiply_may_overflow, narrow_integral>( | 1095 | 228 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1096 | 228 | to_precision, to_scale, min_result, max_result, multiplier, | 1097 | 228 | params)) { | 1098 | 228 | if (set_nullable) { | 1099 | 228 | null_map_data[i] = 1; | 1100 | 228 | } else { | 1101 | 228 | return params.status; | 1102 | 228 | } | 1103 | 228 | } | 1104 | 228 | } | 1105 | 228 | return Status::OK(); | 1106 | 228 | }, | 1107 | 228 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1108 | 228 | if (narrow_integral) { | 1109 | 192 | block.get_by_position(result).column = | 1110 | 192 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1111 | 192 | } else { | 1112 | 36 | block.get_by_position(result).column = std::move(col_to); | 1113 | 36 | } | 1114 | 228 | return Status::OK(); | 1115 | 228 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEENS2_ILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 1018 | 36 | const NullMap::value_type* null_map = nullptr) const override { | 1019 | 36 | using FromFieldType = typename FromDataType::FieldType; | 1020 | 36 | using ToFieldType = typename ToDataType::FieldType; | 1021 | 36 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 1022 | 36 | const auto* col_from = | 1023 | 36 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 1024 | 36 | if (!col_from) { | 1025 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 1026 | 0 | named_from.column->get_name()); | 1027 | 0 | } | 1028 | | | 1029 | 36 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 1030 | 36 | UInt32 from_precision = from_decimal_type.get_precision(); | 1031 | 36 | UInt32 from_scale = from_decimal_type.get_scale(); | 1032 | | | 1033 | 36 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 1034 | 36 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 1035 | 36 | UInt32 to_precision = to_decimal_type.get_precision(); | 1036 | 36 | ToDataType::check_type_precision(to_precision); | 1037 | 36 | UInt32 to_scale = to_decimal_type.get_scale(); | 1038 | 36 | ToDataType::check_type_scale(to_scale); | 1039 | | | 1040 | 36 | auto from_max_int_digit_count = from_precision - from_scale; | 1041 | 36 | auto to_max_int_digit_count = to_precision - to_scale; | 1042 | 36 | bool narrow_integral = | 1043 | 36 | (to_max_int_digit_count < from_max_int_digit_count) || | 1044 | 36 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1045 | | // only in non-strict mode and may overflow, we set nullable | 1046 | 36 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1047 | | | 1048 | 36 | size_t size = col_from->size(); | 1049 | 36 | ColumnUInt8::MutablePtr col_null_map_to; | 1050 | 36 | NullMap::value_type* null_map_data = nullptr; | 1051 | 36 | if (narrow_integral) { | 1052 | 36 | col_null_map_to = ColumnUInt8::create(size, 0); | 1053 | 36 | null_map_data = col_null_map_to->get_data().data(); | 1054 | 36 | } | 1055 | 36 | CastParameters params; | 1056 | 36 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1057 | 36 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1058 | 36 | const auto& vec_from = col_from->get_data(); | 1059 | 36 | const auto* vec_from_data = vec_from.data(); | 1060 | 36 | auto& vec_to = col_to->get_data(); | 1061 | 36 | auto* vec_to_data = vec_to.data(); | 1062 | | | 1063 | 36 | using MaxFieldType = | 1064 | 36 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1065 | 36 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1066 | 36 | std::is_same_v<FromFieldType, Decimal128V3>), | 1067 | 36 | Decimal128V3, | 1068 | 36 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1069 | 36 | FromFieldType, ToFieldType>>; | 1070 | 36 | using MaxNativeType = typename MaxFieldType::NativeType; | 1071 | | | 1072 | 36 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1073 | 36 | bool multiply_may_overflow = false; | 1074 | 36 | if (to_scale > from_scale) { | 1075 | 36 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1076 | 36 | } | 1077 | | | 1078 | 36 | typename ToFieldType::NativeType max_result = | 1079 | 36 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1080 | 36 | typename ToFieldType::NativeType min_result = -max_result; | 1081 | | | 1082 | 36 | MaxNativeType multiplier {}; | 1083 | 36 | if (from_scale < to_scale) { | 1084 | 36 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1085 | 36 | from_scale); | 1086 | 36 | } else if (from_scale > to_scale) { | 1087 | 0 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1088 | 0 | to_scale); | 1089 | 0 | } | 1090 | 36 | RETURN_IF_ERROR(std::visit( | 1091 | 36 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1092 | 36 | for (size_t i = 0; i < size; i++) { | 1093 | 36 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1094 | 36 | multiply_may_overflow, narrow_integral>( | 1095 | 36 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1096 | 36 | to_precision, to_scale, min_result, max_result, multiplier, | 1097 | 36 | params)) { | 1098 | 36 | if (set_nullable) { | 1099 | 36 | null_map_data[i] = 1; | 1100 | 36 | } else { | 1101 | 36 | return params.status; | 1102 | 36 | } | 1103 | 36 | } | 1104 | 36 | } | 1105 | 36 | return Status::OK(); | 1106 | 36 | }, | 1107 | 36 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1108 | 0 | if (narrow_integral) { | 1109 | 0 | block.get_by_position(result).column = | 1110 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1111 | 0 | } else { | 1112 | 0 | block.get_by_position(result).column = std::move(col_to); | 1113 | 0 | } | 1114 | 0 | return Status::OK(); | 1115 | 36 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEENS2_ILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 1018 | 132 | const NullMap::value_type* null_map = nullptr) const override { | 1019 | 132 | using FromFieldType = typename FromDataType::FieldType; | 1020 | 132 | using ToFieldType = typename ToDataType::FieldType; | 1021 | 132 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 1022 | 132 | const auto* col_from = | 1023 | 132 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 1024 | 132 | if (!col_from) { | 1025 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 1026 | 0 | named_from.column->get_name()); | 1027 | 0 | } | 1028 | | | 1029 | 132 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 1030 | 132 | UInt32 from_precision = from_decimal_type.get_precision(); | 1031 | 132 | UInt32 from_scale = from_decimal_type.get_scale(); | 1032 | | | 1033 | 132 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 1034 | 132 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 1035 | 132 | UInt32 to_precision = to_decimal_type.get_precision(); | 1036 | 132 | ToDataType::check_type_precision(to_precision); | 1037 | 132 | UInt32 to_scale = to_decimal_type.get_scale(); | 1038 | 132 | ToDataType::check_type_scale(to_scale); | 1039 | | | 1040 | 132 | auto from_max_int_digit_count = from_precision - from_scale; | 1041 | 132 | auto to_max_int_digit_count = to_precision - to_scale; | 1042 | 132 | bool narrow_integral = | 1043 | 132 | (to_max_int_digit_count < from_max_int_digit_count) || | 1044 | 132 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1045 | | // only in non-strict mode and may overflow, we set nullable | 1046 | 132 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1047 | | | 1048 | 132 | size_t size = col_from->size(); | 1049 | 132 | ColumnUInt8::MutablePtr col_null_map_to; | 1050 | 132 | NullMap::value_type* null_map_data = nullptr; | 1051 | 132 | if (narrow_integral) { | 1052 | 32 | col_null_map_to = ColumnUInt8::create(size, 0); | 1053 | 32 | null_map_data = col_null_map_to->get_data().data(); | 1054 | 32 | } | 1055 | 132 | CastParameters params; | 1056 | 132 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1057 | 132 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1058 | 132 | const auto& vec_from = col_from->get_data(); | 1059 | 132 | const auto* vec_from_data = vec_from.data(); | 1060 | 132 | auto& vec_to = col_to->get_data(); | 1061 | 132 | auto* vec_to_data = vec_to.data(); | 1062 | | | 1063 | 132 | using MaxFieldType = | 1064 | 132 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1065 | 132 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1066 | 132 | std::is_same_v<FromFieldType, Decimal128V3>), | 1067 | 132 | Decimal128V3, | 1068 | 132 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1069 | 132 | FromFieldType, ToFieldType>>; | 1070 | 132 | using MaxNativeType = typename MaxFieldType::NativeType; | 1071 | | | 1072 | 132 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1073 | 132 | bool multiply_may_overflow = false; | 1074 | 132 | if (to_scale > from_scale) { | 1075 | 70 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1076 | 70 | } | 1077 | | | 1078 | 132 | typename ToFieldType::NativeType max_result = | 1079 | 132 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1080 | 132 | typename ToFieldType::NativeType min_result = -max_result; | 1081 | | | 1082 | 132 | MaxNativeType multiplier {}; | 1083 | 132 | if (from_scale < to_scale) { | 1084 | 70 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1085 | 70 | from_scale); | 1086 | 70 | } else if (from_scale > to_scale) { | 1087 | 30 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1088 | 30 | to_scale); | 1089 | 30 | } | 1090 | 132 | RETURN_IF_ERROR(std::visit( | 1091 | 132 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1092 | 132 | for (size_t i = 0; i < size; i++) { | 1093 | 132 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1094 | 132 | multiply_may_overflow, narrow_integral>( | 1095 | 132 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1096 | 132 | to_precision, to_scale, min_result, max_result, multiplier, | 1097 | 132 | params)) { | 1098 | 132 | if (set_nullable) { | 1099 | 132 | null_map_data[i] = 1; | 1100 | 132 | } else { | 1101 | 132 | return params.status; | 1102 | 132 | } | 1103 | 132 | } | 1104 | 132 | } | 1105 | 132 | return Status::OK(); | 1106 | 132 | }, | 1107 | 132 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1108 | 132 | if (narrow_integral) { | 1109 | 32 | block.get_by_position(result).column = | 1110 | 32 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1111 | 100 | } else { | 1112 | 100 | block.get_by_position(result).column = std::move(col_to); | 1113 | 100 | } | 1114 | 132 | return Status::OK(); | 1115 | 132 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEENS2_ILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 1018 | 60 | const NullMap::value_type* null_map = nullptr) const override { | 1019 | 60 | using FromFieldType = typename FromDataType::FieldType; | 1020 | 60 | using ToFieldType = typename ToDataType::FieldType; | 1021 | 60 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 1022 | 60 | const auto* col_from = | 1023 | 60 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 1024 | 60 | if (!col_from) { | 1025 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 1026 | 0 | named_from.column->get_name()); | 1027 | 0 | } | 1028 | | | 1029 | 60 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 1030 | 60 | UInt32 from_precision = from_decimal_type.get_precision(); | 1031 | 60 | UInt32 from_scale = from_decimal_type.get_scale(); | 1032 | | | 1033 | 60 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 1034 | 60 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 1035 | 60 | UInt32 to_precision = to_decimal_type.get_precision(); | 1036 | 60 | ToDataType::check_type_precision(to_precision); | 1037 | 60 | UInt32 to_scale = to_decimal_type.get_scale(); | 1038 | 60 | ToDataType::check_type_scale(to_scale); | 1039 | | | 1040 | 60 | auto from_max_int_digit_count = from_precision - from_scale; | 1041 | 60 | auto to_max_int_digit_count = to_precision - to_scale; | 1042 | 60 | bool narrow_integral = | 1043 | 60 | (to_max_int_digit_count < from_max_int_digit_count) || | 1044 | 60 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1045 | | // only in non-strict mode and may overflow, we set nullable | 1046 | 60 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1047 | | | 1048 | 60 | size_t size = col_from->size(); | 1049 | 60 | ColumnUInt8::MutablePtr col_null_map_to; | 1050 | 60 | NullMap::value_type* null_map_data = nullptr; | 1051 | 60 | if (narrow_integral) { | 1052 | 60 | col_null_map_to = ColumnUInt8::create(size, 0); | 1053 | 60 | null_map_data = col_null_map_to->get_data().data(); | 1054 | 60 | } | 1055 | 60 | CastParameters params; | 1056 | 60 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1057 | 60 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1058 | 60 | const auto& vec_from = col_from->get_data(); | 1059 | 60 | const auto* vec_from_data = vec_from.data(); | 1060 | 60 | auto& vec_to = col_to->get_data(); | 1061 | 60 | auto* vec_to_data = vec_to.data(); | 1062 | | | 1063 | 60 | using MaxFieldType = | 1064 | 60 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1065 | 60 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1066 | 60 | std::is_same_v<FromFieldType, Decimal128V3>), | 1067 | 60 | Decimal128V3, | 1068 | 60 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1069 | 60 | FromFieldType, ToFieldType>>; | 1070 | 60 | using MaxNativeType = typename MaxFieldType::NativeType; | 1071 | | | 1072 | 60 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1073 | 60 | bool multiply_may_overflow = false; | 1074 | 60 | if (to_scale > from_scale) { | 1075 | 60 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1076 | 60 | } | 1077 | | | 1078 | 60 | typename ToFieldType::NativeType max_result = | 1079 | 60 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1080 | 60 | typename ToFieldType::NativeType min_result = -max_result; | 1081 | | | 1082 | 60 | MaxNativeType multiplier {}; | 1083 | 60 | if (from_scale < to_scale) { | 1084 | 60 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1085 | 60 | from_scale); | 1086 | 60 | } else if (from_scale > to_scale) { | 1087 | 0 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1088 | 0 | to_scale); | 1089 | 0 | } | 1090 | 60 | RETURN_IF_ERROR(std::visit( | 1091 | 60 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1092 | 60 | for (size_t i = 0; i < size; i++) { | 1093 | 60 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1094 | 60 | multiply_may_overflow, narrow_integral>( | 1095 | 60 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1096 | 60 | to_precision, to_scale, min_result, max_result, multiplier, | 1097 | 60 | params)) { | 1098 | 60 | if (set_nullable) { | 1099 | 60 | null_map_data[i] = 1; | 1100 | 60 | } else { | 1101 | 60 | return params.status; | 1102 | 60 | } | 1103 | 60 | } | 1104 | 60 | } | 1105 | 60 | return Status::OK(); | 1106 | 60 | }, | 1107 | 60 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1108 | 0 | if (narrow_integral) { | 1109 | 0 | block.get_by_position(result).column = | 1110 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1111 | 0 | } else { | 1112 | 0 | block.get_by_position(result).column = std::move(col_to); | 1113 | 0 | } | 1114 | 0 | return Status::OK(); | 1115 | 60 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEENS2_ILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 1018 | 204 | const NullMap::value_type* null_map = nullptr) const override { | 1019 | 204 | using FromFieldType = typename FromDataType::FieldType; | 1020 | 204 | using ToFieldType = typename ToDataType::FieldType; | 1021 | 204 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 1022 | 204 | const auto* col_from = | 1023 | 204 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 1024 | 204 | if (!col_from) { | 1025 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 1026 | 0 | named_from.column->get_name()); | 1027 | 0 | } | 1028 | | | 1029 | 204 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 1030 | 204 | UInt32 from_precision = from_decimal_type.get_precision(); | 1031 | 204 | UInt32 from_scale = from_decimal_type.get_scale(); | 1032 | | | 1033 | 204 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 1034 | 204 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 1035 | 204 | UInt32 to_precision = to_decimal_type.get_precision(); | 1036 | 204 | ToDataType::check_type_precision(to_precision); | 1037 | 204 | UInt32 to_scale = to_decimal_type.get_scale(); | 1038 | 204 | ToDataType::check_type_scale(to_scale); | 1039 | | | 1040 | 204 | auto from_max_int_digit_count = from_precision - from_scale; | 1041 | 204 | auto to_max_int_digit_count = to_precision - to_scale; | 1042 | 204 | bool narrow_integral = | 1043 | 204 | (to_max_int_digit_count < from_max_int_digit_count) || | 1044 | 204 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1045 | | // only in non-strict mode and may overflow, we set nullable | 1046 | 204 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1047 | | | 1048 | 204 | size_t size = col_from->size(); | 1049 | 204 | ColumnUInt8::MutablePtr col_null_map_to; | 1050 | 204 | NullMap::value_type* null_map_data = nullptr; | 1051 | 204 | if (narrow_integral) { | 1052 | 56 | col_null_map_to = ColumnUInt8::create(size, 0); | 1053 | 56 | null_map_data = col_null_map_to->get_data().data(); | 1054 | 56 | } | 1055 | 204 | CastParameters params; | 1056 | 204 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1057 | 204 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1058 | 204 | const auto& vec_from = col_from->get_data(); | 1059 | 204 | const auto* vec_from_data = vec_from.data(); | 1060 | 204 | auto& vec_to = col_to->get_data(); | 1061 | 204 | auto* vec_to_data = vec_to.data(); | 1062 | | | 1063 | 204 | using MaxFieldType = | 1064 | 204 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1065 | 204 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1066 | 204 | std::is_same_v<FromFieldType, Decimal128V3>), | 1067 | 204 | Decimal128V3, | 1068 | 204 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1069 | 204 | FromFieldType, ToFieldType>>; | 1070 | 204 | using MaxNativeType = typename MaxFieldType::NativeType; | 1071 | | | 1072 | 204 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1073 | 204 | bool multiply_may_overflow = false; | 1074 | 204 | if (to_scale > from_scale) { | 1075 | 100 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1076 | 100 | } | 1077 | | | 1078 | 204 | typename ToFieldType::NativeType max_result = | 1079 | 204 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1080 | 204 | typename ToFieldType::NativeType min_result = -max_result; | 1081 | | | 1082 | 204 | MaxNativeType multiplier {}; | 1083 | 204 | if (from_scale < to_scale) { | 1084 | 100 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1085 | 100 | from_scale); | 1086 | 104 | } else if (from_scale > to_scale) { | 1087 | 56 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1088 | 56 | to_scale); | 1089 | 56 | } | 1090 | 204 | RETURN_IF_ERROR(std::visit( | 1091 | 204 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1092 | 204 | for (size_t i = 0; i < size; i++) { | 1093 | 204 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1094 | 204 | multiply_may_overflow, narrow_integral>( | 1095 | 204 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1096 | 204 | to_precision, to_scale, min_result, max_result, multiplier, | 1097 | 204 | params)) { | 1098 | 204 | if (set_nullable) { | 1099 | 204 | null_map_data[i] = 1; | 1100 | 204 | } else { | 1101 | 204 | return params.status; | 1102 | 204 | } | 1103 | 204 | } | 1104 | 204 | } | 1105 | 204 | return Status::OK(); | 1106 | 204 | }, | 1107 | 204 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1108 | 204 | if (narrow_integral) { | 1109 | 56 | block.get_by_position(result).column = | 1110 | 56 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1111 | 148 | } else { | 1112 | 148 | block.get_by_position(result).column = std::move(col_to); | 1113 | 148 | } | 1114 | 204 | return Status::OK(); | 1115 | 204 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEENS2_ILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 1018 | 60 | const NullMap::value_type* null_map = nullptr) const override { | 1019 | 60 | using FromFieldType = typename FromDataType::FieldType; | 1020 | 60 | using ToFieldType = typename ToDataType::FieldType; | 1021 | 60 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 1022 | 60 | const auto* col_from = | 1023 | 60 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 1024 | 60 | if (!col_from) { | 1025 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 1026 | 0 | named_from.column->get_name()); | 1027 | 0 | } | 1028 | | | 1029 | 60 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 1030 | 60 | UInt32 from_precision = from_decimal_type.get_precision(); | 1031 | 60 | UInt32 from_scale = from_decimal_type.get_scale(); | 1032 | | | 1033 | 60 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 1034 | 60 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 1035 | 60 | UInt32 to_precision = to_decimal_type.get_precision(); | 1036 | 60 | ToDataType::check_type_precision(to_precision); | 1037 | 60 | UInt32 to_scale = to_decimal_type.get_scale(); | 1038 | 60 | ToDataType::check_type_scale(to_scale); | 1039 | | | 1040 | 60 | auto from_max_int_digit_count = from_precision - from_scale; | 1041 | 60 | auto to_max_int_digit_count = to_precision - to_scale; | 1042 | 60 | bool narrow_integral = | 1043 | 60 | (to_max_int_digit_count < from_max_int_digit_count) || | 1044 | 60 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1045 | | // only in non-strict mode and may overflow, we set nullable | 1046 | 60 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1047 | | | 1048 | 60 | size_t size = col_from->size(); | 1049 | 60 | ColumnUInt8::MutablePtr col_null_map_to; | 1050 | 60 | NullMap::value_type* null_map_data = nullptr; | 1051 | 60 | if (narrow_integral) { | 1052 | 60 | col_null_map_to = ColumnUInt8::create(size, 0); | 1053 | 60 | null_map_data = col_null_map_to->get_data().data(); | 1054 | 60 | } | 1055 | 60 | CastParameters params; | 1056 | 60 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1057 | 60 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1058 | 60 | const auto& vec_from = col_from->get_data(); | 1059 | 60 | const auto* vec_from_data = vec_from.data(); | 1060 | 60 | auto& vec_to = col_to->get_data(); | 1061 | 60 | auto* vec_to_data = vec_to.data(); | 1062 | | | 1063 | 60 | using MaxFieldType = | 1064 | 60 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1065 | 60 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1066 | 60 | std::is_same_v<FromFieldType, Decimal128V3>), | 1067 | 60 | Decimal128V3, | 1068 | 60 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1069 | 60 | FromFieldType, ToFieldType>>; | 1070 | 60 | using MaxNativeType = typename MaxFieldType::NativeType; | 1071 | | | 1072 | 60 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1073 | 60 | bool multiply_may_overflow = false; | 1074 | 60 | if (to_scale > from_scale) { | 1075 | 60 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1076 | 60 | } | 1077 | | | 1078 | 60 | typename ToFieldType::NativeType max_result = | 1079 | 60 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1080 | 60 | typename ToFieldType::NativeType min_result = -max_result; | 1081 | | | 1082 | 60 | MaxNativeType multiplier {}; | 1083 | 60 | if (from_scale < to_scale) { | 1084 | 60 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1085 | 60 | from_scale); | 1086 | 60 | } else if (from_scale > to_scale) { | 1087 | 0 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1088 | 0 | to_scale); | 1089 | 0 | } | 1090 | 60 | RETURN_IF_ERROR(std::visit( | 1091 | 60 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1092 | 60 | for (size_t i = 0; i < size; i++) { | 1093 | 60 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1094 | 60 | multiply_may_overflow, narrow_integral>( | 1095 | 60 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1096 | 60 | to_precision, to_scale, min_result, max_result, multiplier, | 1097 | 60 | params)) { | 1098 | 60 | if (set_nullable) { | 1099 | 60 | null_map_data[i] = 1; | 1100 | 60 | } else { | 1101 | 60 | return params.status; | 1102 | 60 | } | 1103 | 60 | } | 1104 | 60 | } | 1105 | 60 | return Status::OK(); | 1106 | 60 | }, | 1107 | 60 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1108 | 0 | if (narrow_integral) { | 1109 | 0 | block.get_by_position(result).column = | 1110 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1111 | 0 | } else { | 1112 | 0 | block.get_by_position(result).column = std::move(col_to); | 1113 | 0 | } | 1114 | 0 | return Status::OK(); | 1115 | 60 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEENS2_ILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 1018 | 204 | const NullMap::value_type* null_map = nullptr) const override { | 1019 | 204 | using FromFieldType = typename FromDataType::FieldType; | 1020 | 204 | using ToFieldType = typename ToDataType::FieldType; | 1021 | 204 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 1022 | 204 | const auto* col_from = | 1023 | 204 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 1024 | 204 | if (!col_from) { | 1025 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 1026 | 0 | named_from.column->get_name()); | 1027 | 0 | } | 1028 | | | 1029 | 204 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 1030 | 204 | UInt32 from_precision = from_decimal_type.get_precision(); | 1031 | 204 | UInt32 from_scale = from_decimal_type.get_scale(); | 1032 | | | 1033 | 204 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 1034 | 204 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 1035 | 204 | UInt32 to_precision = to_decimal_type.get_precision(); | 1036 | 204 | ToDataType::check_type_precision(to_precision); | 1037 | 204 | UInt32 to_scale = to_decimal_type.get_scale(); | 1038 | 204 | ToDataType::check_type_scale(to_scale); | 1039 | | | 1040 | 204 | auto from_max_int_digit_count = from_precision - from_scale; | 1041 | 204 | auto to_max_int_digit_count = to_precision - to_scale; | 1042 | 204 | bool narrow_integral = | 1043 | 204 | (to_max_int_digit_count < from_max_int_digit_count) || | 1044 | 204 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1045 | | // only in non-strict mode and may overflow, we set nullable | 1046 | 204 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1047 | | | 1048 | 204 | size_t size = col_from->size(); | 1049 | 204 | ColumnUInt8::MutablePtr col_null_map_to; | 1050 | 204 | NullMap::value_type* null_map_data = nullptr; | 1051 | 204 | if (narrow_integral) { | 1052 | 56 | col_null_map_to = ColumnUInt8::create(size, 0); | 1053 | 56 | null_map_data = col_null_map_to->get_data().data(); | 1054 | 56 | } | 1055 | 204 | CastParameters params; | 1056 | 204 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1057 | 204 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1058 | 204 | const auto& vec_from = col_from->get_data(); | 1059 | 204 | const auto* vec_from_data = vec_from.data(); | 1060 | 204 | auto& vec_to = col_to->get_data(); | 1061 | 204 | auto* vec_to_data = vec_to.data(); | 1062 | | | 1063 | 204 | using MaxFieldType = | 1064 | 204 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1065 | 204 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1066 | 204 | std::is_same_v<FromFieldType, Decimal128V3>), | 1067 | 204 | Decimal128V3, | 1068 | 204 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1069 | 204 | FromFieldType, ToFieldType>>; | 1070 | 204 | using MaxNativeType = typename MaxFieldType::NativeType; | 1071 | | | 1072 | 204 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1073 | 204 | bool multiply_may_overflow = false; | 1074 | 204 | if (to_scale > from_scale) { | 1075 | 99 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1076 | 99 | } | 1077 | | | 1078 | 204 | typename ToFieldType::NativeType max_result = | 1079 | 204 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1080 | 204 | typename ToFieldType::NativeType min_result = -max_result; | 1081 | | | 1082 | 204 | MaxNativeType multiplier {}; | 1083 | 204 | if (from_scale < to_scale) { | 1084 | 99 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1085 | 99 | from_scale); | 1086 | 105 | } else if (from_scale > to_scale) { | 1087 | 56 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1088 | 56 | to_scale); | 1089 | 56 | } | 1090 | 204 | RETURN_IF_ERROR(std::visit( | 1091 | 204 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1092 | 204 | for (size_t i = 0; i < size; i++) { | 1093 | 204 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1094 | 204 | multiply_may_overflow, narrow_integral>( | 1095 | 204 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1096 | 204 | to_precision, to_scale, min_result, max_result, multiplier, | 1097 | 204 | params)) { | 1098 | 204 | if (set_nullable) { | 1099 | 204 | null_map_data[i] = 1; | 1100 | 204 | } else { | 1101 | 204 | return params.status; | 1102 | 204 | } | 1103 | 204 | } | 1104 | 204 | } | 1105 | 204 | return Status::OK(); | 1106 | 204 | }, | 1107 | 204 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1108 | 204 | if (narrow_integral) { | 1109 | 56 | block.get_by_position(result).column = | 1110 | 56 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1111 | 148 | } else { | 1112 | 148 | block.get_by_position(result).column = std::move(col_to); | 1113 | 148 | } | 1114 | 204 | return Status::OK(); | 1115 | 204 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEES4_E12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 1018 | 92 | const NullMap::value_type* null_map = nullptr) const override { | 1019 | 92 | using FromFieldType = typename FromDataType::FieldType; | 1020 | 92 | using ToFieldType = typename ToDataType::FieldType; | 1021 | 92 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 1022 | 92 | const auto* col_from = | 1023 | 92 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 1024 | 92 | if (!col_from) { | 1025 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 1026 | 0 | named_from.column->get_name()); | 1027 | 0 | } | 1028 | | | 1029 | 92 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 1030 | 92 | UInt32 from_precision = from_decimal_type.get_precision(); | 1031 | 92 | UInt32 from_scale = from_decimal_type.get_scale(); | 1032 | | | 1033 | 92 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 1034 | 92 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 1035 | 92 | UInt32 to_precision = to_decimal_type.get_precision(); | 1036 | 92 | ToDataType::check_type_precision(to_precision); | 1037 | 92 | UInt32 to_scale = to_decimal_type.get_scale(); | 1038 | 92 | ToDataType::check_type_scale(to_scale); | 1039 | | | 1040 | 92 | auto from_max_int_digit_count = from_precision - from_scale; | 1041 | 92 | auto to_max_int_digit_count = to_precision - to_scale; | 1042 | 92 | bool narrow_integral = | 1043 | 92 | (to_max_int_digit_count < from_max_int_digit_count) || | 1044 | 92 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1045 | | // only in non-strict mode and may overflow, we set nullable | 1046 | 92 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1047 | | | 1048 | 92 | size_t size = col_from->size(); | 1049 | 92 | ColumnUInt8::MutablePtr col_null_map_to; | 1050 | 92 | NullMap::value_type* null_map_data = nullptr; | 1051 | 92 | if (narrow_integral) { | 1052 | 92 | col_null_map_to = ColumnUInt8::create(size, 0); | 1053 | 92 | null_map_data = col_null_map_to->get_data().data(); | 1054 | 92 | } | 1055 | 92 | CastParameters params; | 1056 | 92 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1057 | 92 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1058 | 92 | const auto& vec_from = col_from->get_data(); | 1059 | 92 | const auto* vec_from_data = vec_from.data(); | 1060 | 92 | auto& vec_to = col_to->get_data(); | 1061 | 92 | auto* vec_to_data = vec_to.data(); | 1062 | | | 1063 | 92 | using MaxFieldType = | 1064 | 92 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1065 | 92 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1066 | 92 | std::is_same_v<FromFieldType, Decimal128V3>), | 1067 | 92 | Decimal128V3, | 1068 | 92 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1069 | 92 | FromFieldType, ToFieldType>>; | 1070 | 92 | using MaxNativeType = typename MaxFieldType::NativeType; | 1071 | | | 1072 | 92 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1073 | 92 | bool multiply_may_overflow = false; | 1074 | 92 | if (to_scale > from_scale) { | 1075 | 66 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1076 | 66 | } | 1077 | | | 1078 | 92 | typename ToFieldType::NativeType max_result = | 1079 | 92 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1080 | 92 | typename ToFieldType::NativeType min_result = -max_result; | 1081 | | | 1082 | 92 | MaxNativeType multiplier {}; | 1083 | 92 | if (from_scale < to_scale) { | 1084 | 66 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1085 | 66 | from_scale); | 1086 | 66 | } else if (from_scale > to_scale) { | 1087 | 20 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1088 | 20 | to_scale); | 1089 | 20 | } | 1090 | 92 | RETURN_IF_ERROR(std::visit( | 1091 | 92 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1092 | 92 | for (size_t i = 0; i < size; i++) { | 1093 | 92 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1094 | 92 | multiply_may_overflow, narrow_integral>( | 1095 | 92 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1096 | 92 | to_precision, to_scale, min_result, max_result, multiplier, | 1097 | 92 | params)) { | 1098 | 92 | if (set_nullable) { | 1099 | 92 | null_map_data[i] = 1; | 1100 | 92 | } else { | 1101 | 92 | return params.status; | 1102 | 92 | } | 1103 | 92 | } | 1104 | 92 | } | 1105 | 92 | return Status::OK(); | 1106 | 92 | }, | 1107 | 92 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1108 | 0 | if (narrow_integral) { | 1109 | 0 | block.get_by_position(result).column = | 1110 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1111 | 0 | } else { | 1112 | 0 | block.get_by_position(result).column = std::move(col_to); | 1113 | 0 | } | 1114 | 0 | return Status::OK(); | 1115 | 92 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEES4_E12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 1018 | 180 | const NullMap::value_type* null_map = nullptr) const override { | 1019 | 180 | using FromFieldType = typename FromDataType::FieldType; | 1020 | 180 | using ToFieldType = typename ToDataType::FieldType; | 1021 | 180 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 1022 | 180 | const auto* col_from = | 1023 | 180 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 1024 | 180 | if (!col_from) { | 1025 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 1026 | 0 | named_from.column->get_name()); | 1027 | 0 | } | 1028 | | | 1029 | 180 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 1030 | 180 | UInt32 from_precision = from_decimal_type.get_precision(); | 1031 | 180 | UInt32 from_scale = from_decimal_type.get_scale(); | 1032 | | | 1033 | 180 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 1034 | 180 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 1035 | 180 | UInt32 to_precision = to_decimal_type.get_precision(); | 1036 | 180 | ToDataType::check_type_precision(to_precision); | 1037 | 180 | UInt32 to_scale = to_decimal_type.get_scale(); | 1038 | 180 | ToDataType::check_type_scale(to_scale); | 1039 | | | 1040 | 180 | auto from_max_int_digit_count = from_precision - from_scale; | 1041 | 180 | auto to_max_int_digit_count = to_precision - to_scale; | 1042 | 180 | bool narrow_integral = | 1043 | 180 | (to_max_int_digit_count < from_max_int_digit_count) || | 1044 | 180 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1045 | | // only in non-strict mode and may overflow, we set nullable | 1046 | 180 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1047 | | | 1048 | 180 | size_t size = col_from->size(); | 1049 | 180 | ColumnUInt8::MutablePtr col_null_map_to; | 1050 | 180 | NullMap::value_type* null_map_data = nullptr; | 1051 | 180 | if (narrow_integral) { | 1052 | 104 | col_null_map_to = ColumnUInt8::create(size, 0); | 1053 | 104 | null_map_data = col_null_map_to->get_data().data(); | 1054 | 104 | } | 1055 | 180 | CastParameters params; | 1056 | 180 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1057 | 180 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1058 | 180 | const auto& vec_from = col_from->get_data(); | 1059 | 180 | const auto* vec_from_data = vec_from.data(); | 1060 | 180 | auto& vec_to = col_to->get_data(); | 1061 | 180 | auto* vec_to_data = vec_to.data(); | 1062 | | | 1063 | 180 | using MaxFieldType = | 1064 | 180 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1065 | 180 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1066 | 180 | std::is_same_v<FromFieldType, Decimal128V3>), | 1067 | 180 | Decimal128V3, | 1068 | 180 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1069 | 180 | FromFieldType, ToFieldType>>; | 1070 | 180 | using MaxNativeType = typename MaxFieldType::NativeType; | 1071 | | | 1072 | 180 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1073 | 180 | bool multiply_may_overflow = false; | 1074 | 180 | if (to_scale > from_scale) { | 1075 | 86 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1076 | 86 | } | 1077 | | | 1078 | 180 | typename ToFieldType::NativeType max_result = | 1079 | 180 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1080 | 180 | typename ToFieldType::NativeType min_result = -max_result; | 1081 | | | 1082 | 180 | MaxNativeType multiplier {}; | 1083 | 180 | if (from_scale < to_scale) { | 1084 | 86 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1085 | 86 | from_scale); | 1086 | 94 | } else if (from_scale > to_scale) { | 1087 | 68 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1088 | 68 | to_scale); | 1089 | 68 | } | 1090 | 180 | RETURN_IF_ERROR(std::visit( | 1091 | 180 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1092 | 180 | for (size_t i = 0; i < size; i++) { | 1093 | 180 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1094 | 180 | multiply_may_overflow, narrow_integral>( | 1095 | 180 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1096 | 180 | to_precision, to_scale, min_result, max_result, multiplier, | 1097 | 180 | params)) { | 1098 | 180 | if (set_nullable) { | 1099 | 180 | null_map_data[i] = 1; | 1100 | 180 | } else { | 1101 | 180 | return params.status; | 1102 | 180 | } | 1103 | 180 | } | 1104 | 180 | } | 1105 | 180 | return Status::OK(); | 1106 | 180 | }, | 1107 | 180 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1108 | 180 | if (narrow_integral) { | 1109 | 104 | block.get_by_position(result).column = | 1110 | 104 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1111 | 104 | } else { | 1112 | 76 | block.get_by_position(result).column = std::move(col_to); | 1113 | 76 | } | 1114 | 180 | return Status::OK(); | 1115 | 180 | } |
|
1116 | | }; |
1117 | | } // namespace doris |