be/src/exprs/function/cast/cast_to_decimal.h
Line | Count | Source |
1 | | // Licensed to the Apache Software Foundation (ASF) under one |
2 | | // or more contributor license agreements. See the NOTICE file |
3 | | // distributed with this work for additional information |
4 | | // regarding copyright ownership. The ASF licenses this file |
5 | | // to you under the Apache License, Version 2.0 (the |
6 | | // "License"); you may not use this file except in compliance |
7 | | // with the License. You may obtain a copy of the License at |
8 | | // |
9 | | // http://www.apache.org/licenses/LICENSE-2.0 |
10 | | // |
11 | | // Unless required by applicable law or agreed to in writing, |
12 | | // software distributed under the License is distributed on an |
13 | | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
14 | | // KIND, either express or implied. See the License for the |
15 | | // specific language governing permissions and limitations |
16 | | // under the License. |
17 | | |
18 | | #pragma once |
19 | | |
20 | | #include <cmath> |
21 | | #include <type_traits> |
22 | | |
23 | | #include "common/status.h" |
24 | | #include "core/data_type/data_type_decimal.h" |
25 | | #include "core/data_type/data_type_number.h" |
26 | | #include "core/types.h" |
27 | | #include "exprs/function/cast/cast_to_basic_number_common.h" |
28 | | #include "util/io_helper.h" |
29 | | |
30 | | namespace doris { |
31 | | |
32 | | #define DECIMAL_CONVERT_OVERFLOW_ERROR(value, from_type_name, precision, scale) \ |
33 | 2.14k | Status(ErrorCode::ARITHMETIC_OVERFLOW_ERRROR, \ |
34 | 2.14k | fmt::format( \ |
35 | 2.14k | "Arithmetic overflow when converting value {} from type {} to decimal({}, {})", \ |
36 | 2.14k | value, from_type_name, precision, scale)) |
37 | | struct CastToDecimal { |
38 | | template <typename ToCppT> |
39 | | requires(IsDecimalNumber<ToCppT>) |
40 | | static inline bool from_string(const StringRef& from, ToCppT& to, UInt32 precision, |
41 | 110k | UInt32 scale, CastParameters& params) { |
42 | 110k | if constexpr (IsDecimalV2<ToCppT>) { |
43 | 14 | return StringParser::PARSE_SUCCESS == |
44 | 14 | try_read_decimal_text<TYPE_DECIMALV2>(to, from, precision, scale); |
45 | 14 | } |
46 | | |
47 | 29.7k | if constexpr (IsDecimal32<ToCppT>) { |
48 | 29.7k | return StringParser::PARSE_SUCCESS == |
49 | 29.7k | try_read_decimal_text<TYPE_DECIMAL32>(to, from, precision, scale); |
50 | 29.7k | } |
51 | | |
52 | 26.9k | if constexpr (IsDecimal64<ToCppT>) { |
53 | 26.9k | return StringParser::PARSE_SUCCESS == |
54 | 26.9k | try_read_decimal_text<TYPE_DECIMAL64>(to, from, precision, scale); |
55 | 26.9k | } |
56 | | |
57 | 26.9k | if constexpr (IsDecimal128V3<ToCppT>) { |
58 | 26.9k | return StringParser::PARSE_SUCCESS == |
59 | 26.9k | try_read_decimal_text<TYPE_DECIMAL128I>(to, from, precision, scale); |
60 | 26.9k | } |
61 | | |
62 | 26.8k | if constexpr (IsDecimal256<ToCppT>) { |
63 | 26.8k | return StringParser::PARSE_SUCCESS == |
64 | 26.8k | try_read_decimal_text<TYPE_DECIMAL256>(to, from, precision, scale); |
65 | 26.8k | } |
66 | 110k | } _ZN5doris13CastToDecimal11from_stringINS_7DecimalIiEEQ15IsDecimalNumberIT_EEEbRKNS_9StringRefERS4_jjRNS_14CastParametersE Line | Count | Source | 41 | 29.7k | UInt32 scale, CastParameters& params) { | 42 | | if constexpr (IsDecimalV2<ToCppT>) { | 43 | | return StringParser::PARSE_SUCCESS == | 44 | | try_read_decimal_text<TYPE_DECIMALV2>(to, from, precision, scale); | 45 | | } | 46 | | | 47 | 29.7k | if constexpr (IsDecimal32<ToCppT>) { | 48 | 29.7k | return StringParser::PARSE_SUCCESS == | 49 | 29.7k | try_read_decimal_text<TYPE_DECIMAL32>(to, from, precision, scale); | 50 | 29.7k | } | 51 | | | 52 | | if constexpr (IsDecimal64<ToCppT>) { | 53 | | return StringParser::PARSE_SUCCESS == | 54 | | try_read_decimal_text<TYPE_DECIMAL64>(to, from, precision, scale); | 55 | | } | 56 | | | 57 | | if constexpr (IsDecimal128V3<ToCppT>) { | 58 | | return StringParser::PARSE_SUCCESS == | 59 | | try_read_decimal_text<TYPE_DECIMAL128I>(to, from, precision, scale); | 60 | | } | 61 | | | 62 | | if constexpr (IsDecimal256<ToCppT>) { | 63 | | return StringParser::PARSE_SUCCESS == | 64 | | try_read_decimal_text<TYPE_DECIMAL256>(to, from, precision, scale); | 65 | | } | 66 | 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 | | return StringParser::PARSE_SUCCESS == | 44 | | try_read_decimal_text<TYPE_DECIMALV2>(to, from, precision, scale); | 45 | | } | 46 | | | 47 | | if constexpr (IsDecimal32<ToCppT>) { | 48 | | return StringParser::PARSE_SUCCESS == | 49 | | try_read_decimal_text<TYPE_DECIMAL32>(to, from, precision, scale); | 50 | | } | 51 | | | 52 | 26.9k | if constexpr (IsDecimal64<ToCppT>) { | 53 | 26.9k | return StringParser::PARSE_SUCCESS == | 54 | 26.9k | try_read_decimal_text<TYPE_DECIMAL64>(to, from, precision, scale); | 55 | 26.9k | } | 56 | | | 57 | | if constexpr (IsDecimal128V3<ToCppT>) { | 58 | | return StringParser::PARSE_SUCCESS == | 59 | | try_read_decimal_text<TYPE_DECIMAL128I>(to, from, precision, scale); | 60 | | } | 61 | | | 62 | | if constexpr (IsDecimal256<ToCppT>) { | 63 | | return StringParser::PARSE_SUCCESS == | 64 | | try_read_decimal_text<TYPE_DECIMAL256>(to, from, precision, scale); | 65 | | } | 66 | 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 | | return StringParser::PARSE_SUCCESS == | 44 | | try_read_decimal_text<TYPE_DECIMALV2>(to, from, precision, scale); | 45 | | } | 46 | | | 47 | | if constexpr (IsDecimal32<ToCppT>) { | 48 | | return StringParser::PARSE_SUCCESS == | 49 | | try_read_decimal_text<TYPE_DECIMAL32>(to, from, precision, scale); | 50 | | } | 51 | | | 52 | | if constexpr (IsDecimal64<ToCppT>) { | 53 | | return StringParser::PARSE_SUCCESS == | 54 | | try_read_decimal_text<TYPE_DECIMAL64>(to, from, precision, scale); | 55 | | } | 56 | | | 57 | 26.9k | if constexpr (IsDecimal128V3<ToCppT>) { | 58 | 26.9k | return StringParser::PARSE_SUCCESS == | 59 | 26.9k | try_read_decimal_text<TYPE_DECIMAL128I>(to, from, precision, scale); | 60 | 26.9k | } | 61 | | | 62 | | if constexpr (IsDecimal256<ToCppT>) { | 63 | | return StringParser::PARSE_SUCCESS == | 64 | | try_read_decimal_text<TYPE_DECIMAL256>(to, from, precision, scale); | 65 | | } | 66 | 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 | return StringParser::PARSE_SUCCESS == | 44 | 14 | try_read_decimal_text<TYPE_DECIMALV2>(to, from, precision, scale); | 45 | 14 | } | 46 | | | 47 | | if constexpr (IsDecimal32<ToCppT>) { | 48 | | return StringParser::PARSE_SUCCESS == | 49 | | try_read_decimal_text<TYPE_DECIMAL32>(to, from, precision, scale); | 50 | | } | 51 | | | 52 | | if constexpr (IsDecimal64<ToCppT>) { | 53 | | return StringParser::PARSE_SUCCESS == | 54 | | try_read_decimal_text<TYPE_DECIMAL64>(to, from, precision, scale); | 55 | | } | 56 | | | 57 | | if constexpr (IsDecimal128V3<ToCppT>) { | 58 | | return StringParser::PARSE_SUCCESS == | 59 | | try_read_decimal_text<TYPE_DECIMAL128I>(to, from, precision, scale); | 60 | | } | 61 | | | 62 | | if constexpr (IsDecimal256<ToCppT>) { | 63 | | return StringParser::PARSE_SUCCESS == | 64 | | try_read_decimal_text<TYPE_DECIMAL256>(to, from, precision, scale); | 65 | | } | 66 | 14 | } |
_ZN5doris13CastToDecimal11from_stringINS_7DecimalIN4wide7integerILm256EiEEEEQ15IsDecimalNumberIT_EEEbRKNS_9StringRefERS7_jjRNS_14CastParametersE Line | Count | Source | 41 | 26.8k | UInt32 scale, CastParameters& params) { | 42 | | if constexpr (IsDecimalV2<ToCppT>) { | 43 | | return StringParser::PARSE_SUCCESS == | 44 | | try_read_decimal_text<TYPE_DECIMALV2>(to, from, precision, scale); | 45 | | } | 46 | | | 47 | | if constexpr (IsDecimal32<ToCppT>) { | 48 | | return StringParser::PARSE_SUCCESS == | 49 | | try_read_decimal_text<TYPE_DECIMAL32>(to, from, precision, scale); | 50 | | } | 51 | | | 52 | | if constexpr (IsDecimal64<ToCppT>) { | 53 | | return StringParser::PARSE_SUCCESS == | 54 | | try_read_decimal_text<TYPE_DECIMAL64>(to, from, precision, scale); | 55 | | } | 56 | | | 57 | | if constexpr (IsDecimal128V3<ToCppT>) { | 58 | | return StringParser::PARSE_SUCCESS == | 59 | | try_read_decimal_text<TYPE_DECIMAL128I>(to, from, precision, scale); | 60 | | } | 61 | | | 62 | 26.8k | if constexpr (IsDecimal256<ToCppT>) { | 63 | 26.8k | return StringParser::PARSE_SUCCESS == | 64 | 26.8k | try_read_decimal_text<TYPE_DECIMAL256>(to, from, precision, scale); | 65 | 26.8k | } | 66 | 26.8k | } |
|
67 | | |
68 | | // cast int to decimal |
69 | | template <typename FromCppT, typename ToCppT, |
70 | | typename MaxNativeType = |
71 | | std::conditional_t<(sizeof(FromCppT) > sizeof(typename ToCppT::NativeType)), |
72 | | FromCppT, typename ToCppT::NativeType>> |
73 | | requires(IsDecimalNumber<ToCppT> && |
74 | | (IsCppTypeInt<FromCppT> || std::is_same_v<FromCppT, UInt8>)) |
75 | | static inline bool from_int(const FromCppT& from, ToCppT& to, UInt32 to_precision, |
76 | 7 | UInt32 to_scale, CastParameters& params) { |
77 | 7 | MaxNativeType scale_multiplier = |
78 | 7 | DataTypeDecimal<ToCppT::PType>::get_scale_multiplier(to_scale); |
79 | 7 | typename ToCppT::NativeType max_result = |
80 | 7 | DataTypeDecimal<ToCppT::PType>::get_max_digits_number(to_precision); |
81 | 7 | typename ToCppT::NativeType min_result = -max_result; |
82 | | |
83 | 7 | UInt32 from_precision = NumberTraits::max_ascii_len<FromCppT>(); |
84 | 7 | constexpr UInt32 from_scale = 0; |
85 | 7 | constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToCppT::NativeType>(); |
86 | | |
87 | 7 | auto from_max_int_digit_count = from_precision - from_scale; |
88 | 7 | auto to_max_int_digit_count = to_precision - to_scale; |
89 | 7 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); |
90 | 7 | bool multiply_may_overflow = false; |
91 | 7 | if (to_scale > from_scale) { |
92 | 7 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; |
93 | 7 | } |
94 | 7 | return std::visit( |
95 | 7 | [&](auto multiply_may_overflow, auto narrow_integral) { |
96 | 7 | return _from_int<FromCppT, ToCppT, multiply_may_overflow, narrow_integral>( |
97 | 7 | from, to, to_precision, to_scale, scale_multiplier, min_result, |
98 | 7 | max_result, params); |
99 | 7 | }, _ZZN5doris13CastToDecimal8from_intIhNS_7DecimalIiEEiQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRNS_14CastParametersEENKUlS5_S4_E_clISt17integral_constantIbLb0EESE_EEDaS5_S4_ Line | Count | Source | 95 | 2 | [&](auto multiply_may_overflow, auto narrow_integral) { | 96 | 2 | return _from_int<FromCppT, ToCppT, multiply_may_overflow, narrow_integral>( | 97 | 2 | from, to, to_precision, to_scale, scale_multiplier, min_result, | 98 | 2 | max_result, params); | 99 | 2 | }, |
Unexecuted instantiation: _ZZN5doris13CastToDecimal8from_intIhNS_7DecimalIiEEiQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRNS_14CastParametersEENKUlS5_S4_E_clISt17integral_constantIbLb0EESD_IbLb1EEEEDaS5_S4_ Unexecuted instantiation: _ZZN5doris13CastToDecimal8from_intIhNS_7DecimalIiEEiQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRNS_14CastParametersEENKUlS5_S4_E_clISt17integral_constantIbLb1EESD_IbLb0EEEEDaS5_S4_ Unexecuted instantiation: _ZZN5doris13CastToDecimal8from_intIhNS_7DecimalIiEEiQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRNS_14CastParametersEENKUlS5_S4_E_clISt17integral_constantIbLb1EESE_EEDaS5_S4_ _ZZN5doris13CastToDecimal8from_intIaNS_7DecimalIiEEiQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRNS_14CastParametersEENKUlS5_S4_E_clISt17integral_constantIbLb0EESE_EEDaS5_S4_ Line | Count | Source | 95 | 1 | [&](auto multiply_may_overflow, auto narrow_integral) { | 96 | 1 | return _from_int<FromCppT, ToCppT, multiply_may_overflow, narrow_integral>( | 97 | 1 | from, to, to_precision, to_scale, scale_multiplier, min_result, | 98 | 1 | max_result, params); | 99 | 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 | 95 | 1 | [&](auto multiply_may_overflow, auto narrow_integral) { | 96 | 1 | return _from_int<FromCppT, ToCppT, multiply_may_overflow, narrow_integral>( | 97 | 1 | from, to, to_precision, to_scale, scale_multiplier, min_result, | 98 | 1 | max_result, params); | 99 | 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 | 95 | 1 | [&](auto multiply_may_overflow, auto narrow_integral) { | 96 | 1 | return _from_int<FromCppT, ToCppT, multiply_may_overflow, narrow_integral>( | 97 | 1 | from, to, to_precision, to_scale, scale_multiplier, min_result, | 98 | 1 | max_result, params); | 99 | 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 | 95 | 1 | [&](auto multiply_may_overflow, auto narrow_integral) { | 96 | 1 | return _from_int<FromCppT, ToCppT, multiply_may_overflow, narrow_integral>( | 97 | 1 | from, to, to_precision, to_scale, scale_multiplier, min_result, | 98 | 1 | max_result, params); | 99 | 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 | 95 | 1 | [&](auto multiply_may_overflow, auto narrow_integral) { | 96 | 1 | return _from_int<FromCppT, ToCppT, multiply_may_overflow, narrow_integral>( | 97 | 1 | from, to, to_precision, to_scale, scale_multiplier, min_result, | 98 | 1 | max_result, params); | 99 | 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_ |
100 | 7 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral)); |
101 | 7 | } _ZN5doris13CastToDecimal8from_intIhNS_7DecimalIiEEiQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRNS_14CastParametersE Line | Count | Source | 76 | 2 | UInt32 to_scale, CastParameters& params) { | 77 | 2 | MaxNativeType scale_multiplier = | 78 | 2 | DataTypeDecimal<ToCppT::PType>::get_scale_multiplier(to_scale); | 79 | 2 | typename ToCppT::NativeType max_result = | 80 | 2 | DataTypeDecimal<ToCppT::PType>::get_max_digits_number(to_precision); | 81 | 2 | typename ToCppT::NativeType min_result = -max_result; | 82 | | | 83 | 2 | UInt32 from_precision = NumberTraits::max_ascii_len<FromCppT>(); | 84 | 2 | constexpr UInt32 from_scale = 0; | 85 | 2 | constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToCppT::NativeType>(); | 86 | | | 87 | 2 | auto from_max_int_digit_count = from_precision - from_scale; | 88 | 2 | auto to_max_int_digit_count = to_precision - to_scale; | 89 | 2 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 90 | 2 | bool multiply_may_overflow = false; | 91 | 2 | if (to_scale > from_scale) { | 92 | 2 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 93 | 2 | } | 94 | 2 | return std::visit( | 95 | 2 | [&](auto multiply_may_overflow, auto narrow_integral) { | 96 | 2 | return _from_int<FromCppT, ToCppT, multiply_may_overflow, narrow_integral>( | 97 | 2 | from, to, to_precision, to_scale, scale_multiplier, min_result, | 98 | 2 | max_result, params); | 99 | 2 | }, | 100 | 2 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral)); | 101 | 2 | } |
_ZN5doris13CastToDecimal8from_intIaNS_7DecimalIiEEiQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRNS_14CastParametersE Line | Count | Source | 76 | 1 | UInt32 to_scale, CastParameters& params) { | 77 | 1 | MaxNativeType scale_multiplier = | 78 | 1 | DataTypeDecimal<ToCppT::PType>::get_scale_multiplier(to_scale); | 79 | 1 | typename ToCppT::NativeType max_result = | 80 | 1 | DataTypeDecimal<ToCppT::PType>::get_max_digits_number(to_precision); | 81 | 1 | typename ToCppT::NativeType min_result = -max_result; | 82 | | | 83 | 1 | UInt32 from_precision = NumberTraits::max_ascii_len<FromCppT>(); | 84 | 1 | constexpr UInt32 from_scale = 0; | 85 | 1 | constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToCppT::NativeType>(); | 86 | | | 87 | 1 | auto from_max_int_digit_count = from_precision - from_scale; | 88 | 1 | auto to_max_int_digit_count = to_precision - to_scale; | 89 | 1 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 90 | 1 | bool multiply_may_overflow = false; | 91 | 1 | if (to_scale > from_scale) { | 92 | 1 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 93 | 1 | } | 94 | 1 | return std::visit( | 95 | 1 | [&](auto multiply_may_overflow, auto narrow_integral) { | 96 | 1 | return _from_int<FromCppT, ToCppT, multiply_may_overflow, narrow_integral>( | 97 | 1 | from, to, to_precision, to_scale, scale_multiplier, min_result, | 98 | 1 | max_result, params); | 99 | 1 | }, | 100 | 1 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral)); | 101 | 1 | } |
_ZN5doris13CastToDecimal8from_intIsNS_7DecimalIiEEiQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRNS_14CastParametersE Line | Count | Source | 76 | 1 | UInt32 to_scale, CastParameters& params) { | 77 | 1 | MaxNativeType scale_multiplier = | 78 | 1 | DataTypeDecimal<ToCppT::PType>::get_scale_multiplier(to_scale); | 79 | 1 | typename ToCppT::NativeType max_result = | 80 | 1 | DataTypeDecimal<ToCppT::PType>::get_max_digits_number(to_precision); | 81 | 1 | typename ToCppT::NativeType min_result = -max_result; | 82 | | | 83 | 1 | UInt32 from_precision = NumberTraits::max_ascii_len<FromCppT>(); | 84 | 1 | constexpr UInt32 from_scale = 0; | 85 | 1 | constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToCppT::NativeType>(); | 86 | | | 87 | 1 | auto from_max_int_digit_count = from_precision - from_scale; | 88 | 1 | auto to_max_int_digit_count = to_precision - to_scale; | 89 | 1 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 90 | 1 | bool multiply_may_overflow = false; | 91 | 1 | if (to_scale > from_scale) { | 92 | 1 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 93 | 1 | } | 94 | 1 | return std::visit( | 95 | 1 | [&](auto multiply_may_overflow, auto narrow_integral) { | 96 | 1 | return _from_int<FromCppT, ToCppT, multiply_may_overflow, narrow_integral>( | 97 | 1 | from, to, to_precision, to_scale, scale_multiplier, min_result, | 98 | 1 | max_result, params); | 99 | 1 | }, | 100 | 1 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral)); | 101 | 1 | } |
_ZN5doris13CastToDecimal8from_intIiNS_7DecimalIiEEiQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRNS_14CastParametersE Line | Count | Source | 76 | 1 | UInt32 to_scale, CastParameters& params) { | 77 | 1 | MaxNativeType scale_multiplier = | 78 | 1 | DataTypeDecimal<ToCppT::PType>::get_scale_multiplier(to_scale); | 79 | 1 | typename ToCppT::NativeType max_result = | 80 | 1 | DataTypeDecimal<ToCppT::PType>::get_max_digits_number(to_precision); | 81 | 1 | typename ToCppT::NativeType min_result = -max_result; | 82 | | | 83 | 1 | UInt32 from_precision = NumberTraits::max_ascii_len<FromCppT>(); | 84 | 1 | constexpr UInt32 from_scale = 0; | 85 | 1 | constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToCppT::NativeType>(); | 86 | | | 87 | 1 | auto from_max_int_digit_count = from_precision - from_scale; | 88 | 1 | auto to_max_int_digit_count = to_precision - to_scale; | 89 | 1 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 90 | 1 | bool multiply_may_overflow = false; | 91 | 1 | if (to_scale > from_scale) { | 92 | 1 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 93 | 1 | } | 94 | 1 | return std::visit( | 95 | 1 | [&](auto multiply_may_overflow, auto narrow_integral) { | 96 | 1 | return _from_int<FromCppT, ToCppT, multiply_may_overflow, narrow_integral>( | 97 | 1 | from, to, to_precision, to_scale, scale_multiplier, min_result, | 98 | 1 | max_result, params); | 99 | 1 | }, | 100 | 1 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral)); | 101 | 1 | } |
_ZN5doris13CastToDecimal8from_intIlNS_7DecimalIiEElQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRNS_14CastParametersE Line | Count | Source | 76 | 1 | UInt32 to_scale, CastParameters& params) { | 77 | 1 | MaxNativeType scale_multiplier = | 78 | 1 | DataTypeDecimal<ToCppT::PType>::get_scale_multiplier(to_scale); | 79 | 1 | typename ToCppT::NativeType max_result = | 80 | 1 | DataTypeDecimal<ToCppT::PType>::get_max_digits_number(to_precision); | 81 | 1 | typename ToCppT::NativeType min_result = -max_result; | 82 | | | 83 | 1 | UInt32 from_precision = NumberTraits::max_ascii_len<FromCppT>(); | 84 | 1 | constexpr UInt32 from_scale = 0; | 85 | 1 | constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToCppT::NativeType>(); | 86 | | | 87 | 1 | auto from_max_int_digit_count = from_precision - from_scale; | 88 | 1 | auto to_max_int_digit_count = to_precision - to_scale; | 89 | 1 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 90 | 1 | bool multiply_may_overflow = false; | 91 | 1 | if (to_scale > from_scale) { | 92 | 1 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 93 | 1 | } | 94 | 1 | return std::visit( | 95 | 1 | [&](auto multiply_may_overflow, auto narrow_integral) { | 96 | 1 | return _from_int<FromCppT, ToCppT, multiply_may_overflow, narrow_integral>( | 97 | 1 | from, to, to_precision, to_scale, scale_multiplier, min_result, | 98 | 1 | max_result, params); | 99 | 1 | }, | 100 | 1 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral)); | 101 | 1 | } |
_ZN5doris13CastToDecimal8from_intInNS_7DecimalIiEEnQaa15IsDecimalNumberIT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRNS_14CastParametersE Line | Count | Source | 76 | 1 | UInt32 to_scale, CastParameters& params) { | 77 | 1 | MaxNativeType scale_multiplier = | 78 | 1 | DataTypeDecimal<ToCppT::PType>::get_scale_multiplier(to_scale); | 79 | 1 | typename ToCppT::NativeType max_result = | 80 | 1 | DataTypeDecimal<ToCppT::PType>::get_max_digits_number(to_precision); | 81 | 1 | typename ToCppT::NativeType min_result = -max_result; | 82 | | | 83 | 1 | UInt32 from_precision = NumberTraits::max_ascii_len<FromCppT>(); | 84 | 1 | constexpr UInt32 from_scale = 0; | 85 | 1 | constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToCppT::NativeType>(); | 86 | | | 87 | 1 | auto from_max_int_digit_count = from_precision - from_scale; | 88 | 1 | auto to_max_int_digit_count = to_precision - to_scale; | 89 | 1 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 90 | 1 | bool multiply_may_overflow = false; | 91 | 1 | if (to_scale > from_scale) { | 92 | 1 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 93 | 1 | } | 94 | 1 | return std::visit( | 95 | 1 | [&](auto multiply_may_overflow, auto narrow_integral) { | 96 | 1 | return _from_int<FromCppT, ToCppT, multiply_may_overflow, narrow_integral>( | 97 | 1 | from, to, to_precision, to_scale, scale_multiplier, min_result, | 98 | 1 | max_result, params); | 99 | 1 | }, | 100 | 1 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral)); | 101 | 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 |
102 | | |
103 | | // cast bool to decimal |
104 | | template <typename FromCppT, typename ToCppT, |
105 | | typename MaxNativeType = |
106 | | std::conditional_t<(sizeof(FromCppT) > sizeof(typename ToCppT::NativeType)), |
107 | | FromCppT, typename ToCppT::NativeType>> |
108 | | requires(IsDecimalNumber<ToCppT> && std::is_same_v<FromCppT, UInt8>) |
109 | | static inline bool from_bool(const FromCppT& from, ToCppT& to, UInt32 to_precision, |
110 | 2 | UInt32 to_scale, CastParameters& params) { |
111 | 2 | return from_int<FromCppT, ToCppT, MaxNativeType>(from, to, to_precision, to_scale, params); |
112 | 2 | } _ZN5doris13CastToDecimal9from_boolIhNS_7DecimalIiEEiQaa15IsDecimalNumberIT0_Esr3stdE9is_same_vIT_hEEEbRKS5_RS4_jjRNS_14CastParametersE Line | Count | Source | 110 | 2 | UInt32 to_scale, CastParameters& params) { | 111 | 2 | return from_int<FromCppT, ToCppT, MaxNativeType>(from, to, to_precision, to_scale, params); | 112 | 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 |
113 | | |
114 | | template <typename FromCppT, typename ToCppT> |
115 | | requires(IsDecimalNumber<ToCppT> && IsCppTypeFloat<FromCppT>) |
116 | | static inline bool from_float(const FromCppT& from, ToCppT& to, UInt32 to_precision, |
117 | 2 | UInt32 to_scale, CastParameters& params) { |
118 | 2 | typename ToCppT::NativeType scale_multiplier = |
119 | 2 | DataTypeDecimal<ToCppT::PType>::get_scale_multiplier(to_scale); |
120 | 2 | typename ToCppT::NativeType max_result = |
121 | 2 | DataTypeDecimal<ToCppT::PType>::get_max_digits_number(to_precision); |
122 | 2 | typename ToCppT::NativeType min_result = -max_result; |
123 | | |
124 | 2 | return _from_float<FromCppT, ToCppT>(from, to, to_precision, to_scale, scale_multiplier, |
125 | 2 | min_result, max_result, params); |
126 | 2 | } _ZN5doris13CastToDecimal10from_floatIdNS_7DecimalIiEEQaa15IsDecimalNumberIT0_E14IsCppTypeFloatIT_EEEbRKS5_RS4_jjRNS_14CastParametersE Line | Count | Source | 117 | 1 | UInt32 to_scale, CastParameters& params) { | 118 | 1 | typename ToCppT::NativeType scale_multiplier = | 119 | 1 | DataTypeDecimal<ToCppT::PType>::get_scale_multiplier(to_scale); | 120 | 1 | typename ToCppT::NativeType max_result = | 121 | 1 | DataTypeDecimal<ToCppT::PType>::get_max_digits_number(to_precision); | 122 | 1 | typename ToCppT::NativeType min_result = -max_result; | 123 | | | 124 | 1 | return _from_float<FromCppT, ToCppT>(from, to, to_precision, to_scale, scale_multiplier, | 125 | 1 | min_result, max_result, params); | 126 | 1 | } |
_ZN5doris13CastToDecimal10from_floatIfNS_7DecimalIiEEQaa15IsDecimalNumberIT0_E14IsCppTypeFloatIT_EEEbRKS5_RS4_jjRNS_14CastParametersE Line | Count | Source | 117 | 1 | UInt32 to_scale, CastParameters& params) { | 118 | 1 | typename ToCppT::NativeType scale_multiplier = | 119 | 1 | DataTypeDecimal<ToCppT::PType>::get_scale_multiplier(to_scale); | 120 | 1 | typename ToCppT::NativeType max_result = | 121 | 1 | DataTypeDecimal<ToCppT::PType>::get_max_digits_number(to_precision); | 122 | 1 | typename ToCppT::NativeType min_result = -max_result; | 123 | | | 124 | 1 | return _from_float<FromCppT, ToCppT>(from, to, to_precision, to_scale, scale_multiplier, | 125 | 1 | min_result, max_result, params); | 126 | 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 |
127 | | |
128 | | template <typename FromCppT, typename ToCppT> |
129 | | requires(IsDecimalNumber<ToCppT> && IsCppTypeFloat<FromCppT> && !IsDecimal128V2<ToCppT>) |
130 | | static inline bool _from_float(const FromCppT& from, ToCppT& to, UInt32 to_precision, |
131 | | UInt32 to_scale, |
132 | | const typename ToCppT::NativeType& scale_multiplier, |
133 | | const typename ToCppT::NativeType& min_result, |
134 | | const typename ToCppT::NativeType& max_result, |
135 | 3.35k | CastParameters& params) { |
136 | 3.35k | if (!std::isfinite(from)) { |
137 | 196 | params.status = Status(ErrorCode::ARITHMETIC_OVERFLOW_ERRROR, |
138 | 196 | "Decimal convert overflow. Cannot convert infinity or NaN " |
139 | 196 | "to decimal"); |
140 | 196 | return false; |
141 | 196 | } |
142 | | // For decimal256, we need to use long double to avoid overflow when |
143 | | // static casting the multiplier to floating type, and also to be as precise as possible; |
144 | | // For other decimal types, we use double to be as precise as possible. |
145 | 3.15k | using DoubleType = std::conditional_t<IsDecimal256<ToCppT>, long double, double>; |
146 | 3.15k | DoubleType tmp = from * static_cast<DoubleType>(scale_multiplier); |
147 | 3.15k | if (tmp <= DoubleType(min_result) || tmp >= DoubleType(max_result)) { |
148 | 92 | if (params.is_strict) { |
149 | 46 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, "float/double", to_precision, |
150 | 46 | to_scale); |
151 | 46 | } |
152 | 92 | return false; |
153 | 92 | } |
154 | 3.06k | to.value = static_cast<typename ToCppT::NativeType>(static_cast<double>( |
155 | 3.06k | from * static_cast<DoubleType>(scale_multiplier) + ((from >= 0) ? 0.5 : -0.5))); |
156 | 3.06k | return true; |
157 | 3.15k | } _ZN5doris13CastToDecimal11_from_floatIdNS_7DecimalIiEEQaaaa15IsDecimalNumberIT0_E14IsCppTypeFloatIT_Ent14IsDecimal128V2IS4_EEEbRKS5_RS4_jjRKNS4_10NativeTypeESB_SB_RNS_14CastParametersE Line | Count | Source | 135 | 441 | CastParameters& params) { | 136 | 441 | if (!std::isfinite(from)) { | 137 | 24 | params.status = Status(ErrorCode::ARITHMETIC_OVERFLOW_ERRROR, | 138 | 24 | "Decimal convert overflow. Cannot convert infinity or NaN " | 139 | 24 | "to decimal"); | 140 | 24 | return false; | 141 | 24 | } | 142 | | // For decimal256, we need to use long double to avoid overflow when | 143 | | // static casting the multiplier to floating type, and also to be as precise as possible; | 144 | | // For other decimal types, we use double to be as precise as possible. | 145 | 417 | using DoubleType = std::conditional_t<IsDecimal256<ToCppT>, long double, double>; | 146 | 417 | DoubleType tmp = from * static_cast<DoubleType>(scale_multiplier); | 147 | 417 | if (tmp <= DoubleType(min_result) || tmp >= DoubleType(max_result)) { | 148 | 12 | if (params.is_strict) { | 149 | 6 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, "float/double", to_precision, | 150 | 6 | to_scale); | 151 | 6 | } | 152 | 12 | return false; | 153 | 12 | } | 154 | 405 | to.value = static_cast<typename ToCppT::NativeType>(static_cast<double>( | 155 | 405 | from * static_cast<DoubleType>(scale_multiplier) + ((from >= 0) ? 0.5 : -0.5))); | 156 | 405 | return true; | 157 | 417 | } |
_ZN5doris13CastToDecimal11_from_floatIfNS_7DecimalIiEEQaaaa15IsDecimalNumberIT0_E14IsCppTypeFloatIT_Ent14IsDecimal128V2IS4_EEEbRKS5_RS4_jjRKNS4_10NativeTypeESB_SB_RNS_14CastParametersE Line | Count | Source | 135 | 429 | CastParameters& params) { | 136 | 429 | if (!std::isfinite(from)) { | 137 | 24 | params.status = Status(ErrorCode::ARITHMETIC_OVERFLOW_ERRROR, | 138 | 24 | "Decimal convert overflow. Cannot convert infinity or NaN " | 139 | 24 | "to decimal"); | 140 | 24 | return false; | 141 | 24 | } | 142 | | // For decimal256, we need to use long double to avoid overflow when | 143 | | // static casting the multiplier to floating type, and also to be as precise as possible; | 144 | | // For other decimal types, we use double to be as precise as possible. | 145 | 405 | using DoubleType = std::conditional_t<IsDecimal256<ToCppT>, long double, double>; | 146 | 405 | DoubleType tmp = from * static_cast<DoubleType>(scale_multiplier); | 147 | 405 | if (tmp <= DoubleType(min_result) || tmp >= DoubleType(max_result)) { | 148 | 12 | if (params.is_strict) { | 149 | 6 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, "float/double", to_precision, | 150 | 6 | to_scale); | 151 | 6 | } | 152 | 12 | return false; | 153 | 12 | } | 154 | 393 | to.value = static_cast<typename ToCppT::NativeType>(static_cast<double>( | 155 | 393 | from * static_cast<DoubleType>(scale_multiplier) + ((from >= 0) ? 0.5 : -0.5))); | 156 | 393 | return true; | 157 | 405 | } |
_ZN5doris13CastToDecimal11_from_floatIdNS_7DecimalIlEEQaaaa15IsDecimalNumberIT0_E14IsCppTypeFloatIT_Ent14IsDecimal128V2IS4_EEEbRKS5_RS4_jjRKNS4_10NativeTypeESB_SB_RNS_14CastParametersE Line | Count | Source | 135 | 428 | CastParameters& params) { | 136 | 428 | if (!std::isfinite(from)) { | 137 | 24 | params.status = Status(ErrorCode::ARITHMETIC_OVERFLOW_ERRROR, | 138 | 24 | "Decimal convert overflow. Cannot convert infinity or NaN " | 139 | 24 | "to decimal"); | 140 | 24 | return false; | 141 | 24 | } | 142 | | // For decimal256, we need to use long double to avoid overflow when | 143 | | // static casting the multiplier to floating type, and also to be as precise as possible; | 144 | | // For other decimal types, we use double to be as precise as possible. | 145 | 404 | using DoubleType = std::conditional_t<IsDecimal256<ToCppT>, long double, double>; | 146 | 404 | DoubleType tmp = from * static_cast<DoubleType>(scale_multiplier); | 147 | 404 | if (tmp <= DoubleType(min_result) || tmp >= DoubleType(max_result)) { | 148 | 12 | if (params.is_strict) { | 149 | 6 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, "float/double", to_precision, | 150 | 6 | to_scale); | 151 | 6 | } | 152 | 12 | return false; | 153 | 12 | } | 154 | 392 | to.value = static_cast<typename ToCppT::NativeType>(static_cast<double>( | 155 | 392 | from * static_cast<DoubleType>(scale_multiplier) + ((from >= 0) ? 0.5 : -0.5))); | 156 | 392 | return true; | 157 | 404 | } |
_ZN5doris13CastToDecimal11_from_floatIfNS_7DecimalIlEEQaaaa15IsDecimalNumberIT0_E14IsCppTypeFloatIT_Ent14IsDecimal128V2IS4_EEEbRKS5_RS4_jjRKNS4_10NativeTypeESB_SB_RNS_14CastParametersE Line | Count | Source | 135 | 380 | CastParameters& params) { | 136 | 380 | if (!std::isfinite(from)) { | 137 | 24 | params.status = Status(ErrorCode::ARITHMETIC_OVERFLOW_ERRROR, | 138 | 24 | "Decimal convert overflow. Cannot convert infinity or NaN " | 139 | 24 | "to decimal"); | 140 | 24 | return false; | 141 | 24 | } | 142 | | // For decimal256, we need to use long double to avoid overflow when | 143 | | // static casting the multiplier to floating type, and also to be as precise as possible; | 144 | | // For other decimal types, we use double to be as precise as possible. | 145 | 356 | using DoubleType = std::conditional_t<IsDecimal256<ToCppT>, long double, double>; | 146 | 356 | DoubleType tmp = from * static_cast<DoubleType>(scale_multiplier); | 147 | 356 | if (tmp <= DoubleType(min_result) || tmp >= DoubleType(max_result)) { | 148 | 12 | if (params.is_strict) { | 149 | 6 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, "float/double", to_precision, | 150 | 6 | to_scale); | 151 | 6 | } | 152 | 12 | return false; | 153 | 12 | } | 154 | 344 | to.value = static_cast<typename ToCppT::NativeType>(static_cast<double>( | 155 | 344 | from * static_cast<DoubleType>(scale_multiplier) + ((from >= 0) ? 0.5 : -0.5))); | 156 | 344 | return true; | 157 | 356 | } |
_ZN5doris13CastToDecimal11_from_floatIdNS_12Decimal128V3EQaaaa15IsDecimalNumberIT0_E14IsCppTypeFloatIT_Ent14IsDecimal128V2IS3_EEEbRKS4_RS3_jjRKNS3_10NativeTypeESA_SA_RNS_14CastParametersE Line | Count | Source | 135 | 372 | CastParameters& params) { | 136 | 372 | if (!std::isfinite(from)) { | 137 | 24 | params.status = Status(ErrorCode::ARITHMETIC_OVERFLOW_ERRROR, | 138 | 24 | "Decimal convert overflow. Cannot convert infinity or NaN " | 139 | 24 | "to decimal"); | 140 | 24 | return false; | 141 | 24 | } | 142 | | // For decimal256, we need to use long double to avoid overflow when | 143 | | // static casting the multiplier to floating type, and also to be as precise as possible; | 144 | | // For other decimal types, we use double to be as precise as possible. | 145 | 348 | using DoubleType = std::conditional_t<IsDecimal256<ToCppT>, long double, double>; | 146 | 348 | DoubleType tmp = from * static_cast<DoubleType>(scale_multiplier); | 147 | 348 | if (tmp <= DoubleType(min_result) || tmp >= DoubleType(max_result)) { | 148 | 12 | if (params.is_strict) { | 149 | 6 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, "float/double", to_precision, | 150 | 6 | to_scale); | 151 | 6 | } | 152 | 12 | return false; | 153 | 12 | } | 154 | 336 | to.value = static_cast<typename ToCppT::NativeType>(static_cast<double>( | 155 | 336 | from * static_cast<DoubleType>(scale_multiplier) + ((from >= 0) ? 0.5 : -0.5))); | 156 | 336 | return true; | 157 | 348 | } |
_ZN5doris13CastToDecimal11_from_floatIfNS_12Decimal128V3EQaaaa15IsDecimalNumberIT0_E14IsCppTypeFloatIT_Ent14IsDecimal128V2IS3_EEEbRKS4_RS3_jjRKNS3_10NativeTypeESA_SA_RNS_14CastParametersE Line | Count | Source | 135 | 444 | CastParameters& params) { | 136 | 444 | if (!std::isfinite(from)) { | 137 | 24 | params.status = Status(ErrorCode::ARITHMETIC_OVERFLOW_ERRROR, | 138 | 24 | "Decimal convert overflow. Cannot convert infinity or NaN " | 139 | 24 | "to decimal"); | 140 | 24 | return false; | 141 | 24 | } | 142 | | // For decimal256, we need to use long double to avoid overflow when | 143 | | // static casting the multiplier to floating type, and also to be as precise as possible; | 144 | | // For other decimal types, we use double to be as precise as possible. | 145 | 420 | using DoubleType = std::conditional_t<IsDecimal256<ToCppT>, long double, double>; | 146 | 420 | DoubleType tmp = from * static_cast<DoubleType>(scale_multiplier); | 147 | 420 | if (tmp <= DoubleType(min_result) || tmp >= DoubleType(max_result)) { | 148 | 12 | if (params.is_strict) { | 149 | 6 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, "float/double", to_precision, | 150 | 6 | to_scale); | 151 | 6 | } | 152 | 12 | return false; | 153 | 12 | } | 154 | 408 | to.value = static_cast<typename ToCppT::NativeType>(static_cast<double>( | 155 | 408 | from * static_cast<DoubleType>(scale_multiplier) + ((from >= 0) ? 0.5 : -0.5))); | 156 | 408 | return true; | 157 | 420 | } |
_ZN5doris13CastToDecimal11_from_floatIdNS_7DecimalIN4wide7integerILm256EiEEEEQaaaa15IsDecimalNumberIT0_E14IsCppTypeFloatIT_Ent14IsDecimal128V2IS7_EEEbRKS8_RS7_jjRKNS7_10NativeTypeESE_SE_RNS_14CastParametersE Line | Count | Source | 135 | 436 | CastParameters& params) { | 136 | 436 | if (!std::isfinite(from)) { | 137 | 24 | params.status = Status(ErrorCode::ARITHMETIC_OVERFLOW_ERRROR, | 138 | 24 | "Decimal convert overflow. Cannot convert infinity or NaN " | 139 | 24 | "to decimal"); | 140 | 24 | return false; | 141 | 24 | } | 142 | | // For decimal256, we need to use long double to avoid overflow when | 143 | | // static casting the multiplier to floating type, and also to be as precise as possible; | 144 | | // For other decimal types, we use double to be as precise as possible. | 145 | 412 | using DoubleType = std::conditional_t<IsDecimal256<ToCppT>, long double, double>; | 146 | 412 | DoubleType tmp = from * static_cast<DoubleType>(scale_multiplier); | 147 | 412 | if (tmp <= DoubleType(min_result) || tmp >= DoubleType(max_result)) { | 148 | 12 | if (params.is_strict) { | 149 | 6 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, "float/double", to_precision, | 150 | 6 | to_scale); | 151 | 6 | } | 152 | 12 | return false; | 153 | 12 | } | 154 | 400 | to.value = static_cast<typename ToCppT::NativeType>(static_cast<double>( | 155 | 400 | from * static_cast<DoubleType>(scale_multiplier) + ((from >= 0) ? 0.5 : -0.5))); | 156 | 400 | return true; | 157 | 412 | } |
_ZN5doris13CastToDecimal11_from_floatIfNS_7DecimalIN4wide7integerILm256EiEEEEQaaaa15IsDecimalNumberIT0_E14IsCppTypeFloatIT_Ent14IsDecimal128V2IS7_EEEbRKS8_RS7_jjRKNS7_10NativeTypeESE_SE_RNS_14CastParametersE Line | Count | Source | 135 | 424 | CastParameters& params) { | 136 | 424 | if (!std::isfinite(from)) { | 137 | 28 | params.status = Status(ErrorCode::ARITHMETIC_OVERFLOW_ERRROR, | 138 | 28 | "Decimal convert overflow. Cannot convert infinity or NaN " | 139 | 28 | "to decimal"); | 140 | 28 | return false; | 141 | 28 | } | 142 | | // For decimal256, we need to use long double to avoid overflow when | 143 | | // static casting the multiplier to floating type, and also to be as precise as possible; | 144 | | // For other decimal types, we use double to be as precise as possible. | 145 | 396 | using DoubleType = std::conditional_t<IsDecimal256<ToCppT>, long double, double>; | 146 | 396 | DoubleType tmp = from * static_cast<DoubleType>(scale_multiplier); | 147 | 396 | if (tmp <= DoubleType(min_result) || tmp >= DoubleType(max_result)) { | 148 | 8 | if (params.is_strict) { | 149 | 4 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, "float/double", to_precision, | 150 | 4 | to_scale); | 151 | 4 | } | 152 | 8 | return false; | 153 | 8 | } | 154 | 388 | to.value = static_cast<typename ToCppT::NativeType>(static_cast<double>( | 155 | 388 | from * static_cast<DoubleType>(scale_multiplier) + ((from >= 0) ? 0.5 : -0.5))); | 156 | 388 | return true; | 157 | 396 | } |
|
158 | | template <typename FromCppT, typename ToCppT> |
159 | | requires(IsDecimal128V2<ToCppT> && IsCppTypeFloat<FromCppT>) |
160 | | static inline bool _from_float(const FromCppT& from, ToCppT& to, UInt32 to_precision, |
161 | | UInt32 to_scale, |
162 | | const typename ToCppT::NativeType& scale_multiplier, |
163 | | const typename ToCppT::NativeType& min_result, |
164 | | const typename ToCppT::NativeType& max_result, |
165 | 0 | CastParameters& params) { |
166 | 0 | if (!std::isfinite(from)) { |
167 | 0 | params.status = Status(ErrorCode::ARITHMETIC_OVERFLOW_ERRROR, |
168 | 0 | "Decimal convert overflow. Cannot convert infinity or NaN " |
169 | 0 | "to decimal"); |
170 | 0 | return false; |
171 | 0 | } |
172 | | // For decimal256, we need to use long double to avoid overflow when |
173 | | // static casting the multiplier to floating type, and also to be as precise as possible; |
174 | | // For other decimal types, we use double to be as precise as possible. |
175 | 0 | using DoubleType = std::conditional_t<IsDecimal256<ToCppT>, long double, double>; |
176 | 0 | DoubleType tmp = from * static_cast<DoubleType>(scale_multiplier); |
177 | 0 | if (tmp <= DoubleType(min_result) || tmp >= DoubleType(max_result)) { |
178 | 0 | if (params.is_strict) { |
179 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, "float/double", to_precision, |
180 | 0 | to_scale); |
181 | 0 | } |
182 | 0 | return false; |
183 | 0 | } |
184 | 0 | to = DecimalV2Value(static_cast<typename ToCppT::NativeType>(static_cast<double>( |
185 | 0 | from * static_cast<DoubleType>(scale_multiplier) + ((from >= 0) ? 0.5 : -0.5)))); |
186 | 0 | return true; |
187 | 0 | } Unexecuted instantiation: _ZN5doris13CastToDecimal11_from_floatIfNS_14DecimalV2ValueEQaa14IsDecimal128V2IT0_E14IsCppTypeFloatIT_EEEbRKS4_RS3_jjRKNS3_10NativeTypeESA_SA_RNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal11_from_floatIdNS_14DecimalV2ValueEQaa14IsDecimal128V2IT0_E14IsCppTypeFloatIT_EEEbRKS4_RS3_jjRKNS3_10NativeTypeESA_SA_RNS_14CastParametersE |
188 | | |
189 | | template <typename FromCppT, typename ToCppT, |
190 | | typename MaxFieldType = std::conditional_t< |
191 | | (sizeof(FromCppT) == sizeof(ToCppT)) && |
192 | | (std::is_same_v<ToCppT, Decimal128V3> || |
193 | | std::is_same_v<FromCppT, Decimal128V3>), |
194 | | Decimal128V3, |
195 | | std::conditional_t<(sizeof(FromCppT) > sizeof(ToCppT)), FromCppT, ToCppT>>> |
196 | | requires(IsDecimalNumber<ToCppT> && IsDecimalNumber<FromCppT>) |
197 | | static inline bool from_decimalv2(const FromCppT& from, const UInt32 from_precision, |
198 | | const UInt32 from_scale, UInt32 from_original_precision, |
199 | | UInt32 from_original_scale, ToCppT& to, UInt32 to_precision, |
200 | | UInt32 to_scale, CastParameters& params) { |
201 | | using MaxNativeType = typename MaxFieldType::NativeType; |
202 | | |
203 | | auto from_max_int_digit_count = from_original_precision - from_original_scale; |
204 | | auto to_max_int_digit_count = to_precision - to_scale; |
205 | | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count) || |
206 | | (to_max_int_digit_count == from_max_int_digit_count && |
207 | | to_scale < from_original_scale); |
208 | | |
209 | | constexpr UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToCppT::NativeType>(); |
210 | | bool multiply_may_overflow = false; |
211 | | if (to_scale > from_scale) { |
212 | | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; |
213 | | } |
214 | | |
215 | | typename ToCppT::NativeType max_result = |
216 | | DataTypeDecimal<ToCppT::PType>::get_max_digits_number(to_precision); |
217 | | typename ToCppT::NativeType min_result = -max_result; |
218 | | |
219 | | return std::visit( |
220 | | [&](auto multiply_may_overflow, auto narrow_integral) { |
221 | | if (from_scale < to_scale) { |
222 | | MaxNativeType multiplier = |
223 | | DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier( |
224 | | to_scale - from_scale); |
225 | | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, |
226 | | narrow_integral>( |
227 | | from, from_precision, from_scale, to, to_precision, to_scale, |
228 | | multiplier, min_result, max_result, params); |
229 | | } else if (from_scale == to_scale) { |
230 | | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, |
231 | | narrow_integral>( |
232 | | from, from_precision, from_scale, to, to_precision, to_scale, |
233 | | min_result, max_result, params); |
234 | | } else { |
235 | | MaxNativeType multiplier = |
236 | | DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier( |
237 | | from_scale - to_scale); |
238 | | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, |
239 | | narrow_integral>( |
240 | | from, from_precision, from_scale, to, to_precision, to_scale, |
241 | | multiplier, min_result, max_result, params); |
242 | | } |
243 | | return true; |
244 | | }, |
245 | | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral)); |
246 | | } |
247 | | |
248 | | template <typename FromCppT, typename ToCppT, |
249 | | typename MaxFieldType = std::conditional_t< |
250 | | (sizeof(FromCppT) == sizeof(ToCppT)) && |
251 | | (std::is_same_v<ToCppT, Decimal128V3> || |
252 | | std::is_same_v<FromCppT, Decimal128V3>), |
253 | | Decimal128V3, |
254 | | std::conditional_t<(sizeof(FromCppT) > sizeof(ToCppT)), FromCppT, ToCppT>>> |
255 | | requires(IsDecimalNumber<ToCppT> && IsDecimalNumber<FromCppT>) |
256 | | static inline bool from_decimalv3(const FromCppT& from, const UInt32 from_precision, |
257 | | const UInt32 from_scale, ToCppT& to, UInt32 to_precision, |
258 | 5 | UInt32 to_scale, CastParameters& params) { |
259 | 5 | using MaxNativeType = typename MaxFieldType::NativeType; |
260 | | |
261 | 5 | auto from_max_int_digit_count = from_precision - from_scale; |
262 | 5 | auto to_max_int_digit_count = to_precision - to_scale; |
263 | 5 | bool narrow_integral = |
264 | 5 | (to_max_int_digit_count < from_max_int_digit_count) || |
265 | 5 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); |
266 | | |
267 | 5 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToCppT::NativeType>(); |
268 | 5 | bool multiply_may_overflow = false; |
269 | 5 | if (to_scale > from_scale) { |
270 | 0 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; |
271 | 0 | } |
272 | | |
273 | 5 | typename ToCppT::NativeType max_result = |
274 | 5 | DataTypeDecimal<ToCppT::PType>::get_max_digits_number(to_precision); |
275 | 5 | typename ToCppT::NativeType min_result = -max_result; |
276 | | |
277 | 5 | MaxNativeType multiplier {}; |
278 | 5 | if (from_scale < to_scale) { |
279 | 0 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - |
280 | 0 | from_scale); |
281 | 5 | } else if (from_scale > to_scale) { |
282 | 3 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - |
283 | 3 | to_scale); |
284 | 3 | } |
285 | | |
286 | 5 | return std::visit( |
287 | 5 | [&](auto multiply_may_overflow, auto narrow_integral) { |
288 | 5 | return _from_decimal<FromCppT, ToCppT, multiply_may_overflow, narrow_integral>( |
289 | 5 | from, from_precision, from_scale, to, to_precision, to_scale, |
290 | 5 | min_result, max_result, multiplier, params); |
291 | 5 | }, _ZZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIiEES3_S3_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRNS_14CastParametersEENKUlS5_S4_E_clISt17integral_constantIbLb0EESE_EEDaS5_S4_ Line | Count | Source | 287 | 1 | [&](auto multiply_may_overflow, auto narrow_integral) { | 288 | 1 | return _from_decimal<FromCppT, ToCppT, multiply_may_overflow, narrow_integral>( | 289 | 1 | from, from_precision, from_scale, to, to_precision, to_scale, | 290 | 1 | min_result, max_result, multiplier, params); | 291 | 1 | }, |
Unexecuted instantiation: _ZZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIiEES3_S3_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRNS_14CastParametersEENKUlS5_S4_E_clISt17integral_constantIbLb0EESD_IbLb1EEEEDaS5_S4_ Unexecuted instantiation: _ZZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIiEES3_S3_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRNS_14CastParametersEENKUlS5_S4_E_clISt17integral_constantIbLb1EESD_IbLb0EEEEDaS5_S4_ Unexecuted instantiation: _ZZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIiEES3_S3_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRNS_14CastParametersEENKUlS5_S4_E_clISt17integral_constantIbLb1EESE_EEDaS5_S4_ Unexecuted instantiation: _ZZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIlEENS2_IiEES3_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRNS_14CastParametersEENKUlS6_S5_E_clISt17integral_constantIbLb0EESF_EEDaS6_S5_ _ZZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIlEENS2_IiEES3_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRNS_14CastParametersEENKUlS6_S5_E_clISt17integral_constantIbLb0EESE_IbLb1EEEEDaS6_S5_ Line | Count | Source | 287 | 1 | [&](auto multiply_may_overflow, auto narrow_integral) { | 288 | 1 | return _from_decimal<FromCppT, ToCppT, multiply_may_overflow, narrow_integral>( | 289 | 1 | from, from_precision, from_scale, to, to_precision, to_scale, | 290 | 1 | min_result, max_result, multiplier, params); | 291 | 1 | }, |
Unexecuted instantiation: _ZZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIlEENS2_IiEES3_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRNS_14CastParametersEENKUlS6_S5_E_clISt17integral_constantIbLb1EESE_IbLb0EEEEDaS6_S5_ Unexecuted instantiation: _ZZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIlEENS2_IiEES3_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRNS_14CastParametersEENKUlS6_S5_E_clISt17integral_constantIbLb1EESF_EEDaS6_S5_ Unexecuted instantiation: _ZZN5doris13CastToDecimal14from_decimalv3INS_12Decimal128V3ENS_7DecimalIiEES2_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRNS_14CastParametersEENKUlS6_S5_E_clISt17integral_constantIbLb0EESF_EEDaS6_S5_ _ZZN5doris13CastToDecimal14from_decimalv3INS_12Decimal128V3ENS_7DecimalIiEES2_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRNS_14CastParametersEENKUlS6_S5_E_clISt17integral_constantIbLb0EESE_IbLb1EEEEDaS6_S5_ Line | Count | Source | 287 | 1 | [&](auto multiply_may_overflow, auto narrow_integral) { | 288 | 1 | return _from_decimal<FromCppT, ToCppT, multiply_may_overflow, narrow_integral>( | 289 | 1 | from, from_precision, from_scale, to, to_precision, to_scale, | 290 | 1 | min_result, max_result, multiplier, params); | 291 | 1 | }, |
Unexecuted instantiation: _ZZN5doris13CastToDecimal14from_decimalv3INS_12Decimal128V3ENS_7DecimalIiEES2_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRNS_14CastParametersEENKUlS6_S5_E_clISt17integral_constantIbLb1EESE_IbLb0EEEEDaS6_S5_ Unexecuted instantiation: _ZZN5doris13CastToDecimal14from_decimalv3INS_12Decimal128V3ENS_7DecimalIiEES2_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRNS_14CastParametersEENKUlS6_S5_E_clISt17integral_constantIbLb1EESF_EEDaS6_S5_ Unexecuted instantiation: _ZZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIN4wide7integerILm256EiEEEENS2_IiEES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRNS_14CastParametersEENKUlS9_S8_E_clISt17integral_constantIbLb0EESI_EEDaS9_S8_ _ZZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIN4wide7integerILm256EiEEEENS2_IiEES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRNS_14CastParametersEENKUlS9_S8_E_clISt17integral_constantIbLb0EESH_IbLb1EEEEDaS9_S8_ Line | Count | Source | 287 | 1 | [&](auto multiply_may_overflow, auto narrow_integral) { | 288 | 1 | return _from_decimal<FromCppT, ToCppT, multiply_may_overflow, narrow_integral>( | 289 | 1 | from, from_precision, from_scale, to, to_precision, to_scale, | 290 | 1 | min_result, max_result, multiplier, params); | 291 | 1 | }, |
Unexecuted instantiation: _ZZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIN4wide7integerILm256EiEEEENS2_IiEES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRNS_14CastParametersEENKUlS9_S8_E_clISt17integral_constantIbLb1EESH_IbLb0EEEEDaS9_S8_ Unexecuted instantiation: _ZZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIN4wide7integerILm256EiEEEENS2_IiEES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRNS_14CastParametersEENKUlS9_S8_E_clISt17integral_constantIbLb1EESI_EEDaS9_S8_ Unexecuted instantiation: _ZZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIiEENS2_IlEES4_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRNS_14CastParametersEENKUlS6_S5_E_clISt17integral_constantIbLb0EESF_EEDaS6_S5_ Unexecuted instantiation: _ZZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIiEENS2_IlEES4_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRNS_14CastParametersEENKUlS6_S5_E_clISt17integral_constantIbLb0EESE_IbLb1EEEEDaS6_S5_ Unexecuted instantiation: _ZZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIiEENS2_IlEES4_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRNS_14CastParametersEENKUlS6_S5_E_clISt17integral_constantIbLb1EESE_IbLb0EEEEDaS6_S5_ Unexecuted instantiation: _ZZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIiEENS2_IlEES4_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRNS_14CastParametersEENKUlS6_S5_E_clISt17integral_constantIbLb1EESF_EEDaS6_S5_ Unexecuted instantiation: _ZZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIlEES3_S3_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRNS_14CastParametersEENKUlS5_S4_E_clISt17integral_constantIbLb0EESE_EEDaS5_S4_ Unexecuted instantiation: _ZZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIlEES3_S3_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRNS_14CastParametersEENKUlS5_S4_E_clISt17integral_constantIbLb0EESD_IbLb1EEEEDaS5_S4_ Unexecuted instantiation: _ZZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIlEES3_S3_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRNS_14CastParametersEENKUlS5_S4_E_clISt17integral_constantIbLb1EESD_IbLb0EEEEDaS5_S4_ Unexecuted instantiation: _ZZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIlEES3_S3_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRNS_14CastParametersEENKUlS5_S4_E_clISt17integral_constantIbLb1EESE_EEDaS5_S4_ Unexecuted instantiation: _ZZN5doris13CastToDecimal14from_decimalv3INS_12Decimal128V3ENS_7DecimalIlEES2_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRNS_14CastParametersEENKUlS6_S5_E_clISt17integral_constantIbLb0EESF_EEDaS6_S5_ Unexecuted instantiation: _ZZN5doris13CastToDecimal14from_decimalv3INS_12Decimal128V3ENS_7DecimalIlEES2_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRNS_14CastParametersEENKUlS6_S5_E_clISt17integral_constantIbLb0EESE_IbLb1EEEEDaS6_S5_ Unexecuted instantiation: _ZZN5doris13CastToDecimal14from_decimalv3INS_12Decimal128V3ENS_7DecimalIlEES2_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRNS_14CastParametersEENKUlS6_S5_E_clISt17integral_constantIbLb1EESE_IbLb0EEEEDaS6_S5_ Unexecuted instantiation: _ZZN5doris13CastToDecimal14from_decimalv3INS_12Decimal128V3ENS_7DecimalIlEES2_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRNS_14CastParametersEENKUlS6_S5_E_clISt17integral_constantIbLb1EESF_EEDaS6_S5_ Unexecuted instantiation: _ZZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIN4wide7integerILm256EiEEEENS2_IlEES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRNS_14CastParametersEENKUlS9_S8_E_clISt17integral_constantIbLb0EESI_EEDaS9_S8_ Unexecuted instantiation: _ZZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIN4wide7integerILm256EiEEEENS2_IlEES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRNS_14CastParametersEENKUlS9_S8_E_clISt17integral_constantIbLb0EESH_IbLb1EEEEDaS9_S8_ Unexecuted instantiation: _ZZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIN4wide7integerILm256EiEEEENS2_IlEES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRNS_14CastParametersEENKUlS9_S8_E_clISt17integral_constantIbLb1EESH_IbLb0EEEEDaS9_S8_ Unexecuted instantiation: _ZZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIN4wide7integerILm256EiEEEENS2_IlEES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRNS_14CastParametersEENKUlS9_S8_E_clISt17integral_constantIbLb1EESI_EEDaS9_S8_ Unexecuted instantiation: _ZZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIiEENS_12Decimal128V3ES4_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRNS_14CastParametersEENKUlS6_S5_E_clISt17integral_constantIbLb0EESF_EEDaS6_S5_ Unexecuted instantiation: _ZZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIiEENS_12Decimal128V3ES4_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRNS_14CastParametersEENKUlS6_S5_E_clISt17integral_constantIbLb0EESE_IbLb1EEEEDaS6_S5_ Unexecuted instantiation: _ZZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIiEENS_12Decimal128V3ES4_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRNS_14CastParametersEENKUlS6_S5_E_clISt17integral_constantIbLb1EESE_IbLb0EEEEDaS6_S5_ Unexecuted instantiation: _ZZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIiEENS_12Decimal128V3ES4_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRNS_14CastParametersEENKUlS6_S5_E_clISt17integral_constantIbLb1EESF_EEDaS6_S5_ Unexecuted instantiation: _ZZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIlEENS_12Decimal128V3ES4_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRNS_14CastParametersEENKUlS6_S5_E_clISt17integral_constantIbLb0EESF_EEDaS6_S5_ Unexecuted instantiation: _ZZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIlEENS_12Decimal128V3ES4_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRNS_14CastParametersEENKUlS6_S5_E_clISt17integral_constantIbLb0EESE_IbLb1EEEEDaS6_S5_ Unexecuted instantiation: _ZZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIlEENS_12Decimal128V3ES4_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRNS_14CastParametersEENKUlS6_S5_E_clISt17integral_constantIbLb1EESE_IbLb0EEEEDaS6_S5_ Unexecuted instantiation: _ZZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIlEENS_12Decimal128V3ES4_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRNS_14CastParametersEENKUlS6_S5_E_clISt17integral_constantIbLb1EESF_EEDaS6_S5_ _ZZN5doris13CastToDecimal14from_decimalv3INS_12Decimal128V3ES2_S2_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS4_jjRS3_jjRNS_14CastParametersEENKUlS4_S3_E_clISt17integral_constantIbLb0EESD_EEDaS4_S3_ Line | Count | Source | 287 | 1 | [&](auto multiply_may_overflow, auto narrow_integral) { | 288 | 1 | return _from_decimal<FromCppT, ToCppT, multiply_may_overflow, narrow_integral>( | 289 | 1 | from, from_precision, from_scale, to, to_precision, to_scale, | 290 | 1 | min_result, max_result, multiplier, params); | 291 | 1 | }, |
Unexecuted instantiation: _ZZN5doris13CastToDecimal14from_decimalv3INS_12Decimal128V3ES2_S2_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS4_jjRS3_jjRNS_14CastParametersEENKUlS4_S3_E_clISt17integral_constantIbLb0EESC_IbLb1EEEEDaS4_S3_ Unexecuted instantiation: _ZZN5doris13CastToDecimal14from_decimalv3INS_12Decimal128V3ES2_S2_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS4_jjRS3_jjRNS_14CastParametersEENKUlS4_S3_E_clISt17integral_constantIbLb1EESC_IbLb0EEEEDaS4_S3_ Unexecuted instantiation: _ZZN5doris13CastToDecimal14from_decimalv3INS_12Decimal128V3ES2_S2_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS4_jjRS3_jjRNS_14CastParametersEENKUlS4_S3_E_clISt17integral_constantIbLb1EESD_EEDaS4_S3_ Unexecuted instantiation: _ZZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIN4wide7integerILm256EiEEEENS_12Decimal128V3ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRNS_14CastParametersEENKUlS9_S8_E_clISt17integral_constantIbLb0EESI_EEDaS9_S8_ Unexecuted instantiation: _ZZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIN4wide7integerILm256EiEEEENS_12Decimal128V3ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRNS_14CastParametersEENKUlS9_S8_E_clISt17integral_constantIbLb0EESH_IbLb1EEEEDaS9_S8_ Unexecuted instantiation: _ZZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIN4wide7integerILm256EiEEEENS_12Decimal128V3ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRNS_14CastParametersEENKUlS9_S8_E_clISt17integral_constantIbLb1EESH_IbLb0EEEEDaS9_S8_ Unexecuted instantiation: _ZZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIN4wide7integerILm256EiEEEENS_12Decimal128V3ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRNS_14CastParametersEENKUlS9_S8_E_clISt17integral_constantIbLb1EESI_EEDaS9_S8_ Unexecuted instantiation: _ZZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIiEENS2_IN4wide7integerILm256EiEEEES7_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRNS_14CastParametersEENKUlS9_S8_E_clISt17integral_constantIbLb0EESI_EEDaS9_S8_ Unexecuted instantiation: _ZZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIiEENS2_IN4wide7integerILm256EiEEEES7_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRNS_14CastParametersEENKUlS9_S8_E_clISt17integral_constantIbLb0EESH_IbLb1EEEEDaS9_S8_ Unexecuted instantiation: _ZZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIiEENS2_IN4wide7integerILm256EiEEEES7_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRNS_14CastParametersEENKUlS9_S8_E_clISt17integral_constantIbLb1EESH_IbLb0EEEEDaS9_S8_ Unexecuted instantiation: _ZZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIiEENS2_IN4wide7integerILm256EiEEEES7_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRNS_14CastParametersEENKUlS9_S8_E_clISt17integral_constantIbLb1EESI_EEDaS9_S8_ Unexecuted instantiation: _ZZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIlEENS2_IN4wide7integerILm256EiEEEES7_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRNS_14CastParametersEENKUlS9_S8_E_clISt17integral_constantIbLb0EESI_EEDaS9_S8_ Unexecuted instantiation: _ZZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIlEENS2_IN4wide7integerILm256EiEEEES7_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRNS_14CastParametersEENKUlS9_S8_E_clISt17integral_constantIbLb0EESH_IbLb1EEEEDaS9_S8_ Unexecuted instantiation: _ZZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIlEENS2_IN4wide7integerILm256EiEEEES7_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRNS_14CastParametersEENKUlS9_S8_E_clISt17integral_constantIbLb1EESH_IbLb0EEEEDaS9_S8_ Unexecuted instantiation: _ZZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIlEENS2_IN4wide7integerILm256EiEEEES7_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRNS_14CastParametersEENKUlS9_S8_E_clISt17integral_constantIbLb1EESI_EEDaS9_S8_ Unexecuted instantiation: _ZZN5doris13CastToDecimal14from_decimalv3INS_12Decimal128V3ENS_7DecimalIN4wide7integerILm256EiEEEES7_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRNS_14CastParametersEENKUlS9_S8_E_clISt17integral_constantIbLb0EESI_EEDaS9_S8_ Unexecuted instantiation: _ZZN5doris13CastToDecimal14from_decimalv3INS_12Decimal128V3ENS_7DecimalIN4wide7integerILm256EiEEEES7_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRNS_14CastParametersEENKUlS9_S8_E_clISt17integral_constantIbLb0EESH_IbLb1EEEEDaS9_S8_ Unexecuted instantiation: _ZZN5doris13CastToDecimal14from_decimalv3INS_12Decimal128V3ENS_7DecimalIN4wide7integerILm256EiEEEES7_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRNS_14CastParametersEENKUlS9_S8_E_clISt17integral_constantIbLb1EESH_IbLb0EEEEDaS9_S8_ Unexecuted instantiation: _ZZN5doris13CastToDecimal14from_decimalv3INS_12Decimal128V3ENS_7DecimalIN4wide7integerILm256EiEEEES7_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRNS_14CastParametersEENKUlS9_S8_E_clISt17integral_constantIbLb1EESI_EEDaS9_S8_ Unexecuted instantiation: _ZZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIN4wide7integerILm256EiEEEES6_S6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS8_jjRS7_jjRNS_14CastParametersEENKUlS8_S7_E_clISt17integral_constantIbLb0EESH_EEDaS8_S7_ Unexecuted instantiation: _ZZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIN4wide7integerILm256EiEEEES6_S6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS8_jjRS7_jjRNS_14CastParametersEENKUlS8_S7_E_clISt17integral_constantIbLb0EESG_IbLb1EEEEDaS8_S7_ Unexecuted instantiation: _ZZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIN4wide7integerILm256EiEEEES6_S6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS8_jjRS7_jjRNS_14CastParametersEENKUlS8_S7_E_clISt17integral_constantIbLb1EESG_IbLb0EEEEDaS8_S7_ Unexecuted instantiation: _ZZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIN4wide7integerILm256EiEEEES6_S6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS8_jjRS7_jjRNS_14CastParametersEENKUlS8_S7_E_clISt17integral_constantIbLb1EESH_EEDaS8_S7_ |
292 | 5 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral)); |
293 | 5 | } _ZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIiEES3_S3_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRNS_14CastParametersE Line | Count | Source | 258 | 1 | UInt32 to_scale, CastParameters& params) { | 259 | 1 | using MaxNativeType = typename MaxFieldType::NativeType; | 260 | | | 261 | 1 | auto from_max_int_digit_count = from_precision - from_scale; | 262 | 1 | auto to_max_int_digit_count = to_precision - to_scale; | 263 | 1 | bool narrow_integral = | 264 | 1 | (to_max_int_digit_count < from_max_int_digit_count) || | 265 | 1 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 266 | | | 267 | 1 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToCppT::NativeType>(); | 268 | 1 | bool multiply_may_overflow = false; | 269 | 1 | if (to_scale > from_scale) { | 270 | 0 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 271 | 0 | } | 272 | | | 273 | 1 | typename ToCppT::NativeType max_result = | 274 | 1 | DataTypeDecimal<ToCppT::PType>::get_max_digits_number(to_precision); | 275 | 1 | typename ToCppT::NativeType min_result = -max_result; | 276 | | | 277 | 1 | MaxNativeType multiplier {}; | 278 | 1 | if (from_scale < to_scale) { | 279 | 0 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 280 | 0 | from_scale); | 281 | 1 | } else if (from_scale > to_scale) { | 282 | 0 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 283 | 0 | to_scale); | 284 | 0 | } | 285 | | | 286 | 1 | return std::visit( | 287 | 1 | [&](auto multiply_may_overflow, auto narrow_integral) { | 288 | 1 | return _from_decimal<FromCppT, ToCppT, multiply_may_overflow, narrow_integral>( | 289 | 1 | from, from_precision, from_scale, to, to_precision, to_scale, | 290 | 1 | min_result, max_result, multiplier, params); | 291 | 1 | }, | 292 | 1 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral)); | 293 | 1 | } |
_ZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIlEENS2_IiEES3_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRNS_14CastParametersE Line | Count | Source | 258 | 1 | UInt32 to_scale, CastParameters& params) { | 259 | 1 | using MaxNativeType = typename MaxFieldType::NativeType; | 260 | | | 261 | 1 | auto from_max_int_digit_count = from_precision - from_scale; | 262 | 1 | auto to_max_int_digit_count = to_precision - to_scale; | 263 | 1 | bool narrow_integral = | 264 | 1 | (to_max_int_digit_count < from_max_int_digit_count) || | 265 | 1 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 266 | | | 267 | 1 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToCppT::NativeType>(); | 268 | 1 | bool multiply_may_overflow = false; | 269 | 1 | if (to_scale > from_scale) { | 270 | 0 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 271 | 0 | } | 272 | | | 273 | 1 | typename ToCppT::NativeType max_result = | 274 | 1 | DataTypeDecimal<ToCppT::PType>::get_max_digits_number(to_precision); | 275 | 1 | typename ToCppT::NativeType min_result = -max_result; | 276 | | | 277 | 1 | MaxNativeType multiplier {}; | 278 | 1 | if (from_scale < to_scale) { | 279 | 0 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 280 | 0 | from_scale); | 281 | 1 | } else if (from_scale > to_scale) { | 282 | 1 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 283 | 1 | to_scale); | 284 | 1 | } | 285 | | | 286 | 1 | return std::visit( | 287 | 1 | [&](auto multiply_may_overflow, auto narrow_integral) { | 288 | 1 | return _from_decimal<FromCppT, ToCppT, multiply_may_overflow, narrow_integral>( | 289 | 1 | from, from_precision, from_scale, to, to_precision, to_scale, | 290 | 1 | min_result, max_result, multiplier, params); | 291 | 1 | }, | 292 | 1 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral)); | 293 | 1 | } |
_ZN5doris13CastToDecimal14from_decimalv3INS_12Decimal128V3ENS_7DecimalIiEES2_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRNS_14CastParametersE Line | Count | Source | 258 | 1 | UInt32 to_scale, CastParameters& params) { | 259 | 1 | using MaxNativeType = typename MaxFieldType::NativeType; | 260 | | | 261 | 1 | auto from_max_int_digit_count = from_precision - from_scale; | 262 | 1 | auto to_max_int_digit_count = to_precision - to_scale; | 263 | 1 | bool narrow_integral = | 264 | 1 | (to_max_int_digit_count < from_max_int_digit_count) || | 265 | 1 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 266 | | | 267 | 1 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToCppT::NativeType>(); | 268 | 1 | bool multiply_may_overflow = false; | 269 | 1 | if (to_scale > from_scale) { | 270 | 0 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 271 | 0 | } | 272 | | | 273 | 1 | typename ToCppT::NativeType max_result = | 274 | 1 | DataTypeDecimal<ToCppT::PType>::get_max_digits_number(to_precision); | 275 | 1 | typename ToCppT::NativeType min_result = -max_result; | 276 | | | 277 | 1 | MaxNativeType multiplier {}; | 278 | 1 | if (from_scale < to_scale) { | 279 | 0 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 280 | 0 | from_scale); | 281 | 1 | } else if (from_scale > to_scale) { | 282 | 1 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 283 | 1 | to_scale); | 284 | 1 | } | 285 | | | 286 | 1 | return std::visit( | 287 | 1 | [&](auto multiply_may_overflow, auto narrow_integral) { | 288 | 1 | return _from_decimal<FromCppT, ToCppT, multiply_may_overflow, narrow_integral>( | 289 | 1 | from, from_precision, from_scale, to, to_precision, to_scale, | 290 | 1 | min_result, max_result, multiplier, params); | 291 | 1 | }, | 292 | 1 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral)); | 293 | 1 | } |
_ZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIN4wide7integerILm256EiEEEENS2_IiEES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRNS_14CastParametersE Line | Count | Source | 258 | 1 | UInt32 to_scale, CastParameters& params) { | 259 | 1 | using MaxNativeType = typename MaxFieldType::NativeType; | 260 | | | 261 | 1 | auto from_max_int_digit_count = from_precision - from_scale; | 262 | 1 | auto to_max_int_digit_count = to_precision - to_scale; | 263 | 1 | bool narrow_integral = | 264 | 1 | (to_max_int_digit_count < from_max_int_digit_count) || | 265 | 1 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 266 | | | 267 | 1 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToCppT::NativeType>(); | 268 | 1 | bool multiply_may_overflow = false; | 269 | 1 | if (to_scale > from_scale) { | 270 | 0 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 271 | 0 | } | 272 | | | 273 | 1 | typename ToCppT::NativeType max_result = | 274 | 1 | DataTypeDecimal<ToCppT::PType>::get_max_digits_number(to_precision); | 275 | 1 | typename ToCppT::NativeType min_result = -max_result; | 276 | | | 277 | 1 | MaxNativeType multiplier {}; | 278 | 1 | if (from_scale < to_scale) { | 279 | 0 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 280 | 0 | from_scale); | 281 | 1 | } else if (from_scale > to_scale) { | 282 | 1 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 283 | 1 | to_scale); | 284 | 1 | } | 285 | | | 286 | 1 | return std::visit( | 287 | 1 | [&](auto multiply_may_overflow, auto narrow_integral) { | 288 | 1 | return _from_decimal<FromCppT, ToCppT, multiply_may_overflow, narrow_integral>( | 289 | 1 | from, from_precision, from_scale, to, to_precision, to_scale, | 290 | 1 | min_result, max_result, multiplier, params); | 291 | 1 | }, | 292 | 1 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral)); | 293 | 1 | } |
Unexecuted instantiation: _ZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIiEENS2_IlEES4_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIlEES3_S3_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal14from_decimalv3INS_12Decimal128V3ENS_7DecimalIlEES2_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIN4wide7integerILm256EiEEEENS2_IlEES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIiEENS_12Decimal128V3ES4_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIlEENS_12Decimal128V3ES4_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRNS_14CastParametersE _ZN5doris13CastToDecimal14from_decimalv3INS_12Decimal128V3ES2_S2_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS4_jjRS3_jjRNS_14CastParametersE Line | Count | Source | 258 | 1 | UInt32 to_scale, CastParameters& params) { | 259 | 1 | using MaxNativeType = typename MaxFieldType::NativeType; | 260 | | | 261 | 1 | auto from_max_int_digit_count = from_precision - from_scale; | 262 | 1 | auto to_max_int_digit_count = to_precision - to_scale; | 263 | 1 | bool narrow_integral = | 264 | 1 | (to_max_int_digit_count < from_max_int_digit_count) || | 265 | 1 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 266 | | | 267 | 1 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToCppT::NativeType>(); | 268 | 1 | bool multiply_may_overflow = false; | 269 | 1 | if (to_scale > from_scale) { | 270 | 0 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 271 | 0 | } | 272 | | | 273 | 1 | typename ToCppT::NativeType max_result = | 274 | 1 | DataTypeDecimal<ToCppT::PType>::get_max_digits_number(to_precision); | 275 | 1 | typename ToCppT::NativeType min_result = -max_result; | 276 | | | 277 | 1 | MaxNativeType multiplier {}; | 278 | 1 | if (from_scale < to_scale) { | 279 | 0 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 280 | 0 | from_scale); | 281 | 1 | } else if (from_scale > to_scale) { | 282 | 0 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 283 | 0 | to_scale); | 284 | 0 | } | 285 | | | 286 | 1 | return std::visit( | 287 | 1 | [&](auto multiply_may_overflow, auto narrow_integral) { | 288 | 1 | return _from_decimal<FromCppT, ToCppT, multiply_may_overflow, narrow_integral>( | 289 | 1 | from, from_precision, from_scale, to, to_precision, to_scale, | 290 | 1 | min_result, max_result, multiplier, params); | 291 | 1 | }, | 292 | 1 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral)); | 293 | 1 | } |
Unexecuted instantiation: _ZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIN4wide7integerILm256EiEEEENS_12Decimal128V3ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIiEENS2_IN4wide7integerILm256EiEEEES7_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIlEENS2_IN4wide7integerILm256EiEEEES7_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal14from_decimalv3INS_12Decimal128V3ENS_7DecimalIN4wide7integerILm256EiEEEES7_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRNS_14CastParametersE Unexecuted instantiation: _ZN5doris13CastToDecimal14from_decimalv3INS_7DecimalIN4wide7integerILm256EiEEEES6_S6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS8_jjRS7_jjRNS_14CastParametersE |
294 | | |
295 | | template <typename FromCppT, typename ToCppT, bool multiply_may_overflow, bool narrow_integral, |
296 | | typename MaxFieldType = std::conditional_t< |
297 | | (sizeof(FromCppT) == sizeof(ToCppT)) && |
298 | | (std::is_same_v<ToCppT, Decimal128V3> || |
299 | | std::is_same_v<FromCppT, Decimal128V3>), |
300 | | Decimal128V3, |
301 | | std::conditional_t<(sizeof(FromCppT) > sizeof(ToCppT)), FromCppT, ToCppT>>> |
302 | | requires(IsDecimalNumber<ToCppT> && IsDecimalNumber<FromCppT>) |
303 | | static inline bool _from_decimal(const FromCppT& from, const UInt32 from_precision, |
304 | | const UInt32 from_scale, ToCppT& to, UInt32 to_precision, |
305 | | UInt32 to_scale, const ToCppT::NativeType& min_result, |
306 | | const ToCppT::NativeType& max_result, |
307 | | const typename MaxFieldType::NativeType& scale_multiplier, |
308 | 14.8k | CastParameters& params) { |
309 | 14.8k | using MaxNativeType = typename MaxFieldType::NativeType; |
310 | | |
311 | 14.8k | if (from_scale < to_scale) { |
312 | 4.59k | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, |
313 | 4.59k | narrow_integral>( |
314 | 4.59k | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, |
315 | 4.59k | min_result, max_result, params); |
316 | 10.2k | } else if (from_scale == to_scale) { |
317 | 1.86k | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( |
318 | 1.86k | from, from_precision, from_scale, to, to_precision, to_scale, min_result, |
319 | 1.86k | max_result, params); |
320 | 8.38k | } else { |
321 | 8.38k | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, |
322 | 8.38k | narrow_integral>( |
323 | 8.38k | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, |
324 | 8.38k | min_result, max_result, params); |
325 | 8.38k | } |
326 | 0 | return true; |
327 | 14.8k | } _ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIiEES3_Lb0ELb0ES3_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKNS4_10NativeTypeESB_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 308 | 134 | CastParameters& params) { | 309 | 134 | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 134 | if (from_scale < to_scale) { | 312 | 14 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 14 | narrow_integral>( | 314 | 14 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 14 | min_result, max_result, params); | 316 | 120 | } else if (from_scale == to_scale) { | 317 | 8 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 8 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 8 | max_result, params); | 320 | 112 | } else { | 321 | 112 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 112 | narrow_integral>( | 323 | 112 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 112 | min_result, max_result, params); | 325 | 112 | } | 326 | 0 | return true; | 327 | 134 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIiEES3_Lb0ELb1ES3_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKNS4_10NativeTypeESB_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 308 | 108 | CastParameters& params) { | 309 | 108 | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 108 | if (from_scale < to_scale) { | 312 | 7 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 7 | narrow_integral>( | 314 | 7 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 7 | min_result, max_result, params); | 316 | 101 | } else if (from_scale == to_scale) { | 317 | 19 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 19 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 19 | max_result, params); | 320 | 82 | } else { | 321 | 82 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 82 | narrow_integral>( | 323 | 82 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 82 | min_result, max_result, params); | 325 | 82 | } | 326 | 0 | return true; | 327 | 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 | 308 | 84 | CastParameters& params) { | 309 | 84 | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 84 | if (from_scale < to_scale) { | 312 | 84 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 84 | narrow_integral>( | 314 | 84 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 84 | min_result, max_result, params); | 316 | 84 | } else if (from_scale == to_scale) { | 317 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 0 | max_result, params); | 320 | 0 | } else { | 321 | 0 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 0 | narrow_integral>( | 323 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 0 | min_result, max_result, params); | 325 | 0 | } | 326 | 0 | return true; | 327 | 84 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIlEENS2_IiEELb0ELb0ES3_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 308 | 160 | CastParameters& params) { | 309 | 160 | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 160 | if (from_scale < to_scale) { | 312 | 0 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 0 | narrow_integral>( | 314 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 0 | min_result, max_result, params); | 316 | 160 | } else if (from_scale == to_scale) { | 317 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 0 | max_result, params); | 320 | 160 | } else { | 321 | 160 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 160 | narrow_integral>( | 323 | 160 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 160 | min_result, max_result, params); | 325 | 160 | } | 326 | 0 | return true; | 327 | 160 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIlEENS2_IiEELb0ELb1ES3_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 308 | 459 | CastParameters& params) { | 309 | 459 | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 459 | if (from_scale < to_scale) { | 312 | 0 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 0 | narrow_integral>( | 314 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 0 | min_result, max_result, params); | 316 | 459 | } else if (from_scale == to_scale) { | 317 | 136 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 136 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 136 | max_result, params); | 320 | 323 | } else { | 321 | 323 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 323 | narrow_integral>( | 323 | 323 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 323 | min_result, max_result, params); | 325 | 323 | } | 326 | 0 | return true; | 327 | 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 | 308 | 126 | CastParameters& params) { | 309 | 126 | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 126 | if (from_scale < to_scale) { | 312 | 126 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 126 | narrow_integral>( | 314 | 126 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 126 | min_result, max_result, params); | 316 | 126 | } else if (from_scale == to_scale) { | 317 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 0 | max_result, params); | 320 | 0 | } else { | 321 | 0 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 0 | narrow_integral>( | 323 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 0 | min_result, max_result, params); | 325 | 0 | } | 326 | 0 | return true; | 327 | 126 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_12Decimal128V3ENS_7DecimalIiEELb0ELb0ES2_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 308 | 160 | CastParameters& params) { | 309 | 160 | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 160 | if (from_scale < to_scale) { | 312 | 0 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 0 | narrow_integral>( | 314 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 0 | min_result, max_result, params); | 316 | 160 | } else if (from_scale == to_scale) { | 317 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 0 | max_result, params); | 320 | 160 | } else { | 321 | 160 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 160 | narrow_integral>( | 323 | 160 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 160 | min_result, max_result, params); | 325 | 160 | } | 326 | 0 | return true; | 327 | 160 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_12Decimal128V3ENS_7DecimalIiEELb0ELb1ES2_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 308 | 479 | CastParameters& params) { | 309 | 479 | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 479 | if (from_scale < to_scale) { | 312 | 0 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 0 | narrow_integral>( | 314 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 0 | min_result, max_result, params); | 316 | 479 | } else if (from_scale == to_scale) { | 317 | 122 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 122 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 122 | max_result, params); | 320 | 357 | } else { | 321 | 357 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 357 | narrow_integral>( | 323 | 357 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 357 | min_result, max_result, params); | 325 | 357 | } | 326 | 0 | return true; | 327 | 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 | 308 | 126 | CastParameters& params) { | 309 | 126 | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 126 | if (from_scale < to_scale) { | 312 | 126 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 126 | narrow_integral>( | 314 | 126 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 126 | min_result, max_result, params); | 316 | 126 | } else if (from_scale == to_scale) { | 317 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 0 | max_result, params); | 320 | 0 | } else { | 321 | 0 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 0 | narrow_integral>( | 323 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 0 | min_result, max_result, params); | 325 | 0 | } | 326 | 0 | return true; | 327 | 126 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIN4wide7integerILm256EiEEEENS2_IiEELb0ELb0ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKNS8_10NativeTypeESF_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 308 | 160 | CastParameters& params) { | 309 | 160 | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 160 | if (from_scale < to_scale) { | 312 | 0 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 0 | narrow_integral>( | 314 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 0 | min_result, max_result, params); | 316 | 160 | } else if (from_scale == to_scale) { | 317 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 0 | max_result, params); | 320 | 160 | } else { | 321 | 160 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 160 | narrow_integral>( | 323 | 160 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 160 | min_result, max_result, params); | 325 | 160 | } | 326 | 0 | return true; | 327 | 160 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIN4wide7integerILm256EiEEEENS2_IiEELb0ELb1ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKNS8_10NativeTypeESF_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 308 | 479 | CastParameters& params) { | 309 | 479 | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 479 | if (from_scale < to_scale) { | 312 | 0 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 0 | narrow_integral>( | 314 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 0 | min_result, max_result, params); | 316 | 479 | } else if (from_scale == to_scale) { | 317 | 122 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 122 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 122 | max_result, params); | 320 | 357 | } else { | 321 | 357 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 357 | narrow_integral>( | 323 | 357 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 357 | min_result, max_result, params); | 325 | 357 | } | 326 | 0 | return true; | 327 | 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 | 308 | 126 | CastParameters& params) { | 309 | 126 | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 126 | if (from_scale < to_scale) { | 312 | 126 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 126 | narrow_integral>( | 314 | 126 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 126 | min_result, max_result, params); | 316 | 126 | } else if (from_scale == to_scale) { | 317 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 0 | max_result, params); | 320 | 0 | } else { | 321 | 0 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 0 | narrow_integral>( | 323 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 0 | min_result, max_result, params); | 325 | 0 | } | 326 | 0 | return true; | 327 | 126 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIiEENS2_IlEELb0ELb0ES4_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 308 | 378 | CastParameters& params) { | 309 | 378 | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 378 | if (from_scale < to_scale) { | 312 | 112 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 112 | narrow_integral>( | 314 | 112 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 112 | min_result, max_result, params); | 316 | 266 | } else if (from_scale == to_scale) { | 317 | 82 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 82 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 82 | max_result, params); | 320 | 184 | } else { | 321 | 184 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 184 | narrow_integral>( | 323 | 184 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 184 | min_result, max_result, params); | 325 | 184 | } | 326 | 0 | return true; | 327 | 378 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIiEENS2_IlEELb0ELb1ES4_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 308 | 58 | CastParameters& params) { | 309 | 58 | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 58 | if (from_scale < to_scale) { | 312 | 58 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 58 | narrow_integral>( | 314 | 58 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 58 | min_result, max_result, params); | 316 | 58 | } else if (from_scale == to_scale) { | 317 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 0 | max_result, params); | 320 | 0 | } else { | 321 | 0 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 0 | narrow_integral>( | 323 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 0 | min_result, max_result, params); | 325 | 0 | } | 326 | 0 | return true; | 327 | 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 | 308 | 72 | CastParameters& params) { | 309 | 72 | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 72 | if (from_scale < to_scale) { | 312 | 72 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 72 | narrow_integral>( | 314 | 72 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 72 | min_result, max_result, params); | 316 | 72 | } else if (from_scale == to_scale) { | 317 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 0 | max_result, params); | 320 | 0 | } else { | 321 | 0 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 0 | narrow_integral>( | 323 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 0 | min_result, max_result, params); | 325 | 0 | } | 326 | 0 | return true; | 327 | 72 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIlEES3_Lb0ELb0ES3_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKNS4_10NativeTypeESB_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 308 | 428 | CastParameters& params) { | 309 | 428 | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 428 | if (from_scale < to_scale) { | 312 | 46 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 46 | narrow_integral>( | 314 | 46 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 46 | min_result, max_result, params); | 316 | 382 | } else if (from_scale == to_scale) { | 317 | 30 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 30 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 30 | max_result, params); | 320 | 352 | } else { | 321 | 352 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 352 | narrow_integral>( | 323 | 352 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 352 | min_result, max_result, params); | 325 | 352 | } | 326 | 0 | return true; | 327 | 428 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIlEES3_Lb0ELb1ES3_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKNS4_10NativeTypeESB_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 308 | 182 | CastParameters& params) { | 309 | 182 | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 182 | if (from_scale < to_scale) { | 312 | 44 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 44 | narrow_integral>( | 314 | 44 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 44 | min_result, max_result, params); | 316 | 138 | } else if (from_scale == to_scale) { | 317 | 42 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 42 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 42 | max_result, params); | 320 | 96 | } else { | 321 | 96 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 96 | narrow_integral>( | 323 | 96 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 96 | min_result, max_result, params); | 325 | 96 | } | 326 | 0 | return true; | 327 | 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 | 308 | 210 | CastParameters& params) { | 309 | 210 | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 210 | if (from_scale < to_scale) { | 312 | 210 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 210 | narrow_integral>( | 314 | 210 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 210 | min_result, max_result, params); | 316 | 210 | } else if (from_scale == to_scale) { | 317 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 0 | max_result, params); | 320 | 0 | } else { | 321 | 0 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 0 | narrow_integral>( | 323 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 0 | min_result, max_result, params); | 325 | 0 | } | 326 | 0 | return true; | 327 | 210 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_12Decimal128V3ENS_7DecimalIlEELb0ELb0ES2_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 308 | 288 | CastParameters& params) { | 309 | 288 | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 288 | if (from_scale < to_scale) { | 312 | 0 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 0 | narrow_integral>( | 314 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 0 | min_result, max_result, params); | 316 | 288 | } else if (from_scale == to_scale) { | 317 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 0 | max_result, params); | 320 | 288 | } else { | 321 | 288 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 288 | narrow_integral>( | 323 | 288 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 288 | min_result, max_result, params); | 325 | 288 | } | 326 | 0 | return true; | 327 | 288 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_12Decimal128V3ENS_7DecimalIlEELb0ELb1ES2_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 308 | 532 | CastParameters& params) { | 309 | 532 | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 532 | if (from_scale < to_scale) { | 312 | 0 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 0 | narrow_integral>( | 314 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 0 | min_result, max_result, params); | 316 | 532 | } else if (from_scale == to_scale) { | 317 | 182 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 182 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 182 | max_result, params); | 320 | 350 | } else { | 321 | 350 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 350 | narrow_integral>( | 323 | 350 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 350 | min_result, max_result, params); | 325 | 350 | } | 326 | 0 | return true; | 327 | 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 | 308 | 224 | CastParameters& params) { | 309 | 224 | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 224 | if (from_scale < to_scale) { | 312 | 224 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 224 | narrow_integral>( | 314 | 224 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 224 | min_result, max_result, params); | 316 | 224 | } else if (from_scale == to_scale) { | 317 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 0 | max_result, params); | 320 | 0 | } else { | 321 | 0 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 0 | narrow_integral>( | 323 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 0 | min_result, max_result, params); | 325 | 0 | } | 326 | 0 | return true; | 327 | 224 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIN4wide7integerILm256EiEEEENS2_IlEELb0ELb0ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKNS8_10NativeTypeESF_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 308 | 288 | CastParameters& params) { | 309 | 288 | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 288 | if (from_scale < to_scale) { | 312 | 0 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 0 | narrow_integral>( | 314 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 0 | min_result, max_result, params); | 316 | 288 | } else if (from_scale == to_scale) { | 317 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 0 | max_result, params); | 320 | 288 | } else { | 321 | 288 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 288 | narrow_integral>( | 323 | 288 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 288 | min_result, max_result, params); | 325 | 288 | } | 326 | 0 | return true; | 327 | 288 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIN4wide7integerILm256EiEEEENS2_IlEELb0ELb1ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKNS8_10NativeTypeESF_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 308 | 552 | CastParameters& params) { | 309 | 552 | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 552 | if (from_scale < to_scale) { | 312 | 0 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 0 | narrow_integral>( | 314 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 0 | min_result, max_result, params); | 316 | 552 | } else if (from_scale == to_scale) { | 317 | 168 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 168 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 168 | max_result, params); | 320 | 384 | } else { | 321 | 384 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 384 | narrow_integral>( | 323 | 384 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 384 | min_result, max_result, params); | 325 | 384 | } | 326 | 0 | return true; | 327 | 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 | 308 | 224 | CastParameters& params) { | 309 | 224 | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 224 | if (from_scale < to_scale) { | 312 | 224 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 224 | narrow_integral>( | 314 | 224 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 224 | min_result, max_result, params); | 316 | 224 | } else if (from_scale == to_scale) { | 317 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 0 | max_result, params); | 320 | 0 | } else { | 321 | 0 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 0 | narrow_integral>( | 323 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 0 | min_result, max_result, params); | 325 | 0 | } | 326 | 0 | return true; | 327 | 224 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIiEENS_12Decimal128V3ELb0ELb0ES4_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 308 | 378 | CastParameters& params) { | 309 | 378 | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 378 | if (from_scale < to_scale) { | 312 | 120 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 120 | narrow_integral>( | 314 | 120 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 120 | min_result, max_result, params); | 316 | 258 | } else if (from_scale == to_scale) { | 317 | 74 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 74 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 74 | max_result, params); | 320 | 184 | } else { | 321 | 184 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 184 | narrow_integral>( | 323 | 184 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 184 | min_result, max_result, params); | 325 | 184 | } | 326 | 0 | return true; | 327 | 378 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIiEENS_12Decimal128V3ELb0ELb1ES4_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 308 | 65 | CastParameters& params) { | 309 | 65 | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 65 | if (from_scale < to_scale) { | 312 | 65 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 65 | narrow_integral>( | 314 | 65 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 65 | min_result, max_result, params); | 316 | 65 | } else if (from_scale == to_scale) { | 317 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 0 | max_result, params); | 320 | 0 | } else { | 321 | 0 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 0 | narrow_integral>( | 323 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 0 | min_result, max_result, params); | 325 | 0 | } | 326 | 0 | return true; | 327 | 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 | 308 | 65 | CastParameters& params) { | 309 | 65 | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 65 | if (from_scale < to_scale) { | 312 | 65 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 65 | narrow_integral>( | 314 | 65 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 65 | min_result, max_result, params); | 316 | 65 | } else if (from_scale == to_scale) { | 317 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 0 | max_result, params); | 320 | 0 | } else { | 321 | 0 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 0 | narrow_integral>( | 323 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 0 | min_result, max_result, params); | 325 | 0 | } | 326 | 0 | return true; | 327 | 65 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIlEENS_12Decimal128V3ELb0ELb0ES4_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 308 | 656 | CastParameters& params) { | 309 | 656 | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 656 | if (from_scale < to_scale) { | 312 | 176 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 176 | narrow_integral>( | 314 | 176 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 176 | min_result, max_result, params); | 316 | 480 | } else if (from_scale == to_scale) { | 317 | 128 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 128 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 128 | max_result, params); | 320 | 352 | } else { | 321 | 352 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 352 | narrow_integral>( | 323 | 352 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 352 | min_result, max_result, params); | 325 | 352 | } | 326 | 0 | return true; | 327 | 656 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIlEENS_12Decimal128V3ELb0ELb1ES4_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 308 | 116 | CastParameters& params) { | 309 | 116 | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 116 | if (from_scale < to_scale) { | 312 | 116 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 116 | narrow_integral>( | 314 | 116 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 116 | min_result, max_result, params); | 316 | 116 | } else if (from_scale == to_scale) { | 317 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 0 | max_result, params); | 320 | 0 | } else { | 321 | 0 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 0 | narrow_integral>( | 323 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 0 | min_result, max_result, params); | 325 | 0 | } | 326 | 0 | return true; | 327 | 116 | } |
Unexecuted instantiation: _ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIlEENS_12Decimal128V3ELb1ELb0ES4_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RKNT3_10NativeTypeERNS_14CastParametersE _ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIlEENS_12Decimal128V3ELb1ELb1ES4_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 308 | 116 | CastParameters& params) { | 309 | 116 | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 116 | if (from_scale < to_scale) { | 312 | 116 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 116 | narrow_integral>( | 314 | 116 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 116 | min_result, max_result, params); | 316 | 116 | } else if (from_scale == to_scale) { | 317 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 0 | max_result, params); | 320 | 0 | } else { | 321 | 0 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 0 | narrow_integral>( | 323 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 0 | min_result, max_result, params); | 325 | 0 | } | 326 | 0 | return true; | 327 | 116 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_12Decimal128V3ES2_Lb0ELb0ES2_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS4_jjRS3_jjRKNS3_10NativeTypeESA_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 308 | 429 | CastParameters& params) { | 309 | 429 | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 429 | if (from_scale < to_scale) { | 312 | 46 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 46 | narrow_integral>( | 314 | 46 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 46 | min_result, max_result, params); | 316 | 383 | } else if (from_scale == to_scale) { | 317 | 31 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 31 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 31 | max_result, params); | 320 | 352 | } else { | 321 | 352 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 352 | narrow_integral>( | 323 | 352 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 352 | min_result, max_result, params); | 325 | 352 | } | 326 | 0 | return true; | 327 | 429 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_12Decimal128V3ES2_Lb0ELb1ES2_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS4_jjRS3_jjRKNS3_10NativeTypeESA_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 308 | 208 | CastParameters& params) { | 309 | 208 | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 208 | if (from_scale < to_scale) { | 312 | 70 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 70 | narrow_integral>( | 314 | 70 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 70 | min_result, max_result, params); | 316 | 138 | } else if (from_scale == to_scale) { | 317 | 42 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 42 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 42 | max_result, params); | 320 | 96 | } else { | 321 | 96 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 96 | narrow_integral>( | 323 | 96 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 96 | min_result, max_result, params); | 325 | 96 | } | 326 | 0 | return true; | 327 | 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 | 308 | 184 | CastParameters& params) { | 309 | 184 | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 184 | if (from_scale < to_scale) { | 312 | 184 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 184 | narrow_integral>( | 314 | 184 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 184 | min_result, max_result, params); | 316 | 184 | } else if (from_scale == to_scale) { | 317 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 0 | max_result, params); | 320 | 0 | } else { | 321 | 0 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 0 | narrow_integral>( | 323 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 0 | min_result, max_result, params); | 325 | 0 | } | 326 | 0 | return true; | 327 | 184 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIN4wide7integerILm256EiEEEENS_12Decimal128V3ELb0ELb0ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKNS8_10NativeTypeESF_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 308 | 288 | CastParameters& params) { | 309 | 288 | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 288 | if (from_scale < to_scale) { | 312 | 0 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 0 | narrow_integral>( | 314 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 0 | min_result, max_result, params); | 316 | 288 | } else if (from_scale == to_scale) { | 317 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 0 | max_result, params); | 320 | 288 | } else { | 321 | 288 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 288 | narrow_integral>( | 323 | 288 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 288 | min_result, max_result, params); | 325 | 288 | } | 326 | 0 | return true; | 327 | 288 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIN4wide7integerILm256EiEEEENS_12Decimal128V3ELb0ELb1ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKNS8_10NativeTypeESF_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 308 | 532 | CastParameters& params) { | 309 | 532 | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 532 | if (from_scale < to_scale) { | 312 | 0 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 0 | narrow_integral>( | 314 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 0 | min_result, max_result, params); | 316 | 532 | } else if (from_scale == to_scale) { | 317 | 182 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 182 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 182 | max_result, params); | 320 | 350 | } else { | 321 | 350 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 350 | narrow_integral>( | 323 | 350 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 350 | min_result, max_result, params); | 325 | 350 | } | 326 | 0 | return true; | 327 | 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 | 308 | 224 | CastParameters& params) { | 309 | 224 | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 224 | if (from_scale < to_scale) { | 312 | 224 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 224 | narrow_integral>( | 314 | 224 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 224 | min_result, max_result, params); | 316 | 224 | } else if (from_scale == to_scale) { | 317 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 0 | max_result, params); | 320 | 0 | } else { | 321 | 0 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 0 | narrow_integral>( | 323 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 0 | min_result, max_result, params); | 325 | 0 | } | 326 | 0 | return true; | 327 | 224 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIiEENS2_IN4wide7integerILm256EiEEEELb0ELb0ES7_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKNS8_10NativeTypeESF_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 308 | 378 | CastParameters& params) { | 309 | 378 | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 378 | if (from_scale < to_scale) { | 312 | 120 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 120 | narrow_integral>( | 314 | 120 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 120 | min_result, max_result, params); | 316 | 258 | } else if (from_scale == to_scale) { | 317 | 74 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 74 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 74 | max_result, params); | 320 | 184 | } else { | 321 | 184 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 184 | narrow_integral>( | 323 | 184 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 184 | min_result, max_result, params); | 325 | 184 | } | 326 | 0 | return true; | 327 | 378 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIiEENS2_IN4wide7integerILm256EiEEEELb0ELb1ES7_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKNS8_10NativeTypeESF_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 308 | 65 | CastParameters& params) { | 309 | 65 | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 65 | if (from_scale < to_scale) { | 312 | 65 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 65 | narrow_integral>( | 314 | 65 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 65 | min_result, max_result, params); | 316 | 65 | } else if (from_scale == to_scale) { | 317 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 0 | max_result, params); | 320 | 0 | } else { | 321 | 0 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 0 | narrow_integral>( | 323 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 0 | min_result, max_result, params); | 325 | 0 | } | 326 | 0 | return true; | 327 | 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 | 308 | 65 | CastParameters& params) { | 309 | 65 | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 65 | if (from_scale < to_scale) { | 312 | 65 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 65 | narrow_integral>( | 314 | 65 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 65 | min_result, max_result, params); | 316 | 65 | } else if (from_scale == to_scale) { | 317 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 0 | max_result, params); | 320 | 0 | } else { | 321 | 0 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 0 | narrow_integral>( | 323 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 0 | min_result, max_result, params); | 325 | 0 | } | 326 | 0 | return true; | 327 | 65 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIlEENS2_IN4wide7integerILm256EiEEEELb0ELb0ES7_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKNS8_10NativeTypeESF_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 308 | 656 | CastParameters& params) { | 309 | 656 | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 656 | if (from_scale < to_scale) { | 312 | 184 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 184 | narrow_integral>( | 314 | 184 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 184 | min_result, max_result, params); | 316 | 472 | } else if (from_scale == to_scale) { | 317 | 120 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 120 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 120 | max_result, params); | 320 | 352 | } else { | 321 | 352 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 352 | narrow_integral>( | 323 | 352 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 352 | min_result, max_result, params); | 325 | 352 | } | 326 | 0 | return true; | 327 | 656 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIlEENS2_IN4wide7integerILm256EiEEEELb0ELb1ES7_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKNS8_10NativeTypeESF_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 308 | 116 | CastParameters& params) { | 309 | 116 | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 116 | if (from_scale < to_scale) { | 312 | 116 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 116 | narrow_integral>( | 314 | 116 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 116 | min_result, max_result, params); | 316 | 116 | } else if (from_scale == to_scale) { | 317 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 0 | max_result, params); | 320 | 0 | } else { | 321 | 0 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 0 | narrow_integral>( | 323 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 0 | min_result, max_result, params); | 325 | 0 | } | 326 | 0 | return true; | 327 | 116 | } |
Unexecuted instantiation: _ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIlEENS2_IN4wide7integerILm256EiEEEELb1ELb0ES7_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKNS8_10NativeTypeESF_RKNT3_10NativeTypeERNS_14CastParametersE _ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIlEENS2_IN4wide7integerILm256EiEEEELb1ELb1ES7_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKNS8_10NativeTypeESF_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 308 | 116 | CastParameters& params) { | 309 | 116 | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 116 | if (from_scale < to_scale) { | 312 | 116 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 116 | narrow_integral>( | 314 | 116 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 116 | min_result, max_result, params); | 316 | 116 | } else if (from_scale == to_scale) { | 317 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 0 | max_result, params); | 320 | 0 | } else { | 321 | 0 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 0 | narrow_integral>( | 323 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 0 | min_result, max_result, params); | 325 | 0 | } | 326 | 0 | return true; | 327 | 116 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_12Decimal128V3ENS_7DecimalIN4wide7integerILm256EiEEEELb0ELb0ES7_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKNS8_10NativeTypeESF_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 308 | 656 | CastParameters& params) { | 309 | 656 | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 656 | if (from_scale < to_scale) { | 312 | 176 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 176 | narrow_integral>( | 314 | 176 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 176 | min_result, max_result, params); | 316 | 480 | } else if (from_scale == to_scale) { | 317 | 128 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 128 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 128 | max_result, params); | 320 | 352 | } else { | 321 | 352 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 352 | narrow_integral>( | 323 | 352 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 352 | min_result, max_result, params); | 325 | 352 | } | 326 | 0 | return true; | 327 | 656 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_12Decimal128V3ENS_7DecimalIN4wide7integerILm256EiEEEELb0ELb1ES7_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKNS8_10NativeTypeESF_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 308 | 109 | CastParameters& params) { | 309 | 109 | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 109 | if (from_scale < to_scale) { | 312 | 109 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 109 | narrow_integral>( | 314 | 109 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 109 | min_result, max_result, params); | 316 | 109 | } else if (from_scale == to_scale) { | 317 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 0 | max_result, params); | 320 | 0 | } else { | 321 | 0 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 0 | narrow_integral>( | 323 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 0 | min_result, max_result, params); | 325 | 0 | } | 326 | 0 | return true; | 327 | 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 | 308 | 123 | CastParameters& params) { | 309 | 123 | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 123 | if (from_scale < to_scale) { | 312 | 123 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 123 | narrow_integral>( | 314 | 123 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 123 | min_result, max_result, params); | 316 | 123 | } else if (from_scale == to_scale) { | 317 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 0 | max_result, params); | 320 | 0 | } else { | 321 | 0 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 0 | narrow_integral>( | 323 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 0 | min_result, max_result, params); | 325 | 0 | } | 326 | 0 | return true; | 327 | 123 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIN4wide7integerILm256EiEEEES6_Lb0ELb0ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS8_jjRS7_jjRKNS7_10NativeTypeESE_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 308 | 428 | CastParameters& params) { | 309 | 428 | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 428 | if (from_scale < to_scale) { | 312 | 46 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 46 | narrow_integral>( | 314 | 46 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 46 | min_result, max_result, params); | 316 | 382 | } else if (from_scale == to_scale) { | 317 | 30 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 30 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 30 | max_result, params); | 320 | 352 | } else { | 321 | 352 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 352 | narrow_integral>( | 323 | 352 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 352 | min_result, max_result, params); | 325 | 352 | } | 326 | 0 | return true; | 327 | 428 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_7DecimalIN4wide7integerILm256EiEEEES6_Lb0ELb1ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS8_jjRS7_jjRKNS7_10NativeTypeESE_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 308 | 182 | CastParameters& params) { | 309 | 182 | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 182 | if (from_scale < to_scale) { | 312 | 44 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 44 | narrow_integral>( | 314 | 44 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 44 | min_result, max_result, params); | 316 | 138 | } else if (from_scale == to_scale) { | 317 | 42 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 42 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 42 | max_result, params); | 320 | 96 | } else { | 321 | 96 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 96 | narrow_integral>( | 323 | 96 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 96 | min_result, max_result, params); | 325 | 96 | } | 326 | 0 | return true; | 327 | 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 | 308 | 210 | CastParameters& params) { | 309 | 210 | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 210 | if (from_scale < to_scale) { | 312 | 210 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 210 | narrow_integral>( | 314 | 210 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 210 | min_result, max_result, params); | 316 | 210 | } else if (from_scale == to_scale) { | 317 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 0 | max_result, params); | 320 | 0 | } else { | 321 | 0 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 0 | narrow_integral>( | 323 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 0 | min_result, max_result, params); | 325 | 0 | } | 326 | 0 | return true; | 327 | 210 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_14DecimalV2ValueENS_7DecimalIiEELb0ELb0ES2_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 308 | 36 | CastParameters& params) { | 309 | 36 | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 36 | if (from_scale < to_scale) { | 312 | 0 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 0 | narrow_integral>( | 314 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 0 | min_result, max_result, params); | 316 | 36 | } else if (from_scale == to_scale) { | 317 | 4 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 4 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 4 | max_result, params); | 320 | 32 | } else { | 321 | 32 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 32 | narrow_integral>( | 323 | 32 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 32 | min_result, max_result, params); | 325 | 32 | } | 326 | 0 | return true; | 327 | 36 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_14DecimalV2ValueENS_7DecimalIiEELb0ELb1ES2_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 308 | 470 | CastParameters& params) { | 309 | 470 | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 470 | if (from_scale < to_scale) { | 312 | 0 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 0 | narrow_integral>( | 314 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 0 | min_result, max_result, params); | 316 | 470 | } else if (from_scale == to_scale) { | 317 | 35 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 35 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 35 | max_result, params); | 320 | 435 | } else { | 321 | 435 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 435 | narrow_integral>( | 323 | 435 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 435 | min_result, max_result, params); | 325 | 435 | } | 326 | 0 | return true; | 327 | 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 | 308 | 131 | CastParameters& params) { | 309 | 131 | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 131 | if (from_scale < to_scale) { | 312 | 0 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 0 | narrow_integral>( | 314 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 0 | min_result, max_result, params); | 316 | 131 | } else if (from_scale == to_scale) { | 317 | 7 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 7 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 7 | max_result, params); | 320 | 124 | } else { | 321 | 124 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 124 | narrow_integral>( | 323 | 124 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 124 | min_result, max_result, params); | 325 | 124 | } | 326 | 0 | return true; | 327 | 131 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_14DecimalV2ValueENS_7DecimalIlEELb0ELb1ES2_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 308 | 414 | CastParameters& params) { | 309 | 414 | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 414 | if (from_scale < to_scale) { | 312 | 0 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 0 | narrow_integral>( | 314 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 0 | min_result, max_result, params); | 316 | 414 | } else if (from_scale == to_scale) { | 317 | 60 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 60 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 60 | max_result, params); | 320 | 354 | } else { | 321 | 354 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 354 | narrow_integral>( | 323 | 354 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 354 | min_result, max_result, params); | 325 | 354 | } | 326 | 0 | return true; | 327 | 414 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_14DecimalV2ValueENS_7DecimalIlEELb1ELb0ES2_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 308 | 15 | CastParameters& params) { | 309 | 15 | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 15 | if (from_scale < to_scale) { | 312 | 15 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 15 | narrow_integral>( | 314 | 15 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 15 | min_result, max_result, params); | 316 | 15 | } else if (from_scale == to_scale) { | 317 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 0 | max_result, params); | 320 | 0 | } else { | 321 | 0 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 0 | narrow_integral>( | 323 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 0 | min_result, max_result, params); | 325 | 0 | } | 326 | 0 | return true; | 327 | 15 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_14DecimalV2ValueENS_7DecimalIlEELb1ELb1ES2_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 308 | 130 | CastParameters& params) { | 309 | 130 | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 130 | if (from_scale < to_scale) { | 312 | 130 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 130 | narrow_integral>( | 314 | 130 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 130 | min_result, max_result, params); | 316 | 130 | } else if (from_scale == to_scale) { | 317 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 0 | max_result, params); | 320 | 0 | } else { | 321 | 0 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 0 | narrow_integral>( | 323 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 0 | min_result, max_result, params); | 325 | 0 | } | 326 | 0 | return true; | 327 | 130 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_14DecimalV2ValueENS_12Decimal128V3ELb0ELb0ES3_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKNS4_10NativeTypeESB_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 308 | 375 | CastParameters& params) { | 309 | 375 | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 375 | if (from_scale < to_scale) { | 312 | 11 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 11 | narrow_integral>( | 314 | 11 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 11 | min_result, max_result, params); | 316 | 364 | } else if (from_scale == to_scale) { | 317 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 0 | max_result, params); | 320 | 364 | } else { | 321 | 364 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 364 | narrow_integral>( | 323 | 364 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 364 | min_result, max_result, params); | 325 | 364 | } | 326 | 0 | return true; | 327 | 375 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_14DecimalV2ValueENS_12Decimal128V3ELb0ELb1ES3_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKNS4_10NativeTypeESB_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 308 | 145 | CastParameters& params) { | 309 | 145 | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 145 | if (from_scale < to_scale) { | 312 | 95 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 95 | narrow_integral>( | 314 | 95 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 95 | min_result, max_result, params); | 316 | 95 | } else if (from_scale == to_scale) { | 317 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 0 | max_result, params); | 320 | 50 | } else { | 321 | 50 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 50 | narrow_integral>( | 323 | 50 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 50 | min_result, max_result, params); | 325 | 50 | } | 326 | 0 | return true; | 327 | 145 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_14DecimalV2ValueENS_12Decimal128V3ELb1ELb0ES3_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKNS4_10NativeTypeESB_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 308 | 11 | CastParameters& params) { | 309 | 11 | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 11 | if (from_scale < to_scale) { | 312 | 11 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 11 | narrow_integral>( | 314 | 11 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 11 | min_result, max_result, params); | 316 | 11 | } else if (from_scale == to_scale) { | 317 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 0 | max_result, params); | 320 | 0 | } else { | 321 | 0 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 0 | narrow_integral>( | 323 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 0 | min_result, max_result, params); | 325 | 0 | } | 326 | 0 | return true; | 327 | 11 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_14DecimalV2ValueENS_12Decimal128V3ELb1ELb1ES3_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKNS4_10NativeTypeESB_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 308 | 95 | CastParameters& params) { | 309 | 95 | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 95 | if (from_scale < to_scale) { | 312 | 95 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 95 | narrow_integral>( | 314 | 95 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 95 | min_result, max_result, params); | 316 | 95 | } else if (from_scale == to_scale) { | 317 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 0 | max_result, params); | 320 | 0 | } else { | 321 | 0 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 0 | narrow_integral>( | 323 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 0 | min_result, max_result, params); | 325 | 0 | } | 326 | 0 | return true; | 327 | 95 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_14DecimalV2ValueENS_7DecimalIN4wide7integerILm256EiEEEELb0ELb0ES7_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKNS8_10NativeTypeESF_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 308 | 423 | CastParameters& params) { | 309 | 423 | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 423 | if (from_scale < to_scale) { | 312 | 11 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 11 | narrow_integral>( | 314 | 11 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 11 | min_result, max_result, params); | 316 | 412 | } else if (from_scale == to_scale) { | 317 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 0 | max_result, params); | 320 | 412 | } else { | 321 | 412 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 412 | narrow_integral>( | 323 | 412 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 412 | min_result, max_result, params); | 325 | 412 | } | 326 | 0 | return true; | 327 | 423 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_14DecimalV2ValueENS_7DecimalIN4wide7integerILm256EiEEEELb0ELb1ES7_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKNS8_10NativeTypeESF_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 308 | 95 | CastParameters& params) { | 309 | 95 | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 95 | if (from_scale < to_scale) { | 312 | 95 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 95 | narrow_integral>( | 314 | 95 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 95 | min_result, max_result, params); | 316 | 95 | } else if (from_scale == to_scale) { | 317 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 0 | max_result, params); | 320 | 0 | } else { | 321 | 0 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 0 | narrow_integral>( | 323 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 0 | min_result, max_result, params); | 325 | 0 | } | 326 | 0 | return true; | 327 | 95 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_14DecimalV2ValueENS_7DecimalIN4wide7integerILm256EiEEEELb1ELb0ES7_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKNS8_10NativeTypeESF_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 308 | 11 | CastParameters& params) { | 309 | 11 | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 11 | if (from_scale < to_scale) { | 312 | 11 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 11 | narrow_integral>( | 314 | 11 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 11 | min_result, max_result, params); | 316 | 11 | } else if (from_scale == to_scale) { | 317 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 0 | max_result, params); | 320 | 0 | } else { | 321 | 0 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 0 | narrow_integral>( | 323 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 0 | min_result, max_result, params); | 325 | 0 | } | 326 | 0 | return true; | 327 | 11 | } |
_ZN5doris13CastToDecimal13_from_decimalINS_14DecimalV2ValueENS_7DecimalIN4wide7integerILm256EiEEEELb1ELb1ES7_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKNS8_10NativeTypeESF_RKNT3_10NativeTypeERNS_14CastParametersE Line | Count | Source | 308 | 95 | CastParameters& params) { | 309 | 95 | using MaxNativeType = typename MaxFieldType::NativeType; | 310 | | | 311 | 95 | if (from_scale < to_scale) { | 312 | 95 | return _from_decimal_smaller_scale<FromCppT, ToCppT, multiply_may_overflow, | 313 | 95 | narrow_integral>( | 314 | 95 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 315 | 95 | min_result, max_result, params); | 316 | 95 | } else if (from_scale == to_scale) { | 317 | 0 | return _from_decimal_same_scale<FromCppT, ToCppT, MaxNativeType, narrow_integral>( | 318 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, min_result, | 319 | 0 | max_result, params); | 320 | 0 | } else { | 321 | 0 | return _from_decimal_bigger_scale<FromCppT, ToCppT, multiply_may_overflow, | 322 | 0 | narrow_integral>( | 323 | 0 | from, from_precision, from_scale, to, to_precision, to_scale, scale_multiplier, | 324 | 0 | min_result, max_result, params); | 325 | 0 | } | 326 | 0 | return true; | 327 | 95 | } |
|
328 | | |
329 | | template < |
330 | | typename FromCppT, typename ToCppT, bool multiply_may_overflow, bool narrow_integral, |
331 | | typename MaxNativeType = std::conditional_t< |
332 | | (sizeof(FromCppT) == sizeof(ToCppT)) && |
333 | | (std::is_same_v<ToCppT, Decimal128V3> || |
334 | | std::is_same_v<FromCppT, Decimal128V3>), |
335 | | Decimal128V3::NativeType, |
336 | | std::conditional_t<(sizeof(FromCppT) > sizeof(ToCppT)), |
337 | | typename FromCppT::NativeType, typename ToCppT::NativeType>>> |
338 | | requires(IsDecimalNumber<ToCppT> && IsDecimalNumber<FromCppT>) |
339 | | static inline bool _from_decimal_smaller_scale( |
340 | | const FromCppT& from, const UInt32 precision_from, const UInt32 scale_from, ToCppT& to, |
341 | | UInt32 precision_to, UInt32 scale_to, const MaxNativeType& scale_multiplier, |
342 | | const typename ToCppT::NativeType& min_result, |
343 | 4.59k | const typename ToCppT::NativeType& max_result, CastParameters& params) { |
344 | 4.59k | MaxNativeType res; |
345 | 4.59k | if constexpr (multiply_may_overflow) { |
346 | 2.65k | if constexpr (IsDecimal128V2<FromCppT>) { |
347 | 357 | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, |
348 | 357 | res)) { |
349 | 28 | if (params.is_strict) { |
350 | 6 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( |
351 | 6 | decimal_to_string(from.value(), scale_from), |
352 | 6 | fmt::format("decimal({}, {})", precision_from, scale_from), |
353 | 6 | precision_to, scale_to); |
354 | 6 | } |
355 | 28 | return false; |
356 | 329 | } else { |
357 | 329 | if (UNLIKELY(res > max_result || res < -max_result)) { |
358 | 80 | if (params.is_strict) { |
359 | 48 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( |
360 | 48 | decimal_to_string(from.value(), scale_from), |
361 | 48 | fmt::format("decimal({}, {})", precision_from, scale_from), |
362 | 48 | precision_to, scale_to); |
363 | 48 | } |
364 | 80 | return false; |
365 | 249 | } else { |
366 | 249 | to = ToCppT(res); |
367 | 249 | } |
368 | 329 | } |
369 | 2.29k | } else { |
370 | 2.29k | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, |
371 | 2.29k | res)) { |
372 | 359 | if (params.is_strict) { |
373 | 30 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( |
374 | 30 | decimal_to_string(from.value, scale_from), |
375 | 30 | fmt::format("decimal({}, {})", precision_from, scale_from), |
376 | 30 | precision_to, scale_to); |
377 | 30 | } |
378 | 359 | return false; |
379 | 1.93k | } else { |
380 | 1.93k | if (UNLIKELY(res > max_result || res < -max_result)) { |
381 | 889 | if (params.is_strict) { |
382 | 594 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( |
383 | 594 | decimal_to_string(from.value, scale_from), |
384 | 594 | fmt::format("decimal({}, {})", precision_from, scale_from), |
385 | 594 | precision_to, scale_to); |
386 | 594 | } |
387 | 889 | return false; |
388 | 1.04k | } else { |
389 | 1.04k | to = ToCppT(res); |
390 | 1.04k | } |
391 | 1.93k | } |
392 | 2.29k | } |
393 | 2.65k | } else { |
394 | 1.94k | if constexpr (IsDecimal128V2<FromCppT>) { |
395 | 212 | res = from.value() * scale_multiplier; |
396 | 1.73k | } else { |
397 | 1.73k | res = from.value * scale_multiplier; |
398 | 1.73k | } |
399 | 1.94k | if constexpr (narrow_integral) { |
400 | 884 | if (UNLIKELY(res > max_result || res < -max_result)) { |
401 | 414 | if constexpr (IsDecimal128V2<FromCppT>) { |
402 | 60 | if (params.is_strict) { |
403 | 30 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( |
404 | 30 | decimal_to_string(from.value(), scale_from), |
405 | 30 | fmt::format("decimal({}, {})", precision_from, scale_from), |
406 | 30 | precision_to, scale_to); |
407 | 30 | } |
408 | 354 | } else { |
409 | 354 | if (params.is_strict) { |
410 | 177 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( |
411 | 177 | decimal_to_string(from.value, scale_from), |
412 | 177 | fmt::format("decimal({}, {})", precision_from, scale_from), |
413 | 177 | precision_to, scale_to); |
414 | 177 | } |
415 | 354 | } |
416 | 414 | return false; |
417 | 414 | } |
418 | 884 | } |
419 | 470 | to = ToCppT(res); |
420 | 1.94k | } |
421 | 1.29k | return true; |
422 | 4.59k | } _ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_7DecimalIiEES3_Lb0ELb0EiQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 343 | 14 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 344 | 14 | MaxNativeType res; | 345 | | if constexpr (multiply_may_overflow) { | 346 | | if constexpr (IsDecimal128V2<FromCppT>) { | 347 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 348 | | res)) { | 349 | | if (params.is_strict) { | 350 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 351 | | decimal_to_string(from.value(), scale_from), | 352 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 353 | | precision_to, scale_to); | 354 | | } | 355 | | return false; | 356 | | } else { | 357 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 358 | | if (params.is_strict) { | 359 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 360 | | decimal_to_string(from.value(), scale_from), | 361 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 362 | | precision_to, scale_to); | 363 | | } | 364 | | return false; | 365 | | } else { | 366 | | to = ToCppT(res); | 367 | | } | 368 | | } | 369 | | } else { | 370 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 371 | | res)) { | 372 | | if (params.is_strict) { | 373 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 374 | | decimal_to_string(from.value, scale_from), | 375 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 376 | | precision_to, scale_to); | 377 | | } | 378 | | return false; | 379 | | } else { | 380 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 381 | | if (params.is_strict) { | 382 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 383 | | decimal_to_string(from.value, scale_from), | 384 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 385 | | precision_to, scale_to); | 386 | | } | 387 | | return false; | 388 | | } else { | 389 | | to = ToCppT(res); | 390 | | } | 391 | | } | 392 | | } | 393 | 14 | } else { | 394 | | if constexpr (IsDecimal128V2<FromCppT>) { | 395 | | res = from.value() * scale_multiplier; | 396 | 14 | } else { | 397 | 14 | res = from.value * scale_multiplier; | 398 | 14 | } | 399 | | if constexpr (narrow_integral) { | 400 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 401 | | if constexpr (IsDecimal128V2<FromCppT>) { | 402 | | if (params.is_strict) { | 403 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 404 | | decimal_to_string(from.value(), scale_from), | 405 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 406 | | precision_to, scale_to); | 407 | | } | 408 | | } else { | 409 | | if (params.is_strict) { | 410 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 411 | | decimal_to_string(from.value, scale_from), | 412 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 413 | | precision_to, scale_to); | 414 | | } | 415 | | } | 416 | | return false; | 417 | | } | 418 | | } | 419 | 14 | to = ToCppT(res); | 420 | 14 | } | 421 | 14 | return true; | 422 | 14 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_7DecimalIiEES3_Lb0ELb1EiQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 343 | 7 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 344 | 7 | MaxNativeType res; | 345 | | if constexpr (multiply_may_overflow) { | 346 | | if constexpr (IsDecimal128V2<FromCppT>) { | 347 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 348 | | res)) { | 349 | | if (params.is_strict) { | 350 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 351 | | decimal_to_string(from.value(), scale_from), | 352 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 353 | | precision_to, scale_to); | 354 | | } | 355 | | return false; | 356 | | } else { | 357 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 358 | | if (params.is_strict) { | 359 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 360 | | decimal_to_string(from.value(), scale_from), | 361 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 362 | | precision_to, scale_to); | 363 | | } | 364 | | return false; | 365 | | } else { | 366 | | to = ToCppT(res); | 367 | | } | 368 | | } | 369 | | } else { | 370 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 371 | | res)) { | 372 | | if (params.is_strict) { | 373 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 374 | | decimal_to_string(from.value, scale_from), | 375 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 376 | | precision_to, scale_to); | 377 | | } | 378 | | return false; | 379 | | } else { | 380 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 381 | | if (params.is_strict) { | 382 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 383 | | decimal_to_string(from.value, scale_from), | 384 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 385 | | precision_to, scale_to); | 386 | | } | 387 | | return false; | 388 | | } else { | 389 | | to = ToCppT(res); | 390 | | } | 391 | | } | 392 | | } | 393 | 7 | } else { | 394 | | if constexpr (IsDecimal128V2<FromCppT>) { | 395 | | res = from.value() * scale_multiplier; | 396 | 7 | } else { | 397 | 7 | res = from.value * scale_multiplier; | 398 | 7 | } | 399 | 7 | if constexpr (narrow_integral) { | 400 | 7 | if (UNLIKELY(res > max_result || res < -max_result)) { | 401 | | if constexpr (IsDecimal128V2<FromCppT>) { | 402 | | if (params.is_strict) { | 403 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 404 | | decimal_to_string(from.value(), scale_from), | 405 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 406 | | precision_to, scale_to); | 407 | | } | 408 | 6 | } else { | 409 | 6 | if (params.is_strict) { | 410 | 3 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 411 | 3 | decimal_to_string(from.value, scale_from), | 412 | 3 | fmt::format("decimal({}, {})", precision_from, scale_from), | 413 | 3 | precision_to, scale_to); | 414 | 3 | } | 415 | 6 | } | 416 | 6 | return false; | 417 | 6 | } | 418 | 7 | } | 419 | 1 | to = ToCppT(res); | 420 | 7 | } | 421 | 0 | return true; | 422 | 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 | 343 | 84 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 344 | 84 | MaxNativeType res; | 345 | 84 | if constexpr (multiply_may_overflow) { | 346 | | if constexpr (IsDecimal128V2<FromCppT>) { | 347 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 348 | | res)) { | 349 | | if (params.is_strict) { | 350 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 351 | | decimal_to_string(from.value(), scale_from), | 352 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 353 | | precision_to, scale_to); | 354 | | } | 355 | | return false; | 356 | | } else { | 357 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 358 | | if (params.is_strict) { | 359 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 360 | | decimal_to_string(from.value(), scale_from), | 361 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 362 | | precision_to, scale_to); | 363 | | } | 364 | | return false; | 365 | | } else { | 366 | | to = ToCppT(res); | 367 | | } | 368 | | } | 369 | 84 | } else { | 370 | 84 | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 371 | 84 | res)) { | 372 | 16 | if (params.is_strict) { | 373 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 374 | 0 | decimal_to_string(from.value, scale_from), | 375 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 376 | 0 | precision_to, scale_to); | 377 | 0 | } | 378 | 16 | return false; | 379 | 68 | } else { | 380 | 68 | if (UNLIKELY(res > max_result || res < -max_result)) { | 381 | 32 | if (params.is_strict) { | 382 | 24 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 383 | 24 | decimal_to_string(from.value, scale_from), | 384 | 24 | fmt::format("decimal({}, {})", precision_from, scale_from), | 385 | 24 | precision_to, scale_to); | 386 | 24 | } | 387 | 32 | return false; | 388 | 36 | } else { | 389 | 36 | to = ToCppT(res); | 390 | 36 | } | 391 | 68 | } | 392 | 84 | } | 393 | | } else { | 394 | | if constexpr (IsDecimal128V2<FromCppT>) { | 395 | | res = from.value() * scale_multiplier; | 396 | | } else { | 397 | | res = from.value * scale_multiplier; | 398 | | } | 399 | | if constexpr (narrow_integral) { | 400 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 401 | | if constexpr (IsDecimal128V2<FromCppT>) { | 402 | | if (params.is_strict) { | 403 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 404 | | decimal_to_string(from.value(), scale_from), | 405 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 406 | | precision_to, scale_to); | 407 | | } | 408 | | } else { | 409 | | if (params.is_strict) { | 410 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 411 | | decimal_to_string(from.value, scale_from), | 412 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 413 | | precision_to, scale_to); | 414 | | } | 415 | | } | 416 | | return false; | 417 | | } | 418 | | } | 419 | | to = ToCppT(res); | 420 | | } | 421 | 36 | return true; | 422 | 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 | 343 | 126 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 344 | 126 | MaxNativeType res; | 345 | 126 | if constexpr (multiply_may_overflow) { | 346 | | if constexpr (IsDecimal128V2<FromCppT>) { | 347 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 348 | | res)) { | 349 | | if (params.is_strict) { | 350 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 351 | | decimal_to_string(from.value(), scale_from), | 352 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 353 | | precision_to, scale_to); | 354 | | } | 355 | | return false; | 356 | | } else { | 357 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 358 | | if (params.is_strict) { | 359 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 360 | | decimal_to_string(from.value(), scale_from), | 361 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 362 | | precision_to, scale_to); | 363 | | } | 364 | | return false; | 365 | | } else { | 366 | | to = ToCppT(res); | 367 | | } | 368 | | } | 369 | 126 | } else { | 370 | 126 | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 371 | 126 | res)) { | 372 | 14 | if (params.is_strict) { | 373 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 374 | 0 | decimal_to_string(from.value, scale_from), | 375 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 376 | 0 | precision_to, scale_to); | 377 | 0 | } | 378 | 14 | return false; | 379 | 112 | } else { | 380 | 112 | if (UNLIKELY(res > max_result || res < -max_result)) { | 381 | 58 | if (params.is_strict) { | 382 | 36 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 383 | 36 | decimal_to_string(from.value, scale_from), | 384 | 36 | fmt::format("decimal({}, {})", precision_from, scale_from), | 385 | 36 | precision_to, scale_to); | 386 | 36 | } | 387 | 58 | return false; | 388 | 58 | } else { | 389 | 54 | to = ToCppT(res); | 390 | 54 | } | 391 | 112 | } | 392 | 126 | } | 393 | | } else { | 394 | | if constexpr (IsDecimal128V2<FromCppT>) { | 395 | | res = from.value() * scale_multiplier; | 396 | | } else { | 397 | | res = from.value * scale_multiplier; | 398 | | } | 399 | | if constexpr (narrow_integral) { | 400 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 401 | | if constexpr (IsDecimal128V2<FromCppT>) { | 402 | | if (params.is_strict) { | 403 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 404 | | decimal_to_string(from.value(), scale_from), | 405 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 406 | | precision_to, scale_to); | 407 | | } | 408 | | } else { | 409 | | if (params.is_strict) { | 410 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 411 | | decimal_to_string(from.value, scale_from), | 412 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 413 | | precision_to, scale_to); | 414 | | } | 415 | | } | 416 | | return false; | 417 | | } | 418 | | } | 419 | | to = ToCppT(res); | 420 | | } | 421 | 54 | return true; | 422 | 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 | 343 | 126 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 344 | 126 | MaxNativeType res; | 345 | 126 | if constexpr (multiply_may_overflow) { | 346 | | if constexpr (IsDecimal128V2<FromCppT>) { | 347 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 348 | | res)) { | 349 | | if (params.is_strict) { | 350 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 351 | | decimal_to_string(from.value(), scale_from), | 352 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 353 | | precision_to, scale_to); | 354 | | } | 355 | | return false; | 356 | | } else { | 357 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 358 | | if (params.is_strict) { | 359 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 360 | | decimal_to_string(from.value(), scale_from), | 361 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 362 | | precision_to, scale_to); | 363 | | } | 364 | | return false; | 365 | | } else { | 366 | | to = ToCppT(res); | 367 | | } | 368 | | } | 369 | 126 | } else { | 370 | 126 | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 371 | 126 | res)) { | 372 | 12 | if (params.is_strict) { | 373 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 374 | 0 | decimal_to_string(from.value, scale_from), | 375 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 376 | 0 | precision_to, scale_to); | 377 | 0 | } | 378 | 12 | return false; | 379 | 114 | } else { | 380 | 114 | if (UNLIKELY(res > max_result || res < -max_result)) { | 381 | 60 | if (params.is_strict) { | 382 | 36 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 383 | 36 | decimal_to_string(from.value, scale_from), | 384 | 36 | fmt::format("decimal({}, {})", precision_from, scale_from), | 385 | 36 | precision_to, scale_to); | 386 | 36 | } | 387 | 60 | return false; | 388 | 60 | } else { | 389 | 54 | to = ToCppT(res); | 390 | 54 | } | 391 | 114 | } | 392 | 126 | } | 393 | | } else { | 394 | | if constexpr (IsDecimal128V2<FromCppT>) { | 395 | | res = from.value() * scale_multiplier; | 396 | | } else { | 397 | | res = from.value * scale_multiplier; | 398 | | } | 399 | | if constexpr (narrow_integral) { | 400 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 401 | | if constexpr (IsDecimal128V2<FromCppT>) { | 402 | | if (params.is_strict) { | 403 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 404 | | decimal_to_string(from.value(), scale_from), | 405 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 406 | | precision_to, scale_to); | 407 | | } | 408 | | } else { | 409 | | if (params.is_strict) { | 410 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 411 | | decimal_to_string(from.value, scale_from), | 412 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 413 | | precision_to, scale_to); | 414 | | } | 415 | | } | 416 | | return false; | 417 | | } | 418 | | } | 419 | | to = ToCppT(res); | 420 | | } | 421 | 54 | return true; | 422 | 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 | 343 | 126 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 344 | 126 | MaxNativeType res; | 345 | 126 | if constexpr (multiply_may_overflow) { | 346 | | if constexpr (IsDecimal128V2<FromCppT>) { | 347 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 348 | | res)) { | 349 | | if (params.is_strict) { | 350 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 351 | | decimal_to_string(from.value(), scale_from), | 352 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 353 | | precision_to, scale_to); | 354 | | } | 355 | | return false; | 356 | | } else { | 357 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 358 | | if (params.is_strict) { | 359 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 360 | | decimal_to_string(from.value(), scale_from), | 361 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 362 | | precision_to, scale_to); | 363 | | } | 364 | | return false; | 365 | | } else { | 366 | | to = ToCppT(res); | 367 | | } | 368 | | } | 369 | 126 | } else { | 370 | 126 | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 371 | 126 | res)) { | 372 | 12 | if (params.is_strict) { | 373 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 374 | 0 | decimal_to_string(from.value, scale_from), | 375 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 376 | 0 | precision_to, scale_to); | 377 | 0 | } | 378 | 12 | return false; | 379 | 114 | } else { | 380 | 114 | if (UNLIKELY(res > max_result || res < -max_result)) { | 381 | 60 | if (params.is_strict) { | 382 | 36 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 383 | 36 | decimal_to_string(from.value, scale_from), | 384 | 36 | fmt::format("decimal({}, {})", precision_from, scale_from), | 385 | 36 | precision_to, scale_to); | 386 | 36 | } | 387 | 60 | return false; | 388 | 60 | } else { | 389 | 54 | to = ToCppT(res); | 390 | 54 | } | 391 | 114 | } | 392 | 126 | } | 393 | | } else { | 394 | | if constexpr (IsDecimal128V2<FromCppT>) { | 395 | | res = from.value() * scale_multiplier; | 396 | | } else { | 397 | | res = from.value * scale_multiplier; | 398 | | } | 399 | | if constexpr (narrow_integral) { | 400 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 401 | | if constexpr (IsDecimal128V2<FromCppT>) { | 402 | | if (params.is_strict) { | 403 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 404 | | decimal_to_string(from.value(), scale_from), | 405 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 406 | | precision_to, scale_to); | 407 | | } | 408 | | } else { | 409 | | if (params.is_strict) { | 410 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 411 | | decimal_to_string(from.value, scale_from), | 412 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 413 | | precision_to, scale_to); | 414 | | } | 415 | | } | 416 | | return false; | 417 | | } | 418 | | } | 419 | | to = ToCppT(res); | 420 | | } | 421 | 54 | return true; | 422 | 126 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_7DecimalIiEENS2_IlEELb0ELb0ElQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKT3_RKNS5_10NativeTypeESF_RNS_14CastParametersE Line | Count | Source | 343 | 112 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 344 | 112 | MaxNativeType res; | 345 | | if constexpr (multiply_may_overflow) { | 346 | | if constexpr (IsDecimal128V2<FromCppT>) { | 347 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 348 | | res)) { | 349 | | if (params.is_strict) { | 350 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 351 | | decimal_to_string(from.value(), scale_from), | 352 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 353 | | precision_to, scale_to); | 354 | | } | 355 | | return false; | 356 | | } else { | 357 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 358 | | if (params.is_strict) { | 359 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 360 | | decimal_to_string(from.value(), scale_from), | 361 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 362 | | precision_to, scale_to); | 363 | | } | 364 | | return false; | 365 | | } else { | 366 | | to = ToCppT(res); | 367 | | } | 368 | | } | 369 | | } else { | 370 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 371 | | res)) { | 372 | | if (params.is_strict) { | 373 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 374 | | decimal_to_string(from.value, scale_from), | 375 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 376 | | precision_to, scale_to); | 377 | | } | 378 | | return false; | 379 | | } else { | 380 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 381 | | if (params.is_strict) { | 382 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 383 | | decimal_to_string(from.value, scale_from), | 384 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 385 | | precision_to, scale_to); | 386 | | } | 387 | | return false; | 388 | | } else { | 389 | | to = ToCppT(res); | 390 | | } | 391 | | } | 392 | | } | 393 | 112 | } else { | 394 | | if constexpr (IsDecimal128V2<FromCppT>) { | 395 | | res = from.value() * scale_multiplier; | 396 | 112 | } else { | 397 | 112 | res = from.value * scale_multiplier; | 398 | 112 | } | 399 | | if constexpr (narrow_integral) { | 400 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 401 | | if constexpr (IsDecimal128V2<FromCppT>) { | 402 | | if (params.is_strict) { | 403 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 404 | | decimal_to_string(from.value(), scale_from), | 405 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 406 | | precision_to, scale_to); | 407 | | } | 408 | | } else { | 409 | | if (params.is_strict) { | 410 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 411 | | decimal_to_string(from.value, scale_from), | 412 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 413 | | precision_to, scale_to); | 414 | | } | 415 | | } | 416 | | return false; | 417 | | } | 418 | | } | 419 | 112 | to = ToCppT(res); | 420 | 112 | } | 421 | 112 | return true; | 422 | 112 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_7DecimalIiEENS2_IlEELb0ELb1ElQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKT3_RKNS5_10NativeTypeESF_RNS_14CastParametersE Line | Count | Source | 343 | 58 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 344 | 58 | MaxNativeType res; | 345 | | if constexpr (multiply_may_overflow) { | 346 | | if constexpr (IsDecimal128V2<FromCppT>) { | 347 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 348 | | res)) { | 349 | | if (params.is_strict) { | 350 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 351 | | decimal_to_string(from.value(), scale_from), | 352 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 353 | | precision_to, scale_to); | 354 | | } | 355 | | return false; | 356 | | } else { | 357 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 358 | | if (params.is_strict) { | 359 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 360 | | decimal_to_string(from.value(), scale_from), | 361 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 362 | | precision_to, scale_to); | 363 | | } | 364 | | return false; | 365 | | } else { | 366 | | to = ToCppT(res); | 367 | | } | 368 | | } | 369 | | } else { | 370 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 371 | | res)) { | 372 | | if (params.is_strict) { | 373 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 374 | | decimal_to_string(from.value, scale_from), | 375 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 376 | | precision_to, scale_to); | 377 | | } | 378 | | return false; | 379 | | } else { | 380 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 381 | | if (params.is_strict) { | 382 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 383 | | decimal_to_string(from.value, scale_from), | 384 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 385 | | precision_to, scale_to); | 386 | | } | 387 | | return false; | 388 | | } else { | 389 | | to = ToCppT(res); | 390 | | } | 391 | | } | 392 | | } | 393 | 58 | } else { | 394 | | if constexpr (IsDecimal128V2<FromCppT>) { | 395 | | res = from.value() * scale_multiplier; | 396 | 58 | } else { | 397 | 58 | res = from.value * scale_multiplier; | 398 | 58 | } | 399 | 58 | if constexpr (narrow_integral) { | 400 | 58 | if (UNLIKELY(res > max_result || res < -max_result)) { | 401 | | if constexpr (IsDecimal128V2<FromCppT>) { | 402 | | if (params.is_strict) { | 403 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 404 | | decimal_to_string(from.value(), scale_from), | 405 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 406 | | precision_to, scale_to); | 407 | | } | 408 | 30 | } else { | 409 | 30 | if (params.is_strict) { | 410 | 15 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 411 | 15 | decimal_to_string(from.value, scale_from), | 412 | 15 | fmt::format("decimal({}, {})", precision_from, scale_from), | 413 | 15 | precision_to, scale_to); | 414 | 15 | } | 415 | 30 | } | 416 | 30 | return false; | 417 | 30 | } | 418 | 58 | } | 419 | 28 | to = ToCppT(res); | 420 | 58 | } | 421 | 0 | return true; | 422 | 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 | 343 | 72 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 344 | 72 | MaxNativeType res; | 345 | 72 | if constexpr (multiply_may_overflow) { | 346 | | if constexpr (IsDecimal128V2<FromCppT>) { | 347 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 348 | | res)) { | 349 | | if (params.is_strict) { | 350 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 351 | | decimal_to_string(from.value(), scale_from), | 352 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 353 | | precision_to, scale_to); | 354 | | } | 355 | | return false; | 356 | | } else { | 357 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 358 | | if (params.is_strict) { | 359 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 360 | | decimal_to_string(from.value(), scale_from), | 361 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 362 | | precision_to, scale_to); | 363 | | } | 364 | | return false; | 365 | | } else { | 366 | | to = ToCppT(res); | 367 | | } | 368 | | } | 369 | 72 | } else { | 370 | 72 | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 371 | 72 | res)) { | 372 | 11 | if (params.is_strict) { | 373 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 374 | 0 | decimal_to_string(from.value, scale_from), | 375 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 376 | 0 | precision_to, scale_to); | 377 | 0 | } | 378 | 11 | return false; | 379 | 61 | } else { | 380 | 61 | if (UNLIKELY(res > max_result || res < -max_result)) { | 381 | 31 | if (params.is_strict) { | 382 | 21 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 383 | 21 | decimal_to_string(from.value, scale_from), | 384 | 21 | fmt::format("decimal({}, {})", precision_from, scale_from), | 385 | 21 | precision_to, scale_to); | 386 | 21 | } | 387 | 31 | return false; | 388 | 31 | } else { | 389 | 30 | to = ToCppT(res); | 390 | 30 | } | 391 | 61 | } | 392 | 72 | } | 393 | | } else { | 394 | | if constexpr (IsDecimal128V2<FromCppT>) { | 395 | | res = from.value() * scale_multiplier; | 396 | | } else { | 397 | | res = from.value * scale_multiplier; | 398 | | } | 399 | | if constexpr (narrow_integral) { | 400 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 401 | | if constexpr (IsDecimal128V2<FromCppT>) { | 402 | | if (params.is_strict) { | 403 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 404 | | decimal_to_string(from.value(), scale_from), | 405 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 406 | | precision_to, scale_to); | 407 | | } | 408 | | } else { | 409 | | if (params.is_strict) { | 410 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 411 | | decimal_to_string(from.value, scale_from), | 412 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 413 | | precision_to, scale_to); | 414 | | } | 415 | | } | 416 | | return false; | 417 | | } | 418 | | } | 419 | | to = ToCppT(res); | 420 | | } | 421 | 30 | return true; | 422 | 72 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_7DecimalIlEES3_Lb0ELb0ElQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 343 | 46 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 344 | 46 | MaxNativeType res; | 345 | | if constexpr (multiply_may_overflow) { | 346 | | if constexpr (IsDecimal128V2<FromCppT>) { | 347 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 348 | | res)) { | 349 | | if (params.is_strict) { | 350 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 351 | | decimal_to_string(from.value(), scale_from), | 352 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 353 | | precision_to, scale_to); | 354 | | } | 355 | | return false; | 356 | | } else { | 357 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 358 | | if (params.is_strict) { | 359 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 360 | | decimal_to_string(from.value(), scale_from), | 361 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 362 | | precision_to, scale_to); | 363 | | } | 364 | | return false; | 365 | | } else { | 366 | | to = ToCppT(res); | 367 | | } | 368 | | } | 369 | | } else { | 370 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 371 | | res)) { | 372 | | if (params.is_strict) { | 373 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 374 | | decimal_to_string(from.value, scale_from), | 375 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 376 | | precision_to, scale_to); | 377 | | } | 378 | | return false; | 379 | | } else { | 380 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 381 | | if (params.is_strict) { | 382 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 383 | | decimal_to_string(from.value, scale_from), | 384 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 385 | | precision_to, scale_to); | 386 | | } | 387 | | return false; | 388 | | } else { | 389 | | to = ToCppT(res); | 390 | | } | 391 | | } | 392 | | } | 393 | 46 | } else { | 394 | | if constexpr (IsDecimal128V2<FromCppT>) { | 395 | | res = from.value() * scale_multiplier; | 396 | 46 | } else { | 397 | 46 | res = from.value * scale_multiplier; | 398 | 46 | } | 399 | | if constexpr (narrow_integral) { | 400 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 401 | | if constexpr (IsDecimal128V2<FromCppT>) { | 402 | | if (params.is_strict) { | 403 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 404 | | decimal_to_string(from.value(), scale_from), | 405 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 406 | | precision_to, scale_to); | 407 | | } | 408 | | } else { | 409 | | if (params.is_strict) { | 410 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 411 | | decimal_to_string(from.value, scale_from), | 412 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 413 | | precision_to, scale_to); | 414 | | } | 415 | | } | 416 | | return false; | 417 | | } | 418 | | } | 419 | 46 | to = ToCppT(res); | 420 | 46 | } | 421 | 46 | return true; | 422 | 46 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_7DecimalIlEES3_Lb0ELb1ElQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 343 | 44 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 344 | 44 | MaxNativeType res; | 345 | | if constexpr (multiply_may_overflow) { | 346 | | if constexpr (IsDecimal128V2<FromCppT>) { | 347 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 348 | | res)) { | 349 | | if (params.is_strict) { | 350 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 351 | | decimal_to_string(from.value(), scale_from), | 352 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 353 | | precision_to, scale_to); | 354 | | } | 355 | | return false; | 356 | | } else { | 357 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 358 | | if (params.is_strict) { | 359 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 360 | | decimal_to_string(from.value(), scale_from), | 361 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 362 | | precision_to, scale_to); | 363 | | } | 364 | | return false; | 365 | | } else { | 366 | | to = ToCppT(res); | 367 | | } | 368 | | } | 369 | | } else { | 370 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 371 | | res)) { | 372 | | if (params.is_strict) { | 373 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 374 | | decimal_to_string(from.value, scale_from), | 375 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 376 | | precision_to, scale_to); | 377 | | } | 378 | | return false; | 379 | | } else { | 380 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 381 | | if (params.is_strict) { | 382 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 383 | | decimal_to_string(from.value, scale_from), | 384 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 385 | | precision_to, scale_to); | 386 | | } | 387 | | return false; | 388 | | } else { | 389 | | to = ToCppT(res); | 390 | | } | 391 | | } | 392 | | } | 393 | 44 | } else { | 394 | | if constexpr (IsDecimal128V2<FromCppT>) { | 395 | | res = from.value() * scale_multiplier; | 396 | 44 | } else { | 397 | 44 | res = from.value * scale_multiplier; | 398 | 44 | } | 399 | 44 | if constexpr (narrow_integral) { | 400 | 44 | if (UNLIKELY(res > max_result || res < -max_result)) { | 401 | | if constexpr (IsDecimal128V2<FromCppT>) { | 402 | | if (params.is_strict) { | 403 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 404 | | decimal_to_string(from.value(), scale_from), | 405 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 406 | | precision_to, scale_to); | 407 | | } | 408 | 18 | } else { | 409 | 18 | if (params.is_strict) { | 410 | 9 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 411 | 9 | decimal_to_string(from.value, scale_from), | 412 | 9 | fmt::format("decimal({}, {})", precision_from, scale_from), | 413 | 9 | precision_to, scale_to); | 414 | 9 | } | 415 | 18 | } | 416 | 18 | return false; | 417 | 18 | } | 418 | 44 | } | 419 | 26 | to = ToCppT(res); | 420 | 44 | } | 421 | 0 | return true; | 422 | 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 | 343 | 210 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 344 | 210 | MaxNativeType res; | 345 | 210 | if constexpr (multiply_may_overflow) { | 346 | | if constexpr (IsDecimal128V2<FromCppT>) { | 347 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 348 | | res)) { | 349 | | if (params.is_strict) { | 350 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 351 | | decimal_to_string(from.value(), scale_from), | 352 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 353 | | precision_to, scale_to); | 354 | | } | 355 | | return false; | 356 | | } else { | 357 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 358 | | if (params.is_strict) { | 359 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 360 | | decimal_to_string(from.value(), scale_from), | 361 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 362 | | precision_to, scale_to); | 363 | | } | 364 | | return false; | 365 | | } else { | 366 | | to = ToCppT(res); | 367 | | } | 368 | | } | 369 | 210 | } else { | 370 | 210 | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 371 | 210 | res)) { | 372 | 36 | if (params.is_strict) { | 373 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 374 | 0 | decimal_to_string(from.value, scale_from), | 375 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 376 | 0 | precision_to, scale_to); | 377 | 0 | } | 378 | 36 | return false; | 379 | 174 | } else { | 380 | 174 | if (UNLIKELY(res > max_result || res < -max_result)) { | 381 | 78 | if (params.is_strict) { | 382 | 57 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 383 | 57 | decimal_to_string(from.value, scale_from), | 384 | 57 | fmt::format("decimal({}, {})", precision_from, scale_from), | 385 | 57 | precision_to, scale_to); | 386 | 57 | } | 387 | 78 | return false; | 388 | 96 | } else { | 389 | 96 | to = ToCppT(res); | 390 | 96 | } | 391 | 174 | } | 392 | 210 | } | 393 | | } else { | 394 | | if constexpr (IsDecimal128V2<FromCppT>) { | 395 | | res = from.value() * scale_multiplier; | 396 | | } else { | 397 | | res = from.value * scale_multiplier; | 398 | | } | 399 | | if constexpr (narrow_integral) { | 400 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 401 | | if constexpr (IsDecimal128V2<FromCppT>) { | 402 | | if (params.is_strict) { | 403 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 404 | | decimal_to_string(from.value(), scale_from), | 405 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 406 | | precision_to, scale_to); | 407 | | } | 408 | | } else { | 409 | | if (params.is_strict) { | 410 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 411 | | decimal_to_string(from.value, scale_from), | 412 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 413 | | precision_to, scale_to); | 414 | | } | 415 | | } | 416 | | return false; | 417 | | } | 418 | | } | 419 | | to = ToCppT(res); | 420 | | } | 421 | 96 | return true; | 422 | 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 | 343 | 224 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 344 | 224 | MaxNativeType res; | 345 | 224 | if constexpr (multiply_may_overflow) { | 346 | | if constexpr (IsDecimal128V2<FromCppT>) { | 347 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 348 | | res)) { | 349 | | if (params.is_strict) { | 350 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 351 | | decimal_to_string(from.value(), scale_from), | 352 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 353 | | precision_to, scale_to); | 354 | | } | 355 | | return false; | 356 | | } else { | 357 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 358 | | if (params.is_strict) { | 359 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 360 | | decimal_to_string(from.value(), scale_from), | 361 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 362 | | precision_to, scale_to); | 363 | | } | 364 | | return false; | 365 | | } else { | 366 | | to = ToCppT(res); | 367 | | } | 368 | | } | 369 | 224 | } else { | 370 | 224 | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 371 | 224 | res)) { | 372 | 20 | if (params.is_strict) { | 373 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 374 | 0 | decimal_to_string(from.value, scale_from), | 375 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 376 | 0 | precision_to, scale_to); | 377 | 0 | } | 378 | 20 | return false; | 379 | 204 | } else { | 380 | 204 | if (UNLIKELY(res > max_result || res < -max_result)) { | 381 | 100 | if (params.is_strict) { | 382 | 60 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 383 | 60 | decimal_to_string(from.value, scale_from), | 384 | 60 | fmt::format("decimal({}, {})", precision_from, scale_from), | 385 | 60 | precision_to, scale_to); | 386 | 60 | } | 387 | 100 | return false; | 388 | 104 | } else { | 389 | 104 | to = ToCppT(res); | 390 | 104 | } | 391 | 204 | } | 392 | 224 | } | 393 | | } else { | 394 | | if constexpr (IsDecimal128V2<FromCppT>) { | 395 | | res = from.value() * scale_multiplier; | 396 | | } else { | 397 | | res = from.value * scale_multiplier; | 398 | | } | 399 | | if constexpr (narrow_integral) { | 400 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 401 | | if constexpr (IsDecimal128V2<FromCppT>) { | 402 | | if (params.is_strict) { | 403 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 404 | | decimal_to_string(from.value(), scale_from), | 405 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 406 | | precision_to, scale_to); | 407 | | } | 408 | | } else { | 409 | | if (params.is_strict) { | 410 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 411 | | decimal_to_string(from.value, scale_from), | 412 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 413 | | precision_to, scale_to); | 414 | | } | 415 | | } | 416 | | return false; | 417 | | } | 418 | | } | 419 | | to = ToCppT(res); | 420 | | } | 421 | 104 | return true; | 422 | 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 | 343 | 224 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 344 | 224 | MaxNativeType res; | 345 | 224 | if constexpr (multiply_may_overflow) { | 346 | | if constexpr (IsDecimal128V2<FromCppT>) { | 347 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 348 | | res)) { | 349 | | if (params.is_strict) { | 350 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 351 | | decimal_to_string(from.value(), scale_from), | 352 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 353 | | precision_to, scale_to); | 354 | | } | 355 | | return false; | 356 | | } else { | 357 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 358 | | if (params.is_strict) { | 359 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 360 | | decimal_to_string(from.value(), scale_from), | 361 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 362 | | precision_to, scale_to); | 363 | | } | 364 | | return false; | 365 | | } else { | 366 | | to = ToCppT(res); | 367 | | } | 368 | | } | 369 | 224 | } else { | 370 | 224 | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 371 | 224 | res)) { | 372 | 20 | if (params.is_strict) { | 373 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 374 | 0 | decimal_to_string(from.value, scale_from), | 375 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 376 | 0 | precision_to, scale_to); | 377 | 0 | } | 378 | 20 | return false; | 379 | 204 | } else { | 380 | 204 | if (UNLIKELY(res > max_result || res < -max_result)) { | 381 | 100 | if (params.is_strict) { | 382 | 60 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 383 | 60 | decimal_to_string(from.value, scale_from), | 384 | 60 | fmt::format("decimal({}, {})", precision_from, scale_from), | 385 | 60 | precision_to, scale_to); | 386 | 60 | } | 387 | 100 | return false; | 388 | 104 | } else { | 389 | 104 | to = ToCppT(res); | 390 | 104 | } | 391 | 204 | } | 392 | 224 | } | 393 | | } else { | 394 | | if constexpr (IsDecimal128V2<FromCppT>) { | 395 | | res = from.value() * scale_multiplier; | 396 | | } else { | 397 | | res = from.value * scale_multiplier; | 398 | | } | 399 | | if constexpr (narrow_integral) { | 400 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 401 | | if constexpr (IsDecimal128V2<FromCppT>) { | 402 | | if (params.is_strict) { | 403 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 404 | | decimal_to_string(from.value(), scale_from), | 405 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 406 | | precision_to, scale_to); | 407 | | } | 408 | | } else { | 409 | | if (params.is_strict) { | 410 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 411 | | decimal_to_string(from.value, scale_from), | 412 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 413 | | precision_to, scale_to); | 414 | | } | 415 | | } | 416 | | return false; | 417 | | } | 418 | | } | 419 | | to = ToCppT(res); | 420 | | } | 421 | 104 | return true; | 422 | 224 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_7DecimalIiEENS_12Decimal128V3ELb0ELb0EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKT3_RKNS5_10NativeTypeESF_RNS_14CastParametersE Line | Count | Source | 343 | 120 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 344 | 120 | MaxNativeType res; | 345 | | if constexpr (multiply_may_overflow) { | 346 | | if constexpr (IsDecimal128V2<FromCppT>) { | 347 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 348 | | res)) { | 349 | | if (params.is_strict) { | 350 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 351 | | decimal_to_string(from.value(), scale_from), | 352 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 353 | | precision_to, scale_to); | 354 | | } | 355 | | return false; | 356 | | } else { | 357 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 358 | | if (params.is_strict) { | 359 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 360 | | decimal_to_string(from.value(), scale_from), | 361 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 362 | | precision_to, scale_to); | 363 | | } | 364 | | return false; | 365 | | } else { | 366 | | to = ToCppT(res); | 367 | | } | 368 | | } | 369 | | } else { | 370 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 371 | | res)) { | 372 | | if (params.is_strict) { | 373 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 374 | | decimal_to_string(from.value, scale_from), | 375 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 376 | | precision_to, scale_to); | 377 | | } | 378 | | return false; | 379 | | } else { | 380 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 381 | | if (params.is_strict) { | 382 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 383 | | decimal_to_string(from.value, scale_from), | 384 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 385 | | precision_to, scale_to); | 386 | | } | 387 | | return false; | 388 | | } else { | 389 | | to = ToCppT(res); | 390 | | } | 391 | | } | 392 | | } | 393 | 120 | } else { | 394 | | if constexpr (IsDecimal128V2<FromCppT>) { | 395 | | res = from.value() * scale_multiplier; | 396 | 120 | } else { | 397 | 120 | res = from.value * scale_multiplier; | 398 | 120 | } | 399 | | if constexpr (narrow_integral) { | 400 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 401 | | if constexpr (IsDecimal128V2<FromCppT>) { | 402 | | if (params.is_strict) { | 403 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 404 | | decimal_to_string(from.value(), scale_from), | 405 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 406 | | precision_to, scale_to); | 407 | | } | 408 | | } else { | 409 | | if (params.is_strict) { | 410 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 411 | | decimal_to_string(from.value, scale_from), | 412 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 413 | | precision_to, scale_to); | 414 | | } | 415 | | } | 416 | | return false; | 417 | | } | 418 | | } | 419 | 120 | to = ToCppT(res); | 420 | 120 | } | 421 | 120 | return true; | 422 | 120 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_7DecimalIiEENS_12Decimal128V3ELb0ELb1EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKT3_RKNS5_10NativeTypeESF_RNS_14CastParametersE Line | Count | Source | 343 | 65 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 344 | 65 | MaxNativeType res; | 345 | | if constexpr (multiply_may_overflow) { | 346 | | if constexpr (IsDecimal128V2<FromCppT>) { | 347 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 348 | | res)) { | 349 | | if (params.is_strict) { | 350 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 351 | | decimal_to_string(from.value(), scale_from), | 352 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 353 | | precision_to, scale_to); | 354 | | } | 355 | | return false; | 356 | | } else { | 357 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 358 | | if (params.is_strict) { | 359 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 360 | | decimal_to_string(from.value(), scale_from), | 361 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 362 | | precision_to, scale_to); | 363 | | } | 364 | | return false; | 365 | | } else { | 366 | | to = ToCppT(res); | 367 | | } | 368 | | } | 369 | | } else { | 370 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 371 | | res)) { | 372 | | if (params.is_strict) { | 373 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 374 | | decimal_to_string(from.value, scale_from), | 375 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 376 | | precision_to, scale_to); | 377 | | } | 378 | | return false; | 379 | | } else { | 380 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 381 | | if (params.is_strict) { | 382 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 383 | | decimal_to_string(from.value, scale_from), | 384 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 385 | | precision_to, scale_to); | 386 | | } | 387 | | return false; | 388 | | } else { | 389 | | to = ToCppT(res); | 390 | | } | 391 | | } | 392 | | } | 393 | 65 | } else { | 394 | | if constexpr (IsDecimal128V2<FromCppT>) { | 395 | | res = from.value() * scale_multiplier; | 396 | 65 | } else { | 397 | 65 | res = from.value * scale_multiplier; | 398 | 65 | } | 399 | 65 | if constexpr (narrow_integral) { | 400 | 65 | if (UNLIKELY(res > max_result || res < -max_result)) { | 401 | | if constexpr (IsDecimal128V2<FromCppT>) { | 402 | | if (params.is_strict) { | 403 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 404 | | decimal_to_string(from.value(), scale_from), | 405 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 406 | | precision_to, scale_to); | 407 | | } | 408 | 36 | } else { | 409 | 36 | if (params.is_strict) { | 410 | 18 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 411 | 18 | decimal_to_string(from.value, scale_from), | 412 | 18 | fmt::format("decimal({}, {})", precision_from, scale_from), | 413 | 18 | precision_to, scale_to); | 414 | 18 | } | 415 | 36 | } | 416 | 36 | return false; | 417 | 36 | } | 418 | 65 | } | 419 | 29 | to = ToCppT(res); | 420 | 65 | } | 421 | 0 | return true; | 422 | 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 | 343 | 65 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 344 | 65 | MaxNativeType res; | 345 | 65 | if constexpr (multiply_may_overflow) { | 346 | | if constexpr (IsDecimal128V2<FromCppT>) { | 347 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 348 | | res)) { | 349 | | if (params.is_strict) { | 350 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 351 | | decimal_to_string(from.value(), scale_from), | 352 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 353 | | precision_to, scale_to); | 354 | | } | 355 | | return false; | 356 | | } else { | 357 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 358 | | if (params.is_strict) { | 359 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 360 | | decimal_to_string(from.value(), scale_from), | 361 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 362 | | precision_to, scale_to); | 363 | | } | 364 | | return false; | 365 | | } else { | 366 | | to = ToCppT(res); | 367 | | } | 368 | | } | 369 | 65 | } else { | 370 | 65 | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 371 | 65 | res)) { | 372 | 20 | if (params.is_strict) { | 373 | 6 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 374 | 6 | decimal_to_string(from.value, scale_from), | 375 | 6 | fmt::format("decimal({}, {})", precision_from, scale_from), | 376 | 6 | precision_to, scale_to); | 377 | 6 | } | 378 | 20 | return false; | 379 | 45 | } else { | 380 | 45 | if (UNLIKELY(res > max_result || res < -max_result)) { | 381 | 16 | if (params.is_strict) { | 382 | 12 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 383 | 12 | decimal_to_string(from.value, scale_from), | 384 | 12 | fmt::format("decimal({}, {})", precision_from, scale_from), | 385 | 12 | precision_to, scale_to); | 386 | 12 | } | 387 | 16 | return false; | 388 | 29 | } else { | 389 | 29 | to = ToCppT(res); | 390 | 29 | } | 391 | 45 | } | 392 | 65 | } | 393 | | } else { | 394 | | if constexpr (IsDecimal128V2<FromCppT>) { | 395 | | res = from.value() * scale_multiplier; | 396 | | } else { | 397 | | res = from.value * scale_multiplier; | 398 | | } | 399 | | if constexpr (narrow_integral) { | 400 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 401 | | if constexpr (IsDecimal128V2<FromCppT>) { | 402 | | if (params.is_strict) { | 403 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 404 | | decimal_to_string(from.value(), scale_from), | 405 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 406 | | precision_to, scale_to); | 407 | | } | 408 | | } else { | 409 | | if (params.is_strict) { | 410 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 411 | | decimal_to_string(from.value, scale_from), | 412 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 413 | | precision_to, scale_to); | 414 | | } | 415 | | } | 416 | | return false; | 417 | | } | 418 | | } | 419 | | to = ToCppT(res); | 420 | | } | 421 | 29 | return true; | 422 | 65 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_7DecimalIlEENS_12Decimal128V3ELb0ELb0EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKT3_RKNS5_10NativeTypeESF_RNS_14CastParametersE Line | Count | Source | 343 | 176 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 344 | 176 | MaxNativeType res; | 345 | | if constexpr (multiply_may_overflow) { | 346 | | if constexpr (IsDecimal128V2<FromCppT>) { | 347 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 348 | | res)) { | 349 | | if (params.is_strict) { | 350 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 351 | | decimal_to_string(from.value(), scale_from), | 352 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 353 | | precision_to, scale_to); | 354 | | } | 355 | | return false; | 356 | | } else { | 357 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 358 | | if (params.is_strict) { | 359 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 360 | | decimal_to_string(from.value(), scale_from), | 361 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 362 | | precision_to, scale_to); | 363 | | } | 364 | | return false; | 365 | | } else { | 366 | | to = ToCppT(res); | 367 | | } | 368 | | } | 369 | | } else { | 370 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 371 | | res)) { | 372 | | if (params.is_strict) { | 373 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 374 | | decimal_to_string(from.value, scale_from), | 375 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 376 | | precision_to, scale_to); | 377 | | } | 378 | | return false; | 379 | | } else { | 380 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 381 | | if (params.is_strict) { | 382 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 383 | | decimal_to_string(from.value, scale_from), | 384 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 385 | | precision_to, scale_to); | 386 | | } | 387 | | return false; | 388 | | } else { | 389 | | to = ToCppT(res); | 390 | | } | 391 | | } | 392 | | } | 393 | 176 | } else { | 394 | | if constexpr (IsDecimal128V2<FromCppT>) { | 395 | | res = from.value() * scale_multiplier; | 396 | 176 | } else { | 397 | 176 | res = from.value * scale_multiplier; | 398 | 176 | } | 399 | | if constexpr (narrow_integral) { | 400 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 401 | | if constexpr (IsDecimal128V2<FromCppT>) { | 402 | | if (params.is_strict) { | 403 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 404 | | decimal_to_string(from.value(), scale_from), | 405 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 406 | | precision_to, scale_to); | 407 | | } | 408 | | } else { | 409 | | if (params.is_strict) { | 410 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 411 | | decimal_to_string(from.value, scale_from), | 412 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 413 | | precision_to, scale_to); | 414 | | } | 415 | | } | 416 | | return false; | 417 | | } | 418 | | } | 419 | 176 | to = ToCppT(res); | 420 | 176 | } | 421 | 176 | return true; | 422 | 176 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_7DecimalIlEENS_12Decimal128V3ELb0ELb1EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKT3_RKNS5_10NativeTypeESF_RNS_14CastParametersE Line | Count | Source | 343 | 116 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 344 | 116 | MaxNativeType res; | 345 | | if constexpr (multiply_may_overflow) { | 346 | | if constexpr (IsDecimal128V2<FromCppT>) { | 347 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 348 | | res)) { | 349 | | if (params.is_strict) { | 350 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 351 | | decimal_to_string(from.value(), scale_from), | 352 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 353 | | precision_to, scale_to); | 354 | | } | 355 | | return false; | 356 | | } else { | 357 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 358 | | if (params.is_strict) { | 359 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 360 | | decimal_to_string(from.value(), scale_from), | 361 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 362 | | precision_to, scale_to); | 363 | | } | 364 | | return false; | 365 | | } else { | 366 | | to = ToCppT(res); | 367 | | } | 368 | | } | 369 | | } else { | 370 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 371 | | res)) { | 372 | | if (params.is_strict) { | 373 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 374 | | decimal_to_string(from.value, scale_from), | 375 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 376 | | precision_to, scale_to); | 377 | | } | 378 | | return false; | 379 | | } else { | 380 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 381 | | if (params.is_strict) { | 382 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 383 | | decimal_to_string(from.value, scale_from), | 384 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 385 | | precision_to, scale_to); | 386 | | } | 387 | | return false; | 388 | | } else { | 389 | | to = ToCppT(res); | 390 | | } | 391 | | } | 392 | | } | 393 | 116 | } else { | 394 | | if constexpr (IsDecimal128V2<FromCppT>) { | 395 | | res = from.value() * scale_multiplier; | 396 | 116 | } else { | 397 | 116 | res = from.value * scale_multiplier; | 398 | 116 | } | 399 | 116 | if constexpr (narrow_integral) { | 400 | 116 | if (UNLIKELY(res > max_result || res < -max_result)) { | 401 | | if constexpr (IsDecimal128V2<FromCppT>) { | 402 | | if (params.is_strict) { | 403 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 404 | | decimal_to_string(from.value(), scale_from), | 405 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 406 | | precision_to, scale_to); | 407 | | } | 408 | 60 | } else { | 409 | 60 | if (params.is_strict) { | 410 | 30 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 411 | 30 | decimal_to_string(from.value, scale_from), | 412 | 30 | fmt::format("decimal({}, {})", precision_from, scale_from), | 413 | 30 | precision_to, scale_to); | 414 | 30 | } | 415 | 60 | } | 416 | 60 | return false; | 417 | 60 | } | 418 | 116 | } | 419 | 56 | to = ToCppT(res); | 420 | 116 | } | 421 | 0 | return true; | 422 | 116 | } |
Unexecuted instantiation: _ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_7DecimalIlEENS_12Decimal128V3ELb1ELb0EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKT3_RKNS5_10NativeTypeESF_RNS_14CastParametersE _ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_7DecimalIlEENS_12Decimal128V3ELb1ELb1EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKT3_RKNS5_10NativeTypeESF_RNS_14CastParametersE Line | Count | Source | 343 | 116 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 344 | 116 | MaxNativeType res; | 345 | 116 | if constexpr (multiply_may_overflow) { | 346 | | if constexpr (IsDecimal128V2<FromCppT>) { | 347 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 348 | | res)) { | 349 | | if (params.is_strict) { | 350 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 351 | | decimal_to_string(from.value(), scale_from), | 352 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 353 | | precision_to, scale_to); | 354 | | } | 355 | | return false; | 356 | | } else { | 357 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 358 | | if (params.is_strict) { | 359 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 360 | | decimal_to_string(from.value(), scale_from), | 361 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 362 | | precision_to, scale_to); | 363 | | } | 364 | | return false; | 365 | | } else { | 366 | | to = ToCppT(res); | 367 | | } | 368 | | } | 369 | 116 | } else { | 370 | 116 | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 371 | 116 | res)) { | 372 | 36 | if (params.is_strict) { | 373 | 12 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 374 | 12 | decimal_to_string(from.value, scale_from), | 375 | 12 | fmt::format("decimal({}, {})", precision_from, scale_from), | 376 | 12 | precision_to, scale_to); | 377 | 12 | } | 378 | 36 | return false; | 379 | 80 | } else { | 380 | 80 | if (UNLIKELY(res > max_result || res < -max_result)) { | 381 | 24 | if (params.is_strict) { | 382 | 18 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 383 | 18 | decimal_to_string(from.value, scale_from), | 384 | 18 | fmt::format("decimal({}, {})", precision_from, scale_from), | 385 | 18 | precision_to, scale_to); | 386 | 18 | } | 387 | 24 | return false; | 388 | 56 | } else { | 389 | 56 | to = ToCppT(res); | 390 | 56 | } | 391 | 80 | } | 392 | 116 | } | 393 | | } else { | 394 | | if constexpr (IsDecimal128V2<FromCppT>) { | 395 | | res = from.value() * scale_multiplier; | 396 | | } else { | 397 | | res = from.value * scale_multiplier; | 398 | | } | 399 | | if constexpr (narrow_integral) { | 400 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 401 | | if constexpr (IsDecimal128V2<FromCppT>) { | 402 | | if (params.is_strict) { | 403 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 404 | | decimal_to_string(from.value(), scale_from), | 405 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 406 | | precision_to, scale_to); | 407 | | } | 408 | | } else { | 409 | | if (params.is_strict) { | 410 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 411 | | decimal_to_string(from.value, scale_from), | 412 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 413 | | precision_to, scale_to); | 414 | | } | 415 | | } | 416 | | return false; | 417 | | } | 418 | | } | 419 | | to = ToCppT(res); | 420 | | } | 421 | 56 | return true; | 422 | 116 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_12Decimal128V3ES2_Lb0ELb0EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS4_jjRS3_jjRKT3_RKNS3_10NativeTypeESD_RNS_14CastParametersE Line | Count | Source | 343 | 46 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 344 | 46 | MaxNativeType res; | 345 | | if constexpr (multiply_may_overflow) { | 346 | | if constexpr (IsDecimal128V2<FromCppT>) { | 347 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 348 | | res)) { | 349 | | if (params.is_strict) { | 350 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 351 | | decimal_to_string(from.value(), scale_from), | 352 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 353 | | precision_to, scale_to); | 354 | | } | 355 | | return false; | 356 | | } else { | 357 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 358 | | if (params.is_strict) { | 359 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 360 | | decimal_to_string(from.value(), scale_from), | 361 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 362 | | precision_to, scale_to); | 363 | | } | 364 | | return false; | 365 | | } else { | 366 | | to = ToCppT(res); | 367 | | } | 368 | | } | 369 | | } else { | 370 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 371 | | res)) { | 372 | | if (params.is_strict) { | 373 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 374 | | decimal_to_string(from.value, scale_from), | 375 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 376 | | precision_to, scale_to); | 377 | | } | 378 | | return false; | 379 | | } else { | 380 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 381 | | if (params.is_strict) { | 382 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 383 | | decimal_to_string(from.value, scale_from), | 384 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 385 | | precision_to, scale_to); | 386 | | } | 387 | | return false; | 388 | | } else { | 389 | | to = ToCppT(res); | 390 | | } | 391 | | } | 392 | | } | 393 | 46 | } else { | 394 | | if constexpr (IsDecimal128V2<FromCppT>) { | 395 | | res = from.value() * scale_multiplier; | 396 | 46 | } else { | 397 | 46 | res = from.value * scale_multiplier; | 398 | 46 | } | 399 | | if constexpr (narrow_integral) { | 400 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 401 | | if constexpr (IsDecimal128V2<FromCppT>) { | 402 | | if (params.is_strict) { | 403 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 404 | | decimal_to_string(from.value(), scale_from), | 405 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 406 | | precision_to, scale_to); | 407 | | } | 408 | | } else { | 409 | | if (params.is_strict) { | 410 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 411 | | decimal_to_string(from.value, scale_from), | 412 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 413 | | precision_to, scale_to); | 414 | | } | 415 | | } | 416 | | return false; | 417 | | } | 418 | | } | 419 | 46 | to = ToCppT(res); | 420 | 46 | } | 421 | 46 | return true; | 422 | 46 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_12Decimal128V3ES2_Lb0ELb1EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS4_jjRS3_jjRKT3_RKNS3_10NativeTypeESD_RNS_14CastParametersE Line | Count | Source | 343 | 70 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 344 | 70 | MaxNativeType res; | 345 | | if constexpr (multiply_may_overflow) { | 346 | | if constexpr (IsDecimal128V2<FromCppT>) { | 347 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 348 | | res)) { | 349 | | if (params.is_strict) { | 350 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 351 | | decimal_to_string(from.value(), scale_from), | 352 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 353 | | precision_to, scale_to); | 354 | | } | 355 | | return false; | 356 | | } else { | 357 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 358 | | if (params.is_strict) { | 359 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 360 | | decimal_to_string(from.value(), scale_from), | 361 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 362 | | precision_to, scale_to); | 363 | | } | 364 | | return false; | 365 | | } else { | 366 | | to = ToCppT(res); | 367 | | } | 368 | | } | 369 | | } else { | 370 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 371 | | res)) { | 372 | | if (params.is_strict) { | 373 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 374 | | decimal_to_string(from.value, scale_from), | 375 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 376 | | precision_to, scale_to); | 377 | | } | 378 | | return false; | 379 | | } else { | 380 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 381 | | if (params.is_strict) { | 382 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 383 | | decimal_to_string(from.value, scale_from), | 384 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 385 | | precision_to, scale_to); | 386 | | } | 387 | | return false; | 388 | | } else { | 389 | | to = ToCppT(res); | 390 | | } | 391 | | } | 392 | | } | 393 | 70 | } else { | 394 | | if constexpr (IsDecimal128V2<FromCppT>) { | 395 | | res = from.value() * scale_multiplier; | 396 | 70 | } else { | 397 | 70 | res = from.value * scale_multiplier; | 398 | 70 | } | 399 | 70 | if constexpr (narrow_integral) { | 400 | 70 | if (UNLIKELY(res > max_result || res < -max_result)) { | 401 | | if constexpr (IsDecimal128V2<FromCppT>) { | 402 | | if (params.is_strict) { | 403 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 404 | | decimal_to_string(from.value(), scale_from), | 405 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 406 | | precision_to, scale_to); | 407 | | } | 408 | 36 | } else { | 409 | 36 | if (params.is_strict) { | 410 | 18 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 411 | 18 | decimal_to_string(from.value, scale_from), | 412 | 18 | fmt::format("decimal({}, {})", precision_from, scale_from), | 413 | 18 | precision_to, scale_to); | 414 | 18 | } | 415 | 36 | } | 416 | 36 | return false; | 417 | 36 | } | 418 | 70 | } | 419 | 34 | to = ToCppT(res); | 420 | 70 | } | 421 | 0 | return true; | 422 | 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 | 343 | 184 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 344 | 184 | MaxNativeType res; | 345 | 184 | if constexpr (multiply_may_overflow) { | 346 | | if constexpr (IsDecimal128V2<FromCppT>) { | 347 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 348 | | res)) { | 349 | | if (params.is_strict) { | 350 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 351 | | decimal_to_string(from.value(), scale_from), | 352 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 353 | | precision_to, scale_to); | 354 | | } | 355 | | return false; | 356 | | } else { | 357 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 358 | | if (params.is_strict) { | 359 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 360 | | decimal_to_string(from.value(), scale_from), | 361 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 362 | | precision_to, scale_to); | 363 | | } | 364 | | return false; | 365 | | } else { | 366 | | to = ToCppT(res); | 367 | | } | 368 | | } | 369 | 184 | } else { | 370 | 184 | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 371 | 184 | res)) { | 372 | 48 | if (params.is_strict) { | 373 | 12 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 374 | 12 | decimal_to_string(from.value, scale_from), | 375 | 12 | fmt::format("decimal({}, {})", precision_from, scale_from), | 376 | 12 | precision_to, scale_to); | 377 | 12 | } | 378 | 48 | return false; | 379 | 136 | } else { | 380 | 136 | if (UNLIKELY(res > max_result || res < -max_result)) { | 381 | 48 | if (params.is_strict) { | 382 | 36 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 383 | 36 | decimal_to_string(from.value, scale_from), | 384 | 36 | fmt::format("decimal({}, {})", precision_from, scale_from), | 385 | 36 | precision_to, scale_to); | 386 | 36 | } | 387 | 48 | return false; | 388 | 88 | } else { | 389 | 88 | to = ToCppT(res); | 390 | 88 | } | 391 | 136 | } | 392 | 184 | } | 393 | | } else { | 394 | | if constexpr (IsDecimal128V2<FromCppT>) { | 395 | | res = from.value() * scale_multiplier; | 396 | | } else { | 397 | | res = from.value * scale_multiplier; | 398 | | } | 399 | | if constexpr (narrow_integral) { | 400 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 401 | | if constexpr (IsDecimal128V2<FromCppT>) { | 402 | | if (params.is_strict) { | 403 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 404 | | decimal_to_string(from.value(), scale_from), | 405 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 406 | | precision_to, scale_to); | 407 | | } | 408 | | } else { | 409 | | if (params.is_strict) { | 410 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 411 | | decimal_to_string(from.value, scale_from), | 412 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 413 | | precision_to, scale_to); | 414 | | } | 415 | | } | 416 | | return false; | 417 | | } | 418 | | } | 419 | | to = ToCppT(res); | 420 | | } | 421 | 88 | return true; | 422 | 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 | 343 | 224 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 344 | 224 | MaxNativeType res; | 345 | 224 | if constexpr (multiply_may_overflow) { | 346 | | if constexpr (IsDecimal128V2<FromCppT>) { | 347 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 348 | | res)) { | 349 | | if (params.is_strict) { | 350 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 351 | | decimal_to_string(from.value(), scale_from), | 352 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 353 | | precision_to, scale_to); | 354 | | } | 355 | | return false; | 356 | | } else { | 357 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 358 | | if (params.is_strict) { | 359 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 360 | | decimal_to_string(from.value(), scale_from), | 361 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 362 | | precision_to, scale_to); | 363 | | } | 364 | | return false; | 365 | | } else { | 366 | | to = ToCppT(res); | 367 | | } | 368 | | } | 369 | 224 | } else { | 370 | 224 | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 371 | 224 | res)) { | 372 | 22 | if (params.is_strict) { | 373 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 374 | 0 | decimal_to_string(from.value, scale_from), | 375 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 376 | 0 | precision_to, scale_to); | 377 | 0 | } | 378 | 22 | return false; | 379 | 202 | } else { | 380 | 202 | if (UNLIKELY(res > max_result || res < -max_result)) { | 381 | 98 | if (params.is_strict) { | 382 | 60 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 383 | 60 | decimal_to_string(from.value, scale_from), | 384 | 60 | fmt::format("decimal({}, {})", precision_from, scale_from), | 385 | 60 | precision_to, scale_to); | 386 | 60 | } | 387 | 98 | return false; | 388 | 104 | } else { | 389 | 104 | to = ToCppT(res); | 390 | 104 | } | 391 | 202 | } | 392 | 224 | } | 393 | | } else { | 394 | | if constexpr (IsDecimal128V2<FromCppT>) { | 395 | | res = from.value() * scale_multiplier; | 396 | | } else { | 397 | | res = from.value * scale_multiplier; | 398 | | } | 399 | | if constexpr (narrow_integral) { | 400 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 401 | | if constexpr (IsDecimal128V2<FromCppT>) { | 402 | | if (params.is_strict) { | 403 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 404 | | decimal_to_string(from.value(), scale_from), | 405 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 406 | | precision_to, scale_to); | 407 | | } | 408 | | } else { | 409 | | if (params.is_strict) { | 410 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 411 | | decimal_to_string(from.value, scale_from), | 412 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 413 | | precision_to, scale_to); | 414 | | } | 415 | | } | 416 | | return false; | 417 | | } | 418 | | } | 419 | | to = ToCppT(res); | 420 | | } | 421 | 104 | return true; | 422 | 224 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_7DecimalIiEENS2_IN4wide7integerILm256EiEEEELb0ELb0ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKT3_RKNS8_10NativeTypeESI_RNS_14CastParametersE Line | Count | Source | 343 | 120 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 344 | 120 | MaxNativeType res; | 345 | | if constexpr (multiply_may_overflow) { | 346 | | if constexpr (IsDecimal128V2<FromCppT>) { | 347 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 348 | | res)) { | 349 | | if (params.is_strict) { | 350 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 351 | | decimal_to_string(from.value(), scale_from), | 352 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 353 | | precision_to, scale_to); | 354 | | } | 355 | | return false; | 356 | | } else { | 357 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 358 | | if (params.is_strict) { | 359 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 360 | | decimal_to_string(from.value(), scale_from), | 361 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 362 | | precision_to, scale_to); | 363 | | } | 364 | | return false; | 365 | | } else { | 366 | | to = ToCppT(res); | 367 | | } | 368 | | } | 369 | | } else { | 370 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 371 | | res)) { | 372 | | if (params.is_strict) { | 373 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 374 | | decimal_to_string(from.value, scale_from), | 375 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 376 | | precision_to, scale_to); | 377 | | } | 378 | | return false; | 379 | | } else { | 380 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 381 | | if (params.is_strict) { | 382 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 383 | | decimal_to_string(from.value, scale_from), | 384 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 385 | | precision_to, scale_to); | 386 | | } | 387 | | return false; | 388 | | } else { | 389 | | to = ToCppT(res); | 390 | | } | 391 | | } | 392 | | } | 393 | 120 | } else { | 394 | | if constexpr (IsDecimal128V2<FromCppT>) { | 395 | | res = from.value() * scale_multiplier; | 396 | 120 | } else { | 397 | 120 | res = from.value * scale_multiplier; | 398 | 120 | } | 399 | | if constexpr (narrow_integral) { | 400 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 401 | | if constexpr (IsDecimal128V2<FromCppT>) { | 402 | | if (params.is_strict) { | 403 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 404 | | decimal_to_string(from.value(), scale_from), | 405 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 406 | | precision_to, scale_to); | 407 | | } | 408 | | } else { | 409 | | if (params.is_strict) { | 410 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 411 | | decimal_to_string(from.value, scale_from), | 412 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 413 | | precision_to, scale_to); | 414 | | } | 415 | | } | 416 | | return false; | 417 | | } | 418 | | } | 419 | 120 | to = ToCppT(res); | 420 | 120 | } | 421 | 120 | return true; | 422 | 120 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_7DecimalIiEENS2_IN4wide7integerILm256EiEEEELb0ELb1ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKT3_RKNS8_10NativeTypeESI_RNS_14CastParametersE Line | Count | Source | 343 | 65 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 344 | 65 | MaxNativeType res; | 345 | | if constexpr (multiply_may_overflow) { | 346 | | if constexpr (IsDecimal128V2<FromCppT>) { | 347 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 348 | | res)) { | 349 | | if (params.is_strict) { | 350 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 351 | | decimal_to_string(from.value(), scale_from), | 352 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 353 | | precision_to, scale_to); | 354 | | } | 355 | | return false; | 356 | | } else { | 357 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 358 | | if (params.is_strict) { | 359 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 360 | | decimal_to_string(from.value(), scale_from), | 361 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 362 | | precision_to, scale_to); | 363 | | } | 364 | | return false; | 365 | | } else { | 366 | | to = ToCppT(res); | 367 | | } | 368 | | } | 369 | | } else { | 370 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 371 | | res)) { | 372 | | if (params.is_strict) { | 373 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 374 | | decimal_to_string(from.value, scale_from), | 375 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 376 | | precision_to, scale_to); | 377 | | } | 378 | | return false; | 379 | | } else { | 380 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 381 | | if (params.is_strict) { | 382 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 383 | | decimal_to_string(from.value, scale_from), | 384 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 385 | | precision_to, scale_to); | 386 | | } | 387 | | return false; | 388 | | } else { | 389 | | to = ToCppT(res); | 390 | | } | 391 | | } | 392 | | } | 393 | 65 | } else { | 394 | | if constexpr (IsDecimal128V2<FromCppT>) { | 395 | | res = from.value() * scale_multiplier; | 396 | 65 | } else { | 397 | 65 | res = from.value * scale_multiplier; | 398 | 65 | } | 399 | 65 | if constexpr (narrow_integral) { | 400 | 65 | if (UNLIKELY(res > max_result || res < -max_result)) { | 401 | | if constexpr (IsDecimal128V2<FromCppT>) { | 402 | | if (params.is_strict) { | 403 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 404 | | decimal_to_string(from.value(), scale_from), | 405 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 406 | | precision_to, scale_to); | 407 | | } | 408 | 36 | } else { | 409 | 36 | if (params.is_strict) { | 410 | 18 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 411 | 18 | decimal_to_string(from.value, scale_from), | 412 | 18 | fmt::format("decimal({}, {})", precision_from, scale_from), | 413 | 18 | precision_to, scale_to); | 414 | 18 | } | 415 | 36 | } | 416 | 36 | return false; | 417 | 36 | } | 418 | 65 | } | 419 | 29 | to = ToCppT(res); | 420 | 65 | } | 421 | 0 | return true; | 422 | 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 | 343 | 65 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 344 | 65 | MaxNativeType res; | 345 | 65 | if constexpr (multiply_may_overflow) { | 346 | | if constexpr (IsDecimal128V2<FromCppT>) { | 347 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 348 | | res)) { | 349 | | if (params.is_strict) { | 350 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 351 | | decimal_to_string(from.value(), scale_from), | 352 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 353 | | precision_to, scale_to); | 354 | | } | 355 | | return false; | 356 | | } else { | 357 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 358 | | if (params.is_strict) { | 359 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 360 | | decimal_to_string(from.value(), scale_from), | 361 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 362 | | precision_to, scale_to); | 363 | | } | 364 | | return false; | 365 | | } else { | 366 | | to = ToCppT(res); | 367 | | } | 368 | | } | 369 | 65 | } else { | 370 | 65 | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 371 | 65 | res)) { | 372 | 12 | if (params.is_strict) { | 373 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 374 | 0 | decimal_to_string(from.value, scale_from), | 375 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 376 | 0 | precision_to, scale_to); | 377 | 0 | } | 378 | 12 | return false; | 379 | 53 | } else { | 380 | 53 | if (UNLIKELY(res > max_result || res < -max_result)) { | 381 | 24 | if (params.is_strict) { | 382 | 18 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 383 | 18 | decimal_to_string(from.value, scale_from), | 384 | 18 | fmt::format("decimal({}, {})", precision_from, scale_from), | 385 | 18 | precision_to, scale_to); | 386 | 18 | } | 387 | 24 | return false; | 388 | 29 | } else { | 389 | 29 | to = ToCppT(res); | 390 | 29 | } | 391 | 53 | } | 392 | 65 | } | 393 | | } else { | 394 | | if constexpr (IsDecimal128V2<FromCppT>) { | 395 | | res = from.value() * scale_multiplier; | 396 | | } else { | 397 | | res = from.value * scale_multiplier; | 398 | | } | 399 | | if constexpr (narrow_integral) { | 400 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 401 | | if constexpr (IsDecimal128V2<FromCppT>) { | 402 | | if (params.is_strict) { | 403 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 404 | | decimal_to_string(from.value(), scale_from), | 405 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 406 | | precision_to, scale_to); | 407 | | } | 408 | | } else { | 409 | | if (params.is_strict) { | 410 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 411 | | decimal_to_string(from.value, scale_from), | 412 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 413 | | precision_to, scale_to); | 414 | | } | 415 | | } | 416 | | return false; | 417 | | } | 418 | | } | 419 | | to = ToCppT(res); | 420 | | } | 421 | 29 | return true; | 422 | 65 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_7DecimalIlEENS2_IN4wide7integerILm256EiEEEELb0ELb0ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKT3_RKNS8_10NativeTypeESI_RNS_14CastParametersE Line | Count | Source | 343 | 184 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 344 | 184 | MaxNativeType res; | 345 | | if constexpr (multiply_may_overflow) { | 346 | | if constexpr (IsDecimal128V2<FromCppT>) { | 347 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 348 | | res)) { | 349 | | if (params.is_strict) { | 350 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 351 | | decimal_to_string(from.value(), scale_from), | 352 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 353 | | precision_to, scale_to); | 354 | | } | 355 | | return false; | 356 | | } else { | 357 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 358 | | if (params.is_strict) { | 359 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 360 | | decimal_to_string(from.value(), scale_from), | 361 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 362 | | precision_to, scale_to); | 363 | | } | 364 | | return false; | 365 | | } else { | 366 | | to = ToCppT(res); | 367 | | } | 368 | | } | 369 | | } else { | 370 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 371 | | res)) { | 372 | | if (params.is_strict) { | 373 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 374 | | decimal_to_string(from.value, scale_from), | 375 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 376 | | precision_to, scale_to); | 377 | | } | 378 | | return false; | 379 | | } else { | 380 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 381 | | if (params.is_strict) { | 382 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 383 | | decimal_to_string(from.value, scale_from), | 384 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 385 | | precision_to, scale_to); | 386 | | } | 387 | | return false; | 388 | | } else { | 389 | | to = ToCppT(res); | 390 | | } | 391 | | } | 392 | | } | 393 | 184 | } else { | 394 | | if constexpr (IsDecimal128V2<FromCppT>) { | 395 | | res = from.value() * scale_multiplier; | 396 | 184 | } else { | 397 | 184 | res = from.value * scale_multiplier; | 398 | 184 | } | 399 | | if constexpr (narrow_integral) { | 400 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 401 | | if constexpr (IsDecimal128V2<FromCppT>) { | 402 | | if (params.is_strict) { | 403 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 404 | | decimal_to_string(from.value(), scale_from), | 405 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 406 | | precision_to, scale_to); | 407 | | } | 408 | | } else { | 409 | | if (params.is_strict) { | 410 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 411 | | decimal_to_string(from.value, scale_from), | 412 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 413 | | precision_to, scale_to); | 414 | | } | 415 | | } | 416 | | return false; | 417 | | } | 418 | | } | 419 | 184 | to = ToCppT(res); | 420 | 184 | } | 421 | 184 | return true; | 422 | 184 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_7DecimalIlEENS2_IN4wide7integerILm256EiEEEELb0ELb1ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKT3_RKNS8_10NativeTypeESI_RNS_14CastParametersE Line | Count | Source | 343 | 116 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 344 | 116 | MaxNativeType res; | 345 | | if constexpr (multiply_may_overflow) { | 346 | | if constexpr (IsDecimal128V2<FromCppT>) { | 347 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 348 | | res)) { | 349 | | if (params.is_strict) { | 350 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 351 | | decimal_to_string(from.value(), scale_from), | 352 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 353 | | precision_to, scale_to); | 354 | | } | 355 | | return false; | 356 | | } else { | 357 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 358 | | if (params.is_strict) { | 359 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 360 | | decimal_to_string(from.value(), scale_from), | 361 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 362 | | precision_to, scale_to); | 363 | | } | 364 | | return false; | 365 | | } else { | 366 | | to = ToCppT(res); | 367 | | } | 368 | | } | 369 | | } else { | 370 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 371 | | res)) { | 372 | | if (params.is_strict) { | 373 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 374 | | decimal_to_string(from.value, scale_from), | 375 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 376 | | precision_to, scale_to); | 377 | | } | 378 | | return false; | 379 | | } else { | 380 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 381 | | if (params.is_strict) { | 382 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 383 | | decimal_to_string(from.value, scale_from), | 384 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 385 | | precision_to, scale_to); | 386 | | } | 387 | | return false; | 388 | | } else { | 389 | | to = ToCppT(res); | 390 | | } | 391 | | } | 392 | | } | 393 | 116 | } else { | 394 | | if constexpr (IsDecimal128V2<FromCppT>) { | 395 | | res = from.value() * scale_multiplier; | 396 | 116 | } else { | 397 | 116 | res = from.value * scale_multiplier; | 398 | 116 | } | 399 | 116 | if constexpr (narrow_integral) { | 400 | 116 | if (UNLIKELY(res > max_result || res < -max_result)) { | 401 | | if constexpr (IsDecimal128V2<FromCppT>) { | 402 | | if (params.is_strict) { | 403 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 404 | | decimal_to_string(from.value(), scale_from), | 405 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 406 | | precision_to, scale_to); | 407 | | } | 408 | 60 | } else { | 409 | 60 | if (params.is_strict) { | 410 | 30 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 411 | 30 | decimal_to_string(from.value, scale_from), | 412 | 30 | fmt::format("decimal({}, {})", precision_from, scale_from), | 413 | 30 | precision_to, scale_to); | 414 | 30 | } | 415 | 60 | } | 416 | 60 | return false; | 417 | 60 | } | 418 | 116 | } | 419 | 56 | to = ToCppT(res); | 420 | 116 | } | 421 | 0 | return true; | 422 | 116 | } |
Unexecuted instantiation: _ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_7DecimalIlEENS2_IN4wide7integerILm256EiEEEELb1ELb0ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKT3_RKNS8_10NativeTypeESI_RNS_14CastParametersE _ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_7DecimalIlEENS2_IN4wide7integerILm256EiEEEELb1ELb1ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKT3_RKNS8_10NativeTypeESI_RNS_14CastParametersE Line | Count | Source | 343 | 116 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 344 | 116 | MaxNativeType res; | 345 | 116 | if constexpr (multiply_may_overflow) { | 346 | | if constexpr (IsDecimal128V2<FromCppT>) { | 347 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 348 | | res)) { | 349 | | if (params.is_strict) { | 350 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 351 | | decimal_to_string(from.value(), scale_from), | 352 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 353 | | precision_to, scale_to); | 354 | | } | 355 | | return false; | 356 | | } else { | 357 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 358 | | if (params.is_strict) { | 359 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 360 | | decimal_to_string(from.value(), scale_from), | 361 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 362 | | precision_to, scale_to); | 363 | | } | 364 | | return false; | 365 | | } else { | 366 | | to = ToCppT(res); | 367 | | } | 368 | | } | 369 | 116 | } else { | 370 | 116 | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 371 | 116 | res)) { | 372 | 20 | if (params.is_strict) { | 373 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 374 | 0 | decimal_to_string(from.value, scale_from), | 375 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 376 | 0 | precision_to, scale_to); | 377 | 0 | } | 378 | 20 | return false; | 379 | 96 | } else { | 380 | 96 | if (UNLIKELY(res > max_result || res < -max_result)) { | 381 | 40 | if (params.is_strict) { | 382 | 30 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 383 | 30 | decimal_to_string(from.value, scale_from), | 384 | 30 | fmt::format("decimal({}, {})", precision_from, scale_from), | 385 | 30 | precision_to, scale_to); | 386 | 30 | } | 387 | 40 | return false; | 388 | 56 | } else { | 389 | 56 | to = ToCppT(res); | 390 | 56 | } | 391 | 96 | } | 392 | 116 | } | 393 | | } else { | 394 | | if constexpr (IsDecimal128V2<FromCppT>) { | 395 | | res = from.value() * scale_multiplier; | 396 | | } else { | 397 | | res = from.value * scale_multiplier; | 398 | | } | 399 | | if constexpr (narrow_integral) { | 400 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 401 | | if constexpr (IsDecimal128V2<FromCppT>) { | 402 | | if (params.is_strict) { | 403 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 404 | | decimal_to_string(from.value(), scale_from), | 405 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 406 | | precision_to, scale_to); | 407 | | } | 408 | | } else { | 409 | | if (params.is_strict) { | 410 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 411 | | decimal_to_string(from.value, scale_from), | 412 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 413 | | precision_to, scale_to); | 414 | | } | 415 | | } | 416 | | return false; | 417 | | } | 418 | | } | 419 | | to = ToCppT(res); | 420 | | } | 421 | 56 | return true; | 422 | 116 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_12Decimal128V3ENS_7DecimalIN4wide7integerILm256EiEEEELb0ELb0ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKT3_RKNS8_10NativeTypeESI_RNS_14CastParametersE Line | Count | Source | 343 | 176 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 344 | 176 | MaxNativeType res; | 345 | | if constexpr (multiply_may_overflow) { | 346 | | if constexpr (IsDecimal128V2<FromCppT>) { | 347 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 348 | | res)) { | 349 | | if (params.is_strict) { | 350 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 351 | | decimal_to_string(from.value(), scale_from), | 352 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 353 | | precision_to, scale_to); | 354 | | } | 355 | | return false; | 356 | | } else { | 357 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 358 | | if (params.is_strict) { | 359 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 360 | | decimal_to_string(from.value(), scale_from), | 361 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 362 | | precision_to, scale_to); | 363 | | } | 364 | | return false; | 365 | | } else { | 366 | | to = ToCppT(res); | 367 | | } | 368 | | } | 369 | | } else { | 370 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 371 | | res)) { | 372 | | if (params.is_strict) { | 373 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 374 | | decimal_to_string(from.value, scale_from), | 375 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 376 | | precision_to, scale_to); | 377 | | } | 378 | | return false; | 379 | | } else { | 380 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 381 | | if (params.is_strict) { | 382 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 383 | | decimal_to_string(from.value, scale_from), | 384 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 385 | | precision_to, scale_to); | 386 | | } | 387 | | return false; | 388 | | } else { | 389 | | to = ToCppT(res); | 390 | | } | 391 | | } | 392 | | } | 393 | 176 | } else { | 394 | | if constexpr (IsDecimal128V2<FromCppT>) { | 395 | | res = from.value() * scale_multiplier; | 396 | 176 | } else { | 397 | 176 | res = from.value * scale_multiplier; | 398 | 176 | } | 399 | | if constexpr (narrow_integral) { | 400 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 401 | | if constexpr (IsDecimal128V2<FromCppT>) { | 402 | | if (params.is_strict) { | 403 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 404 | | decimal_to_string(from.value(), scale_from), | 405 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 406 | | precision_to, scale_to); | 407 | | } | 408 | | } else { | 409 | | if (params.is_strict) { | 410 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 411 | | decimal_to_string(from.value, scale_from), | 412 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 413 | | precision_to, scale_to); | 414 | | } | 415 | | } | 416 | | return false; | 417 | | } | 418 | | } | 419 | 176 | to = ToCppT(res); | 420 | 176 | } | 421 | 176 | return true; | 422 | 176 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_12Decimal128V3ENS_7DecimalIN4wide7integerILm256EiEEEELb0ELb1ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKT3_RKNS8_10NativeTypeESI_RNS_14CastParametersE Line | Count | Source | 343 | 109 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 344 | 109 | MaxNativeType res; | 345 | | if constexpr (multiply_may_overflow) { | 346 | | if constexpr (IsDecimal128V2<FromCppT>) { | 347 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 348 | | res)) { | 349 | | if (params.is_strict) { | 350 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 351 | | decimal_to_string(from.value(), scale_from), | 352 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 353 | | precision_to, scale_to); | 354 | | } | 355 | | return false; | 356 | | } else { | 357 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 358 | | if (params.is_strict) { | 359 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 360 | | decimal_to_string(from.value(), scale_from), | 361 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 362 | | precision_to, scale_to); | 363 | | } | 364 | | return false; | 365 | | } else { | 366 | | to = ToCppT(res); | 367 | | } | 368 | | } | 369 | | } else { | 370 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 371 | | res)) { | 372 | | if (params.is_strict) { | 373 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 374 | | decimal_to_string(from.value, scale_from), | 375 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 376 | | precision_to, scale_to); | 377 | | } | 378 | | return false; | 379 | | } else { | 380 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 381 | | if (params.is_strict) { | 382 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 383 | | decimal_to_string(from.value, scale_from), | 384 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 385 | | precision_to, scale_to); | 386 | | } | 387 | | return false; | 388 | | } else { | 389 | | to = ToCppT(res); | 390 | | } | 391 | | } | 392 | | } | 393 | 109 | } else { | 394 | | if constexpr (IsDecimal128V2<FromCppT>) { | 395 | | res = from.value() * scale_multiplier; | 396 | 109 | } else { | 397 | 109 | res = from.value * scale_multiplier; | 398 | 109 | } | 399 | 109 | if constexpr (narrow_integral) { | 400 | 109 | if (UNLIKELY(res > max_result || res < -max_result)) { | 401 | | if constexpr (IsDecimal128V2<FromCppT>) { | 402 | | if (params.is_strict) { | 403 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 404 | | decimal_to_string(from.value(), scale_from), | 405 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 406 | | precision_to, scale_to); | 407 | | } | 408 | 54 | } else { | 409 | 54 | if (params.is_strict) { | 410 | 27 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 411 | 27 | decimal_to_string(from.value, scale_from), | 412 | 27 | fmt::format("decimal({}, {})", precision_from, scale_from), | 413 | 27 | precision_to, scale_to); | 414 | 27 | } | 415 | 54 | } | 416 | 54 | return false; | 417 | 54 | } | 418 | 109 | } | 419 | 55 | to = ToCppT(res); | 420 | 109 | } | 421 | 0 | return true; | 422 | 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 | 343 | 123 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 344 | 123 | MaxNativeType res; | 345 | 123 | if constexpr (multiply_may_overflow) { | 346 | | if constexpr (IsDecimal128V2<FromCppT>) { | 347 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 348 | | res)) { | 349 | | if (params.is_strict) { | 350 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 351 | | decimal_to_string(from.value(), scale_from), | 352 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 353 | | precision_to, scale_to); | 354 | | } | 355 | | return false; | 356 | | } else { | 357 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 358 | | if (params.is_strict) { | 359 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 360 | | decimal_to_string(from.value(), scale_from), | 361 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 362 | | precision_to, scale_to); | 363 | | } | 364 | | return false; | 365 | | } else { | 366 | | to = ToCppT(res); | 367 | | } | 368 | | } | 369 | 123 | } else { | 370 | 123 | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 371 | 123 | res)) { | 372 | 22 | if (params.is_strict) { | 373 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 374 | 0 | decimal_to_string(from.value, scale_from), | 375 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 376 | 0 | precision_to, scale_to); | 377 | 0 | } | 378 | 22 | return false; | 379 | 101 | } else { | 380 | 101 | if (UNLIKELY(res > max_result || res < -max_result)) { | 381 | 44 | if (params.is_strict) { | 382 | 33 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 383 | 33 | decimal_to_string(from.value, scale_from), | 384 | 33 | fmt::format("decimal({}, {})", precision_from, scale_from), | 385 | 33 | precision_to, scale_to); | 386 | 33 | } | 387 | 44 | return false; | 388 | 57 | } else { | 389 | 57 | to = ToCppT(res); | 390 | 57 | } | 391 | 101 | } | 392 | 123 | } | 393 | | } else { | 394 | | if constexpr (IsDecimal128V2<FromCppT>) { | 395 | | res = from.value() * scale_multiplier; | 396 | | } else { | 397 | | res = from.value * scale_multiplier; | 398 | | } | 399 | | if constexpr (narrow_integral) { | 400 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 401 | | if constexpr (IsDecimal128V2<FromCppT>) { | 402 | | if (params.is_strict) { | 403 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 404 | | decimal_to_string(from.value(), scale_from), | 405 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 406 | | precision_to, scale_to); | 407 | | } | 408 | | } else { | 409 | | if (params.is_strict) { | 410 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 411 | | decimal_to_string(from.value, scale_from), | 412 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 413 | | precision_to, scale_to); | 414 | | } | 415 | | } | 416 | | return false; | 417 | | } | 418 | | } | 419 | | to = ToCppT(res); | 420 | | } | 421 | 57 | return true; | 422 | 123 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_7DecimalIN4wide7integerILm256EiEEEES6_Lb0ELb0ES5_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS8_jjRS7_jjRKT3_RKNS7_10NativeTypeESH_RNS_14CastParametersE Line | Count | Source | 343 | 46 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 344 | 46 | MaxNativeType res; | 345 | | if constexpr (multiply_may_overflow) { | 346 | | if constexpr (IsDecimal128V2<FromCppT>) { | 347 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 348 | | res)) { | 349 | | if (params.is_strict) { | 350 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 351 | | decimal_to_string(from.value(), scale_from), | 352 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 353 | | precision_to, scale_to); | 354 | | } | 355 | | return false; | 356 | | } else { | 357 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 358 | | if (params.is_strict) { | 359 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 360 | | decimal_to_string(from.value(), scale_from), | 361 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 362 | | precision_to, scale_to); | 363 | | } | 364 | | return false; | 365 | | } else { | 366 | | to = ToCppT(res); | 367 | | } | 368 | | } | 369 | | } else { | 370 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 371 | | res)) { | 372 | | if (params.is_strict) { | 373 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 374 | | decimal_to_string(from.value, scale_from), | 375 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 376 | | precision_to, scale_to); | 377 | | } | 378 | | return false; | 379 | | } else { | 380 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 381 | | if (params.is_strict) { | 382 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 383 | | decimal_to_string(from.value, scale_from), | 384 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 385 | | precision_to, scale_to); | 386 | | } | 387 | | return false; | 388 | | } else { | 389 | | to = ToCppT(res); | 390 | | } | 391 | | } | 392 | | } | 393 | 46 | } else { | 394 | | if constexpr (IsDecimal128V2<FromCppT>) { | 395 | | res = from.value() * scale_multiplier; | 396 | 46 | } else { | 397 | 46 | res = from.value * scale_multiplier; | 398 | 46 | } | 399 | | if constexpr (narrow_integral) { | 400 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 401 | | if constexpr (IsDecimal128V2<FromCppT>) { | 402 | | if (params.is_strict) { | 403 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 404 | | decimal_to_string(from.value(), scale_from), | 405 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 406 | | precision_to, scale_to); | 407 | | } | 408 | | } else { | 409 | | if (params.is_strict) { | 410 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 411 | | decimal_to_string(from.value, scale_from), | 412 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 413 | | precision_to, scale_to); | 414 | | } | 415 | | } | 416 | | return false; | 417 | | } | 418 | | } | 419 | 46 | to = ToCppT(res); | 420 | 46 | } | 421 | 46 | return true; | 422 | 46 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_7DecimalIN4wide7integerILm256EiEEEES6_Lb0ELb1ES5_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS8_jjRS7_jjRKT3_RKNS7_10NativeTypeESH_RNS_14CastParametersE Line | Count | Source | 343 | 44 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 344 | 44 | MaxNativeType res; | 345 | | if constexpr (multiply_may_overflow) { | 346 | | if constexpr (IsDecimal128V2<FromCppT>) { | 347 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 348 | | res)) { | 349 | | if (params.is_strict) { | 350 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 351 | | decimal_to_string(from.value(), scale_from), | 352 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 353 | | precision_to, scale_to); | 354 | | } | 355 | | return false; | 356 | | } else { | 357 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 358 | | if (params.is_strict) { | 359 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 360 | | decimal_to_string(from.value(), scale_from), | 361 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 362 | | precision_to, scale_to); | 363 | | } | 364 | | return false; | 365 | | } else { | 366 | | to = ToCppT(res); | 367 | | } | 368 | | } | 369 | | } else { | 370 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 371 | | res)) { | 372 | | if (params.is_strict) { | 373 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 374 | | decimal_to_string(from.value, scale_from), | 375 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 376 | | precision_to, scale_to); | 377 | | } | 378 | | return false; | 379 | | } else { | 380 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 381 | | if (params.is_strict) { | 382 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 383 | | decimal_to_string(from.value, scale_from), | 384 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 385 | | precision_to, scale_to); | 386 | | } | 387 | | return false; | 388 | | } else { | 389 | | to = ToCppT(res); | 390 | | } | 391 | | } | 392 | | } | 393 | 44 | } else { | 394 | | if constexpr (IsDecimal128V2<FromCppT>) { | 395 | | res = from.value() * scale_multiplier; | 396 | 44 | } else { | 397 | 44 | res = from.value * scale_multiplier; | 398 | 44 | } | 399 | 44 | if constexpr (narrow_integral) { | 400 | 44 | if (UNLIKELY(res > max_result || res < -max_result)) { | 401 | | if constexpr (IsDecimal128V2<FromCppT>) { | 402 | | if (params.is_strict) { | 403 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 404 | | decimal_to_string(from.value(), scale_from), | 405 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 406 | | precision_to, scale_to); | 407 | | } | 408 | 18 | } else { | 409 | 18 | if (params.is_strict) { | 410 | 9 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 411 | 9 | decimal_to_string(from.value, scale_from), | 412 | 9 | fmt::format("decimal({}, {})", precision_from, scale_from), | 413 | 9 | precision_to, scale_to); | 414 | 9 | } | 415 | 18 | } | 416 | 18 | return false; | 417 | 18 | } | 418 | 44 | } | 419 | 26 | to = ToCppT(res); | 420 | 44 | } | 421 | 0 | return true; | 422 | 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 | 343 | 210 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 344 | 210 | MaxNativeType res; | 345 | 210 | if constexpr (multiply_may_overflow) { | 346 | | if constexpr (IsDecimal128V2<FromCppT>) { | 347 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 348 | | res)) { | 349 | | if (params.is_strict) { | 350 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 351 | | decimal_to_string(from.value(), scale_from), | 352 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 353 | | precision_to, scale_to); | 354 | | } | 355 | | return false; | 356 | | } else { | 357 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 358 | | if (params.is_strict) { | 359 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 360 | | decimal_to_string(from.value(), scale_from), | 361 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 362 | | precision_to, scale_to); | 363 | | } | 364 | | return false; | 365 | | } else { | 366 | | to = ToCppT(res); | 367 | | } | 368 | | } | 369 | 210 | } else { | 370 | 210 | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 371 | 210 | res)) { | 372 | 38 | if (params.is_strict) { | 373 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 374 | 0 | decimal_to_string(from.value, scale_from), | 375 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 376 | 0 | precision_to, scale_to); | 377 | 0 | } | 378 | 38 | return false; | 379 | 172 | } else { | 380 | 172 | if (UNLIKELY(res > max_result || res < -max_result)) { | 381 | 76 | if (params.is_strict) { | 382 | 57 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 383 | 57 | decimal_to_string(from.value, scale_from), | 384 | 57 | fmt::format("decimal({}, {})", precision_from, scale_from), | 385 | 57 | precision_to, scale_to); | 386 | 57 | } | 387 | 76 | return false; | 388 | 96 | } else { | 389 | 96 | to = ToCppT(res); | 390 | 96 | } | 391 | 172 | } | 392 | 210 | } | 393 | | } else { | 394 | | if constexpr (IsDecimal128V2<FromCppT>) { | 395 | | res = from.value() * scale_multiplier; | 396 | | } else { | 397 | | res = from.value * scale_multiplier; | 398 | | } | 399 | | if constexpr (narrow_integral) { | 400 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 401 | | if constexpr (IsDecimal128V2<FromCppT>) { | 402 | | if (params.is_strict) { | 403 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 404 | | decimal_to_string(from.value(), scale_from), | 405 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 406 | | precision_to, scale_to); | 407 | | } | 408 | | } else { | 409 | | if (params.is_strict) { | 410 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 411 | | decimal_to_string(from.value, scale_from), | 412 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 413 | | precision_to, scale_to); | 414 | | } | 415 | | } | 416 | | return false; | 417 | | } | 418 | | } | 419 | | to = ToCppT(res); | 420 | | } | 421 | 96 | return true; | 422 | 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 | 343 | 15 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 344 | 15 | MaxNativeType res; | 345 | 15 | if constexpr (multiply_may_overflow) { | 346 | 15 | if constexpr (IsDecimal128V2<FromCppT>) { | 347 | 15 | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 348 | 15 | res)) { | 349 | 0 | if (params.is_strict) { | 350 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 351 | 0 | decimal_to_string(from.value(), scale_from), | 352 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 353 | 0 | precision_to, scale_to); | 354 | 0 | } | 355 | 0 | return false; | 356 | 15 | } else { | 357 | 15 | if (UNLIKELY(res > max_result || res < -max_result)) { | 358 | 0 | if (params.is_strict) { | 359 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 360 | 0 | decimal_to_string(from.value(), scale_from), | 361 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 362 | 0 | precision_to, scale_to); | 363 | 0 | } | 364 | 0 | return false; | 365 | 15 | } else { | 366 | 15 | to = ToCppT(res); | 367 | 15 | } | 368 | 15 | } | 369 | | } else { | 370 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 371 | | res)) { | 372 | | if (params.is_strict) { | 373 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 374 | | decimal_to_string(from.value, scale_from), | 375 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 376 | | precision_to, scale_to); | 377 | | } | 378 | | return false; | 379 | | } else { | 380 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 381 | | if (params.is_strict) { | 382 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 383 | | decimal_to_string(from.value, scale_from), | 384 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 385 | | precision_to, scale_to); | 386 | | } | 387 | | return false; | 388 | | } else { | 389 | | to = ToCppT(res); | 390 | | } | 391 | | } | 392 | | } | 393 | | } else { | 394 | | if constexpr (IsDecimal128V2<FromCppT>) { | 395 | | res = from.value() * scale_multiplier; | 396 | | } else { | 397 | | res = from.value * scale_multiplier; | 398 | | } | 399 | | if constexpr (narrow_integral) { | 400 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 401 | | if constexpr (IsDecimal128V2<FromCppT>) { | 402 | | if (params.is_strict) { | 403 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 404 | | decimal_to_string(from.value(), scale_from), | 405 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 406 | | precision_to, scale_to); | 407 | | } | 408 | | } else { | 409 | | if (params.is_strict) { | 410 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 411 | | decimal_to_string(from.value, scale_from), | 412 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 413 | | precision_to, scale_to); | 414 | | } | 415 | | } | 416 | | return false; | 417 | | } | 418 | | } | 419 | | to = ToCppT(res); | 420 | | } | 421 | 15 | return true; | 422 | 15 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_14DecimalV2ValueENS_7DecimalIlEELb1ELb1EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKT3_RKNS5_10NativeTypeESF_RNS_14CastParametersE Line | Count | Source | 343 | 130 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 344 | 130 | MaxNativeType res; | 345 | 130 | if constexpr (multiply_may_overflow) { | 346 | 130 | if constexpr (IsDecimal128V2<FromCppT>) { | 347 | 130 | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 348 | 130 | res)) { | 349 | 0 | if (params.is_strict) { | 350 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 351 | 0 | decimal_to_string(from.value(), scale_from), | 352 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 353 | 0 | precision_to, scale_to); | 354 | 0 | } | 355 | 0 | return false; | 356 | 130 | } else { | 357 | 130 | if (UNLIKELY(res > max_result || res < -max_result)) { | 358 | 48 | if (params.is_strict) { | 359 | 24 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 360 | 24 | decimal_to_string(from.value(), scale_from), | 361 | 24 | fmt::format("decimal({}, {})", precision_from, scale_from), | 362 | 24 | precision_to, scale_to); | 363 | 24 | } | 364 | 48 | return false; | 365 | 82 | } else { | 366 | 82 | to = ToCppT(res); | 367 | 82 | } | 368 | 130 | } | 369 | | } else { | 370 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 371 | | res)) { | 372 | | if (params.is_strict) { | 373 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 374 | | decimal_to_string(from.value, scale_from), | 375 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 376 | | precision_to, scale_to); | 377 | | } | 378 | | return false; | 379 | | } else { | 380 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 381 | | if (params.is_strict) { | 382 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 383 | | decimal_to_string(from.value, scale_from), | 384 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 385 | | precision_to, scale_to); | 386 | | } | 387 | | return false; | 388 | | } else { | 389 | | to = ToCppT(res); | 390 | | } | 391 | | } | 392 | | } | 393 | | } else { | 394 | | if constexpr (IsDecimal128V2<FromCppT>) { | 395 | | res = from.value() * scale_multiplier; | 396 | | } else { | 397 | | res = from.value * scale_multiplier; | 398 | | } | 399 | | if constexpr (narrow_integral) { | 400 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 401 | | if constexpr (IsDecimal128V2<FromCppT>) { | 402 | | if (params.is_strict) { | 403 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 404 | | decimal_to_string(from.value(), scale_from), | 405 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 406 | | precision_to, scale_to); | 407 | | } | 408 | | } else { | 409 | | if (params.is_strict) { | 410 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 411 | | decimal_to_string(from.value, scale_from), | 412 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 413 | | precision_to, scale_to); | 414 | | } | 415 | | } | 416 | | return false; | 417 | | } | 418 | | } | 419 | | to = ToCppT(res); | 420 | | } | 421 | 82 | return true; | 422 | 130 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_14DecimalV2ValueENS_12Decimal128V3ELb0ELb0EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 343 | 11 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 344 | 11 | MaxNativeType res; | 345 | | if constexpr (multiply_may_overflow) { | 346 | | if constexpr (IsDecimal128V2<FromCppT>) { | 347 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 348 | | res)) { | 349 | | if (params.is_strict) { | 350 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 351 | | decimal_to_string(from.value(), scale_from), | 352 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 353 | | precision_to, scale_to); | 354 | | } | 355 | | return false; | 356 | | } else { | 357 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 358 | | if (params.is_strict) { | 359 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 360 | | decimal_to_string(from.value(), scale_from), | 361 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 362 | | precision_to, scale_to); | 363 | | } | 364 | | return false; | 365 | | } else { | 366 | | to = ToCppT(res); | 367 | | } | 368 | | } | 369 | | } else { | 370 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 371 | | res)) { | 372 | | if (params.is_strict) { | 373 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 374 | | decimal_to_string(from.value, scale_from), | 375 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 376 | | precision_to, scale_to); | 377 | | } | 378 | | return false; | 379 | | } else { | 380 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 381 | | if (params.is_strict) { | 382 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 383 | | decimal_to_string(from.value, scale_from), | 384 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 385 | | precision_to, scale_to); | 386 | | } | 387 | | return false; | 388 | | } else { | 389 | | to = ToCppT(res); | 390 | | } | 391 | | } | 392 | | } | 393 | 11 | } else { | 394 | 11 | if constexpr (IsDecimal128V2<FromCppT>) { | 395 | 11 | res = from.value() * scale_multiplier; | 396 | | } else { | 397 | | res = from.value * scale_multiplier; | 398 | | } | 399 | | if constexpr (narrow_integral) { | 400 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 401 | | if constexpr (IsDecimal128V2<FromCppT>) { | 402 | | if (params.is_strict) { | 403 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 404 | | decimal_to_string(from.value(), scale_from), | 405 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 406 | | precision_to, scale_to); | 407 | | } | 408 | | } else { | 409 | | if (params.is_strict) { | 410 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 411 | | decimal_to_string(from.value, scale_from), | 412 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 413 | | precision_to, scale_to); | 414 | | } | 415 | | } | 416 | | return false; | 417 | | } | 418 | | } | 419 | 11 | to = ToCppT(res); | 420 | 11 | } | 421 | 11 | return true; | 422 | 11 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_14DecimalV2ValueENS_12Decimal128V3ELb0ELb1EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 343 | 95 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 344 | 95 | MaxNativeType res; | 345 | | if constexpr (multiply_may_overflow) { | 346 | | if constexpr (IsDecimal128V2<FromCppT>) { | 347 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 348 | | res)) { | 349 | | if (params.is_strict) { | 350 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 351 | | decimal_to_string(from.value(), scale_from), | 352 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 353 | | precision_to, scale_to); | 354 | | } | 355 | | return false; | 356 | | } else { | 357 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 358 | | if (params.is_strict) { | 359 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 360 | | decimal_to_string(from.value(), scale_from), | 361 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 362 | | precision_to, scale_to); | 363 | | } | 364 | | return false; | 365 | | } else { | 366 | | to = ToCppT(res); | 367 | | } | 368 | | } | 369 | | } else { | 370 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 371 | | res)) { | 372 | | if (params.is_strict) { | 373 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 374 | | decimal_to_string(from.value, scale_from), | 375 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 376 | | precision_to, scale_to); | 377 | | } | 378 | | return false; | 379 | | } else { | 380 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 381 | | if (params.is_strict) { | 382 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 383 | | decimal_to_string(from.value, scale_from), | 384 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 385 | | precision_to, scale_to); | 386 | | } | 387 | | return false; | 388 | | } else { | 389 | | to = ToCppT(res); | 390 | | } | 391 | | } | 392 | | } | 393 | 95 | } else { | 394 | 95 | if constexpr (IsDecimal128V2<FromCppT>) { | 395 | 95 | res = from.value() * scale_multiplier; | 396 | | } else { | 397 | | res = from.value * scale_multiplier; | 398 | | } | 399 | 95 | if constexpr (narrow_integral) { | 400 | 95 | if (UNLIKELY(res > max_result || res < -max_result)) { | 401 | 30 | if constexpr (IsDecimal128V2<FromCppT>) { | 402 | 30 | if (params.is_strict) { | 403 | 15 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 404 | 15 | decimal_to_string(from.value(), scale_from), | 405 | 15 | fmt::format("decimal({}, {})", precision_from, scale_from), | 406 | 15 | precision_to, scale_to); | 407 | 15 | } | 408 | | } else { | 409 | | if (params.is_strict) { | 410 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 411 | | decimal_to_string(from.value, scale_from), | 412 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 413 | | precision_to, scale_to); | 414 | | } | 415 | | } | 416 | 30 | return false; | 417 | 30 | } | 418 | 95 | } | 419 | 65 | to = ToCppT(res); | 420 | 95 | } | 421 | 0 | return true; | 422 | 95 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_14DecimalV2ValueENS_12Decimal128V3ELb1ELb0EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 343 | 11 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 344 | 11 | MaxNativeType res; | 345 | 11 | if constexpr (multiply_may_overflow) { | 346 | 11 | if constexpr (IsDecimal128V2<FromCppT>) { | 347 | 11 | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 348 | 11 | res)) { | 349 | 0 | if (params.is_strict) { | 350 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 351 | 0 | decimal_to_string(from.value(), scale_from), | 352 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 353 | 0 | precision_to, scale_to); | 354 | 0 | } | 355 | 0 | return false; | 356 | 11 | } else { | 357 | 11 | if (UNLIKELY(res > max_result || res < -max_result)) { | 358 | 0 | if (params.is_strict) { | 359 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 360 | 0 | decimal_to_string(from.value(), scale_from), | 361 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 362 | 0 | precision_to, scale_to); | 363 | 0 | } | 364 | 0 | return false; | 365 | 11 | } else { | 366 | 11 | to = ToCppT(res); | 367 | 11 | } | 368 | 11 | } | 369 | | } else { | 370 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 371 | | res)) { | 372 | | if (params.is_strict) { | 373 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 374 | | decimal_to_string(from.value, scale_from), | 375 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 376 | | precision_to, scale_to); | 377 | | } | 378 | | return false; | 379 | | } else { | 380 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 381 | | if (params.is_strict) { | 382 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 383 | | decimal_to_string(from.value, scale_from), | 384 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 385 | | precision_to, scale_to); | 386 | | } | 387 | | return false; | 388 | | } else { | 389 | | to = ToCppT(res); | 390 | | } | 391 | | } | 392 | | } | 393 | | } else { | 394 | | if constexpr (IsDecimal128V2<FromCppT>) { | 395 | | res = from.value() * scale_multiplier; | 396 | | } else { | 397 | | res = from.value * scale_multiplier; | 398 | | } | 399 | | if constexpr (narrow_integral) { | 400 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 401 | | if constexpr (IsDecimal128V2<FromCppT>) { | 402 | | if (params.is_strict) { | 403 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 404 | | decimal_to_string(from.value(), scale_from), | 405 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 406 | | precision_to, scale_to); | 407 | | } | 408 | | } else { | 409 | | if (params.is_strict) { | 410 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 411 | | decimal_to_string(from.value, scale_from), | 412 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 413 | | precision_to, scale_to); | 414 | | } | 415 | | } | 416 | | return false; | 417 | | } | 418 | | } | 419 | | to = ToCppT(res); | 420 | | } | 421 | 11 | return true; | 422 | 11 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_14DecimalV2ValueENS_12Decimal128V3ELb1ELb1EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 343 | 95 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 344 | 95 | MaxNativeType res; | 345 | 95 | if constexpr (multiply_may_overflow) { | 346 | 95 | if constexpr (IsDecimal128V2<FromCppT>) { | 347 | 95 | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 348 | 95 | res)) { | 349 | 18 | if (params.is_strict) { | 350 | 6 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 351 | 6 | decimal_to_string(from.value(), scale_from), | 352 | 6 | fmt::format("decimal({}, {})", precision_from, scale_from), | 353 | 6 | precision_to, scale_to); | 354 | 6 | } | 355 | 18 | return false; | 356 | 77 | } else { | 357 | 77 | if (UNLIKELY(res > max_result || res < -max_result)) { | 358 | 12 | if (params.is_strict) { | 359 | 9 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 360 | 9 | decimal_to_string(from.value(), scale_from), | 361 | 9 | fmt::format("decimal({}, {})", precision_from, scale_from), | 362 | 9 | precision_to, scale_to); | 363 | 9 | } | 364 | 12 | return false; | 365 | 65 | } else { | 366 | 65 | to = ToCppT(res); | 367 | 65 | } | 368 | 77 | } | 369 | | } else { | 370 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 371 | | res)) { | 372 | | if (params.is_strict) { | 373 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 374 | | decimal_to_string(from.value, scale_from), | 375 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 376 | | precision_to, scale_to); | 377 | | } | 378 | | return false; | 379 | | } else { | 380 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 381 | | if (params.is_strict) { | 382 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 383 | | decimal_to_string(from.value, scale_from), | 384 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 385 | | precision_to, scale_to); | 386 | | } | 387 | | return false; | 388 | | } else { | 389 | | to = ToCppT(res); | 390 | | } | 391 | | } | 392 | | } | 393 | | } else { | 394 | | if constexpr (IsDecimal128V2<FromCppT>) { | 395 | | res = from.value() * scale_multiplier; | 396 | | } else { | 397 | | res = from.value * scale_multiplier; | 398 | | } | 399 | | if constexpr (narrow_integral) { | 400 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 401 | | if constexpr (IsDecimal128V2<FromCppT>) { | 402 | | if (params.is_strict) { | 403 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 404 | | decimal_to_string(from.value(), scale_from), | 405 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 406 | | precision_to, scale_to); | 407 | | } | 408 | | } else { | 409 | | if (params.is_strict) { | 410 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 411 | | decimal_to_string(from.value, scale_from), | 412 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 413 | | precision_to, scale_to); | 414 | | } | 415 | | } | 416 | | return false; | 417 | | } | 418 | | } | 419 | | to = ToCppT(res); | 420 | | } | 421 | 65 | return true; | 422 | 95 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_14DecimalV2ValueENS_7DecimalIN4wide7integerILm256EiEEEELb0ELb0ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKT3_RKNS8_10NativeTypeESI_RNS_14CastParametersE Line | Count | Source | 343 | 11 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 344 | 11 | MaxNativeType res; | 345 | | if constexpr (multiply_may_overflow) { | 346 | | if constexpr (IsDecimal128V2<FromCppT>) { | 347 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 348 | | res)) { | 349 | | if (params.is_strict) { | 350 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 351 | | decimal_to_string(from.value(), scale_from), | 352 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 353 | | precision_to, scale_to); | 354 | | } | 355 | | return false; | 356 | | } else { | 357 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 358 | | if (params.is_strict) { | 359 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 360 | | decimal_to_string(from.value(), scale_from), | 361 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 362 | | precision_to, scale_to); | 363 | | } | 364 | | return false; | 365 | | } else { | 366 | | to = ToCppT(res); | 367 | | } | 368 | | } | 369 | | } else { | 370 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 371 | | res)) { | 372 | | if (params.is_strict) { | 373 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 374 | | decimal_to_string(from.value, scale_from), | 375 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 376 | | precision_to, scale_to); | 377 | | } | 378 | | return false; | 379 | | } else { | 380 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 381 | | if (params.is_strict) { | 382 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 383 | | decimal_to_string(from.value, scale_from), | 384 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 385 | | precision_to, scale_to); | 386 | | } | 387 | | return false; | 388 | | } else { | 389 | | to = ToCppT(res); | 390 | | } | 391 | | } | 392 | | } | 393 | 11 | } else { | 394 | 11 | if constexpr (IsDecimal128V2<FromCppT>) { | 395 | 11 | res = from.value() * scale_multiplier; | 396 | | } else { | 397 | | res = from.value * scale_multiplier; | 398 | | } | 399 | | if constexpr (narrow_integral) { | 400 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 401 | | if constexpr (IsDecimal128V2<FromCppT>) { | 402 | | if (params.is_strict) { | 403 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 404 | | decimal_to_string(from.value(), scale_from), | 405 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 406 | | precision_to, scale_to); | 407 | | } | 408 | | } else { | 409 | | if (params.is_strict) { | 410 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 411 | | decimal_to_string(from.value, scale_from), | 412 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 413 | | precision_to, scale_to); | 414 | | } | 415 | | } | 416 | | return false; | 417 | | } | 418 | | } | 419 | 11 | to = ToCppT(res); | 420 | 11 | } | 421 | 11 | return true; | 422 | 11 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_14DecimalV2ValueENS_7DecimalIN4wide7integerILm256EiEEEELb0ELb1ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKT3_RKNS8_10NativeTypeESI_RNS_14CastParametersE Line | Count | Source | 343 | 95 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 344 | 95 | MaxNativeType res; | 345 | | if constexpr (multiply_may_overflow) { | 346 | | if constexpr (IsDecimal128V2<FromCppT>) { | 347 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 348 | | res)) { | 349 | | if (params.is_strict) { | 350 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 351 | | decimal_to_string(from.value(), scale_from), | 352 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 353 | | precision_to, scale_to); | 354 | | } | 355 | | return false; | 356 | | } else { | 357 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 358 | | if (params.is_strict) { | 359 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 360 | | decimal_to_string(from.value(), scale_from), | 361 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 362 | | precision_to, scale_to); | 363 | | } | 364 | | return false; | 365 | | } else { | 366 | | to = ToCppT(res); | 367 | | } | 368 | | } | 369 | | } else { | 370 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 371 | | res)) { | 372 | | if (params.is_strict) { | 373 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 374 | | decimal_to_string(from.value, scale_from), | 375 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 376 | | precision_to, scale_to); | 377 | | } | 378 | | return false; | 379 | | } else { | 380 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 381 | | if (params.is_strict) { | 382 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 383 | | decimal_to_string(from.value, scale_from), | 384 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 385 | | precision_to, scale_to); | 386 | | } | 387 | | return false; | 388 | | } else { | 389 | | to = ToCppT(res); | 390 | | } | 391 | | } | 392 | | } | 393 | 95 | } else { | 394 | 95 | if constexpr (IsDecimal128V2<FromCppT>) { | 395 | 95 | res = from.value() * scale_multiplier; | 396 | | } else { | 397 | | res = from.value * scale_multiplier; | 398 | | } | 399 | 95 | if constexpr (narrow_integral) { | 400 | 95 | if (UNLIKELY(res > max_result || res < -max_result)) { | 401 | 30 | if constexpr (IsDecimal128V2<FromCppT>) { | 402 | 30 | if (params.is_strict) { | 403 | 15 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 404 | 15 | decimal_to_string(from.value(), scale_from), | 405 | 15 | fmt::format("decimal({}, {})", precision_from, scale_from), | 406 | 15 | precision_to, scale_to); | 407 | 15 | } | 408 | | } else { | 409 | | if (params.is_strict) { | 410 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 411 | | decimal_to_string(from.value, scale_from), | 412 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 413 | | precision_to, scale_to); | 414 | | } | 415 | | } | 416 | 30 | return false; | 417 | 30 | } | 418 | 95 | } | 419 | 65 | to = ToCppT(res); | 420 | 95 | } | 421 | 0 | return true; | 422 | 95 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_14DecimalV2ValueENS_7DecimalIN4wide7integerILm256EiEEEELb1ELb0ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKT3_RKNS8_10NativeTypeESI_RNS_14CastParametersE Line | Count | Source | 343 | 11 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 344 | 11 | MaxNativeType res; | 345 | 11 | if constexpr (multiply_may_overflow) { | 346 | 11 | if constexpr (IsDecimal128V2<FromCppT>) { | 347 | 11 | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 348 | 11 | res)) { | 349 | 0 | if (params.is_strict) { | 350 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 351 | 0 | decimal_to_string(from.value(), scale_from), | 352 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 353 | 0 | precision_to, scale_to); | 354 | 0 | } | 355 | 0 | return false; | 356 | 11 | } else { | 357 | 11 | if (UNLIKELY(res > max_result || res < -max_result)) { | 358 | 0 | if (params.is_strict) { | 359 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 360 | 0 | decimal_to_string(from.value(), scale_from), | 361 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 362 | 0 | precision_to, scale_to); | 363 | 0 | } | 364 | 0 | return false; | 365 | 11 | } else { | 366 | 11 | to = ToCppT(res); | 367 | 11 | } | 368 | 11 | } | 369 | | } else { | 370 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 371 | | res)) { | 372 | | if (params.is_strict) { | 373 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 374 | | decimal_to_string(from.value, scale_from), | 375 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 376 | | precision_to, scale_to); | 377 | | } | 378 | | return false; | 379 | | } else { | 380 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 381 | | if (params.is_strict) { | 382 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 383 | | decimal_to_string(from.value, scale_from), | 384 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 385 | | precision_to, scale_to); | 386 | | } | 387 | | return false; | 388 | | } else { | 389 | | to = ToCppT(res); | 390 | | } | 391 | | } | 392 | | } | 393 | | } else { | 394 | | if constexpr (IsDecimal128V2<FromCppT>) { | 395 | | res = from.value() * scale_multiplier; | 396 | | } else { | 397 | | res = from.value * scale_multiplier; | 398 | | } | 399 | | if constexpr (narrow_integral) { | 400 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 401 | | if constexpr (IsDecimal128V2<FromCppT>) { | 402 | | if (params.is_strict) { | 403 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 404 | | decimal_to_string(from.value(), scale_from), | 405 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 406 | | precision_to, scale_to); | 407 | | } | 408 | | } else { | 409 | | if (params.is_strict) { | 410 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 411 | | decimal_to_string(from.value, scale_from), | 412 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 413 | | precision_to, scale_to); | 414 | | } | 415 | | } | 416 | | return false; | 417 | | } | 418 | | } | 419 | | to = ToCppT(res); | 420 | | } | 421 | 11 | return true; | 422 | 11 | } |
_ZN5doris13CastToDecimal27_from_decimal_smaller_scaleINS_14DecimalV2ValueENS_7DecimalIN4wide7integerILm256EiEEEELb1ELb1ES6_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKT3_RKNS8_10NativeTypeESI_RNS_14CastParametersE Line | Count | Source | 343 | 95 | const typename ToCppT::NativeType& max_result, CastParameters& params) { | 344 | 95 | MaxNativeType res; | 345 | 95 | if constexpr (multiply_may_overflow) { | 346 | 95 | if constexpr (IsDecimal128V2<FromCppT>) { | 347 | 95 | if (common::mul_overflow(static_cast<MaxNativeType>(from.value()), scale_multiplier, | 348 | 95 | res)) { | 349 | 10 | if (params.is_strict) { | 350 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 351 | 0 | decimal_to_string(from.value(), scale_from), | 352 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 353 | 0 | precision_to, scale_to); | 354 | 0 | } | 355 | 10 | return false; | 356 | 85 | } else { | 357 | 85 | if (UNLIKELY(res > max_result || res < -max_result)) { | 358 | 20 | if (params.is_strict) { | 359 | 15 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 360 | 15 | decimal_to_string(from.value(), scale_from), | 361 | 15 | fmt::format("decimal({}, {})", precision_from, scale_from), | 362 | 15 | precision_to, scale_to); | 363 | 15 | } | 364 | 20 | return false; | 365 | 65 | } else { | 366 | 65 | to = ToCppT(res); | 367 | 65 | } | 368 | 85 | } | 369 | | } else { | 370 | | if (common::mul_overflow(static_cast<MaxNativeType>(from.value), scale_multiplier, | 371 | | res)) { | 372 | | if (params.is_strict) { | 373 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 374 | | decimal_to_string(from.value, scale_from), | 375 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 376 | | precision_to, scale_to); | 377 | | } | 378 | | return false; | 379 | | } else { | 380 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 381 | | if (params.is_strict) { | 382 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 383 | | decimal_to_string(from.value, scale_from), | 384 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 385 | | precision_to, scale_to); | 386 | | } | 387 | | return false; | 388 | | } else { | 389 | | to = ToCppT(res); | 390 | | } | 391 | | } | 392 | | } | 393 | | } else { | 394 | | if constexpr (IsDecimal128V2<FromCppT>) { | 395 | | res = from.value() * scale_multiplier; | 396 | | } else { | 397 | | res = from.value * scale_multiplier; | 398 | | } | 399 | | if constexpr (narrow_integral) { | 400 | | if (UNLIKELY(res > max_result || res < -max_result)) { | 401 | | if constexpr (IsDecimal128V2<FromCppT>) { | 402 | | if (params.is_strict) { | 403 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 404 | | decimal_to_string(from.value(), scale_from), | 405 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 406 | | precision_to, scale_to); | 407 | | } | 408 | | } else { | 409 | | if (params.is_strict) { | 410 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 411 | | decimal_to_string(from.value, scale_from), | 412 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 413 | | precision_to, scale_to); | 414 | | } | 415 | | } | 416 | | return false; | 417 | | } | 418 | | } | 419 | | to = ToCppT(res); | 420 | | } | 421 | 65 | return true; | 422 | 95 | } |
|
423 | | |
424 | | template <typename FromCppT, typename ToCppT, typename ScaleT, bool narrow_integral> |
425 | | requires(IsDecimalNumber<ToCppT> && IsDecimalNumber<FromCppT>) |
426 | | static inline bool _from_decimal_same_scale(const FromCppT& from, const UInt32 precision_from, |
427 | | const UInt32 scale_from, ToCppT& to, |
428 | | UInt32 precision_to, UInt32 scale_to, |
429 | | const typename ToCppT::NativeType& min_result, |
430 | | const typename ToCppT::NativeType& max_result, |
431 | 1.86k | CastParameters& params) { |
432 | 1.86k | if constexpr (IsDecimal128V2<FromCppT>) { |
433 | 106 | if constexpr (narrow_integral) { |
434 | 95 | if (UNLIKELY(from.value() > max_result || from.value() < -max_result)) { |
435 | 30 | if (params.is_strict) { |
436 | 15 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( |
437 | 15 | decimal_to_string(from.value(), scale_from), |
438 | 15 | fmt::format("decimal({}, {})", precision_from, scale_from), |
439 | 15 | precision_to, scale_to); |
440 | 15 | } |
441 | 30 | return false; |
442 | 30 | } |
443 | 95 | } |
444 | 65 | to = ToCppT(from.value()); |
445 | 1.76k | } else { |
446 | 1.76k | if constexpr (narrow_integral) { |
447 | 1.05k | if (UNLIKELY(from.value > max_result || from.value < -max_result)) { |
448 | 354 | if (params.is_strict) { |
449 | 177 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( |
450 | 177 | decimal_to_string(from.value, scale_from), |
451 | 177 | fmt::format("decimal({}, {})", precision_from, scale_from), |
452 | 177 | precision_to, scale_to); |
453 | 177 | } |
454 | 354 | return false; |
455 | 354 | } |
456 | 1.05k | } |
457 | 703 | to = ToCppT(from.value); |
458 | 1.76k | } |
459 | 0 | return true; |
460 | 1.86k | } _ZN5doris13CastToDecimal24_from_decimal_same_scaleINS_7DecimalIiEES3_iLb0EQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKNS4_10NativeTypeESB_RNS_14CastParametersE Line | Count | Source | 431 | 8 | CastParameters& params) { | 432 | | if constexpr (IsDecimal128V2<FromCppT>) { | 433 | | if constexpr (narrow_integral) { | 434 | | if (UNLIKELY(from.value() > max_result || from.value() < -max_result)) { | 435 | | if (params.is_strict) { | 436 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 437 | | decimal_to_string(from.value(), scale_from), | 438 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 439 | | precision_to, scale_to); | 440 | | } | 441 | | return false; | 442 | | } | 443 | | } | 444 | | to = ToCppT(from.value()); | 445 | 8 | } else { | 446 | | if constexpr (narrow_integral) { | 447 | | if (UNLIKELY(from.value > max_result || from.value < -max_result)) { | 448 | | if (params.is_strict) { | 449 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 450 | | decimal_to_string(from.value, scale_from), | 451 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 452 | | precision_to, scale_to); | 453 | | } | 454 | | return false; | 455 | | } | 456 | | } | 457 | 8 | to = ToCppT(from.value); | 458 | 8 | } | 459 | 8 | return true; | 460 | 8 | } |
_ZN5doris13CastToDecimal24_from_decimal_same_scaleINS_7DecimalIiEES3_iLb1EQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKNS4_10NativeTypeESB_RNS_14CastParametersE Line | Count | Source | 431 | 19 | CastParameters& params) { | 432 | | if constexpr (IsDecimal128V2<FromCppT>) { | 433 | | if constexpr (narrow_integral) { | 434 | | if (UNLIKELY(from.value() > max_result || from.value() < -max_result)) { | 435 | | if (params.is_strict) { | 436 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 437 | | decimal_to_string(from.value(), scale_from), | 438 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 439 | | precision_to, scale_to); | 440 | | } | 441 | | return false; | 442 | | } | 443 | | } | 444 | | to = ToCppT(from.value()); | 445 | 19 | } else { | 446 | 19 | if constexpr (narrow_integral) { | 447 | 19 | if (UNLIKELY(from.value > max_result || from.value < -max_result)) { | 448 | 12 | if (params.is_strict) { | 449 | 6 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 450 | 6 | decimal_to_string(from.value, scale_from), | 451 | 6 | fmt::format("decimal({}, {})", precision_from, scale_from), | 452 | 6 | precision_to, scale_to); | 453 | 6 | } | 454 | 12 | return false; | 455 | 12 | } | 456 | 19 | } | 457 | 7 | to = ToCppT(from.value); | 458 | 19 | } | 459 | 0 | return true; | 460 | 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 | 431 | 136 | CastParameters& params) { | 432 | | if constexpr (IsDecimal128V2<FromCppT>) { | 433 | | if constexpr (narrow_integral) { | 434 | | if (UNLIKELY(from.value() > max_result || from.value() < -max_result)) { | 435 | | if (params.is_strict) { | 436 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 437 | | decimal_to_string(from.value(), scale_from), | 438 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 439 | | precision_to, scale_to); | 440 | | } | 441 | | return false; | 442 | | } | 443 | | } | 444 | | to = ToCppT(from.value()); | 445 | 136 | } else { | 446 | 136 | if constexpr (narrow_integral) { | 447 | 136 | if (UNLIKELY(from.value > max_result || from.value < -max_result)) { | 448 | 54 | if (params.is_strict) { | 449 | 27 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 450 | 27 | decimal_to_string(from.value, scale_from), | 451 | 27 | fmt::format("decimal({}, {})", precision_from, scale_from), | 452 | 27 | precision_to, scale_to); | 453 | 27 | } | 454 | 54 | return false; | 455 | 54 | } | 456 | 136 | } | 457 | 82 | to = ToCppT(from.value); | 458 | 136 | } | 459 | 0 | return true; | 460 | 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 | 431 | 122 | CastParameters& params) { | 432 | | if constexpr (IsDecimal128V2<FromCppT>) { | 433 | | if constexpr (narrow_integral) { | 434 | | if (UNLIKELY(from.value() > max_result || from.value() < -max_result)) { | 435 | | if (params.is_strict) { | 436 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 437 | | decimal_to_string(from.value(), scale_from), | 438 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 439 | | precision_to, scale_to); | 440 | | } | 441 | | return false; | 442 | | } | 443 | | } | 444 | | to = ToCppT(from.value()); | 445 | 122 | } else { | 446 | 122 | if constexpr (narrow_integral) { | 447 | 122 | if (UNLIKELY(from.value > max_result || from.value < -max_result)) { | 448 | 48 | if (params.is_strict) { | 449 | 24 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 450 | 24 | decimal_to_string(from.value, scale_from), | 451 | 24 | fmt::format("decimal({}, {})", precision_from, scale_from), | 452 | 24 | precision_to, scale_to); | 453 | 24 | } | 454 | 48 | return false; | 455 | 48 | } | 456 | 122 | } | 457 | 74 | to = ToCppT(from.value); | 458 | 122 | } | 459 | 0 | return true; | 460 | 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 | 431 | 122 | CastParameters& params) { | 432 | | if constexpr (IsDecimal128V2<FromCppT>) { | 433 | | if constexpr (narrow_integral) { | 434 | | if (UNLIKELY(from.value() > max_result || from.value() < -max_result)) { | 435 | | if (params.is_strict) { | 436 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 437 | | decimal_to_string(from.value(), scale_from), | 438 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 439 | | precision_to, scale_to); | 440 | | } | 441 | | return false; | 442 | | } | 443 | | } | 444 | | to = ToCppT(from.value()); | 445 | 122 | } else { | 446 | 122 | if constexpr (narrow_integral) { | 447 | 122 | if (UNLIKELY(from.value > max_result || from.value < -max_result)) { | 448 | 48 | if (params.is_strict) { | 449 | 24 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 450 | 24 | decimal_to_string(from.value, scale_from), | 451 | 24 | fmt::format("decimal({}, {})", precision_from, scale_from), | 452 | 24 | precision_to, scale_to); | 453 | 24 | } | 454 | 48 | return false; | 455 | 48 | } | 456 | 122 | } | 457 | 74 | to = ToCppT(from.value); | 458 | 122 | } | 459 | 0 | return true; | 460 | 122 | } |
_ZN5doris13CastToDecimal24_from_decimal_same_scaleINS_7DecimalIiEENS2_IlEElLb0EQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RNS_14CastParametersE Line | Count | Source | 431 | 82 | CastParameters& params) { | 432 | | if constexpr (IsDecimal128V2<FromCppT>) { | 433 | | if constexpr (narrow_integral) { | 434 | | if (UNLIKELY(from.value() > max_result || from.value() < -max_result)) { | 435 | | if (params.is_strict) { | 436 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 437 | | decimal_to_string(from.value(), scale_from), | 438 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 439 | | precision_to, scale_to); | 440 | | } | 441 | | return false; | 442 | | } | 443 | | } | 444 | | to = ToCppT(from.value()); | 445 | 82 | } else { | 446 | | if constexpr (narrow_integral) { | 447 | | if (UNLIKELY(from.value > max_result || from.value < -max_result)) { | 448 | | if (params.is_strict) { | 449 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 450 | | decimal_to_string(from.value, scale_from), | 451 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 452 | | precision_to, scale_to); | 453 | | } | 454 | | return false; | 455 | | } | 456 | | } | 457 | 82 | to = ToCppT(from.value); | 458 | 82 | } | 459 | 82 | return true; | 460 | 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 | 431 | 30 | CastParameters& params) { | 432 | | if constexpr (IsDecimal128V2<FromCppT>) { | 433 | | if constexpr (narrow_integral) { | 434 | | if (UNLIKELY(from.value() > max_result || from.value() < -max_result)) { | 435 | | if (params.is_strict) { | 436 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 437 | | decimal_to_string(from.value(), scale_from), | 438 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 439 | | precision_to, scale_to); | 440 | | } | 441 | | return false; | 442 | | } | 443 | | } | 444 | | to = ToCppT(from.value()); | 445 | 30 | } else { | 446 | | if constexpr (narrow_integral) { | 447 | | if (UNLIKELY(from.value > max_result || from.value < -max_result)) { | 448 | | if (params.is_strict) { | 449 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 450 | | decimal_to_string(from.value, scale_from), | 451 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 452 | | precision_to, scale_to); | 453 | | } | 454 | | return false; | 455 | | } | 456 | | } | 457 | 30 | to = ToCppT(from.value); | 458 | 30 | } | 459 | 30 | return true; | 460 | 30 | } |
_ZN5doris13CastToDecimal24_from_decimal_same_scaleINS_7DecimalIlEES3_lLb1EQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKNS4_10NativeTypeESB_RNS_14CastParametersE Line | Count | Source | 431 | 42 | CastParameters& params) { | 432 | | if constexpr (IsDecimal128V2<FromCppT>) { | 433 | | if constexpr (narrow_integral) { | 434 | | if (UNLIKELY(from.value() > max_result || from.value() < -max_result)) { | 435 | | if (params.is_strict) { | 436 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 437 | | decimal_to_string(from.value(), scale_from), | 438 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 439 | | precision_to, scale_to); | 440 | | } | 441 | | return false; | 442 | | } | 443 | | } | 444 | | to = ToCppT(from.value()); | 445 | 42 | } else { | 446 | 42 | if constexpr (narrow_integral) { | 447 | 42 | if (UNLIKELY(from.value > max_result || from.value < -max_result)) { | 448 | 12 | if (params.is_strict) { | 449 | 6 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 450 | 6 | decimal_to_string(from.value, scale_from), | 451 | 6 | fmt::format("decimal({}, {})", precision_from, scale_from), | 452 | 6 | precision_to, scale_to); | 453 | 6 | } | 454 | 12 | return false; | 455 | 12 | } | 456 | 42 | } | 457 | 30 | to = ToCppT(from.value); | 458 | 42 | } | 459 | 0 | return true; | 460 | 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 | 431 | 182 | CastParameters& params) { | 432 | | if constexpr (IsDecimal128V2<FromCppT>) { | 433 | | if constexpr (narrow_integral) { | 434 | | if (UNLIKELY(from.value() > max_result || from.value() < -max_result)) { | 435 | | if (params.is_strict) { | 436 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 437 | | decimal_to_string(from.value(), scale_from), | 438 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 439 | | precision_to, scale_to); | 440 | | } | 441 | | return false; | 442 | | } | 443 | | } | 444 | | to = ToCppT(from.value()); | 445 | 182 | } else { | 446 | 182 | if constexpr (narrow_integral) { | 447 | 182 | if (UNLIKELY(from.value > max_result || from.value < -max_result)) { | 448 | 54 | if (params.is_strict) { | 449 | 27 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 450 | 27 | decimal_to_string(from.value, scale_from), | 451 | 27 | fmt::format("decimal({}, {})", precision_from, scale_from), | 452 | 27 | precision_to, scale_to); | 453 | 27 | } | 454 | 54 | return false; | 455 | 54 | } | 456 | 182 | } | 457 | 128 | to = ToCppT(from.value); | 458 | 182 | } | 459 | 0 | return true; | 460 | 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 | 431 | 168 | CastParameters& params) { | 432 | | if constexpr (IsDecimal128V2<FromCppT>) { | 433 | | if constexpr (narrow_integral) { | 434 | | if (UNLIKELY(from.value() > max_result || from.value() < -max_result)) { | 435 | | if (params.is_strict) { | 436 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 437 | | decimal_to_string(from.value(), scale_from), | 438 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 439 | | precision_to, scale_to); | 440 | | } | 441 | | return false; | 442 | | } | 443 | | } | 444 | | to = ToCppT(from.value()); | 445 | 168 | } else { | 446 | 168 | if constexpr (narrow_integral) { | 447 | 168 | if (UNLIKELY(from.value > max_result || from.value < -max_result)) { | 448 | 48 | if (params.is_strict) { | 449 | 24 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 450 | 24 | decimal_to_string(from.value, scale_from), | 451 | 24 | fmt::format("decimal({}, {})", precision_from, scale_from), | 452 | 24 | precision_to, scale_to); | 453 | 24 | } | 454 | 48 | return false; | 455 | 48 | } | 456 | 168 | } | 457 | 120 | to = ToCppT(from.value); | 458 | 168 | } | 459 | 0 | return true; | 460 | 168 | } |
_ZN5doris13CastToDecimal24_from_decimal_same_scaleINS_7DecimalIiEENS_12Decimal128V3EnLb0EQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RNS_14CastParametersE Line | Count | Source | 431 | 74 | CastParameters& params) { | 432 | | if constexpr (IsDecimal128V2<FromCppT>) { | 433 | | if constexpr (narrow_integral) { | 434 | | if (UNLIKELY(from.value() > max_result || from.value() < -max_result)) { | 435 | | if (params.is_strict) { | 436 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 437 | | decimal_to_string(from.value(), scale_from), | 438 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 439 | | precision_to, scale_to); | 440 | | } | 441 | | return false; | 442 | | } | 443 | | } | 444 | | to = ToCppT(from.value()); | 445 | 74 | } else { | 446 | | if constexpr (narrow_integral) { | 447 | | if (UNLIKELY(from.value > max_result || from.value < -max_result)) { | 448 | | if (params.is_strict) { | 449 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 450 | | decimal_to_string(from.value, scale_from), | 451 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 452 | | precision_to, scale_to); | 453 | | } | 454 | | return false; | 455 | | } | 456 | | } | 457 | 74 | to = ToCppT(from.value); | 458 | 74 | } | 459 | 74 | return true; | 460 | 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 | 431 | 128 | CastParameters& params) { | 432 | | if constexpr (IsDecimal128V2<FromCppT>) { | 433 | | if constexpr (narrow_integral) { | 434 | | if (UNLIKELY(from.value() > max_result || from.value() < -max_result)) { | 435 | | if (params.is_strict) { | 436 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 437 | | decimal_to_string(from.value(), scale_from), | 438 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 439 | | precision_to, scale_to); | 440 | | } | 441 | | return false; | 442 | | } | 443 | | } | 444 | | to = ToCppT(from.value()); | 445 | 128 | } else { | 446 | | if constexpr (narrow_integral) { | 447 | | if (UNLIKELY(from.value > max_result || from.value < -max_result)) { | 448 | | if (params.is_strict) { | 449 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 450 | | decimal_to_string(from.value, scale_from), | 451 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 452 | | precision_to, scale_to); | 453 | | } | 454 | | return false; | 455 | | } | 456 | | } | 457 | 128 | to = ToCppT(from.value); | 458 | 128 | } | 459 | 128 | return true; | 460 | 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 | 431 | 31 | CastParameters& params) { | 432 | | if constexpr (IsDecimal128V2<FromCppT>) { | 433 | | if constexpr (narrow_integral) { | 434 | | if (UNLIKELY(from.value() > max_result || from.value() < -max_result)) { | 435 | | if (params.is_strict) { | 436 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 437 | | decimal_to_string(from.value(), scale_from), | 438 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 439 | | precision_to, scale_to); | 440 | | } | 441 | | return false; | 442 | | } | 443 | | } | 444 | | to = ToCppT(from.value()); | 445 | 31 | } else { | 446 | | if constexpr (narrow_integral) { | 447 | | if (UNLIKELY(from.value > max_result || from.value < -max_result)) { | 448 | | if (params.is_strict) { | 449 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 450 | | decimal_to_string(from.value, scale_from), | 451 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 452 | | precision_to, scale_to); | 453 | | } | 454 | | return false; | 455 | | } | 456 | | } | 457 | 31 | to = ToCppT(from.value); | 458 | 31 | } | 459 | 31 | return true; | 460 | 31 | } |
_ZN5doris13CastToDecimal24_from_decimal_same_scaleINS_12Decimal128V3ES2_nLb1EQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS4_jjRS3_jjRKNS3_10NativeTypeESA_RNS_14CastParametersE Line | Count | Source | 431 | 42 | CastParameters& params) { | 432 | | if constexpr (IsDecimal128V2<FromCppT>) { | 433 | | if constexpr (narrow_integral) { | 434 | | if (UNLIKELY(from.value() > max_result || from.value() < -max_result)) { | 435 | | if (params.is_strict) { | 436 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 437 | | decimal_to_string(from.value(), scale_from), | 438 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 439 | | precision_to, scale_to); | 440 | | } | 441 | | return false; | 442 | | } | 443 | | } | 444 | | to = ToCppT(from.value()); | 445 | 42 | } else { | 446 | 42 | if constexpr (narrow_integral) { | 447 | 42 | if (UNLIKELY(from.value > max_result || from.value < -max_result)) { | 448 | 12 | if (params.is_strict) { | 449 | 6 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 450 | 6 | decimal_to_string(from.value, scale_from), | 451 | 6 | fmt::format("decimal({}, {})", precision_from, scale_from), | 452 | 6 | precision_to, scale_to); | 453 | 6 | } | 454 | 12 | return false; | 455 | 12 | } | 456 | 42 | } | 457 | 30 | to = ToCppT(from.value); | 458 | 42 | } | 459 | 0 | return true; | 460 | 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 | 431 | 182 | CastParameters& params) { | 432 | | if constexpr (IsDecimal128V2<FromCppT>) { | 433 | | if constexpr (narrow_integral) { | 434 | | if (UNLIKELY(from.value() > max_result || from.value() < -max_result)) { | 435 | | if (params.is_strict) { | 436 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 437 | | decimal_to_string(from.value(), scale_from), | 438 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 439 | | precision_to, scale_to); | 440 | | } | 441 | | return false; | 442 | | } | 443 | | } | 444 | | to = ToCppT(from.value()); | 445 | 182 | } else { | 446 | 182 | if constexpr (narrow_integral) { | 447 | 182 | if (UNLIKELY(from.value > max_result || from.value < -max_result)) { | 448 | 54 | if (params.is_strict) { | 449 | 27 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 450 | 27 | decimal_to_string(from.value, scale_from), | 451 | 27 | fmt::format("decimal({}, {})", precision_from, scale_from), | 452 | 27 | precision_to, scale_to); | 453 | 27 | } | 454 | 54 | return false; | 455 | 54 | } | 456 | 182 | } | 457 | 128 | to = ToCppT(from.value); | 458 | 182 | } | 459 | 0 | return true; | 460 | 182 | } |
_ZN5doris13CastToDecimal24_from_decimal_same_scaleINS_7DecimalIiEENS2_IN4wide7integerILm256EiEEEES6_Lb0EQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKNS8_10NativeTypeESF_RNS_14CastParametersE Line | Count | Source | 431 | 74 | CastParameters& params) { | 432 | | if constexpr (IsDecimal128V2<FromCppT>) { | 433 | | if constexpr (narrow_integral) { | 434 | | if (UNLIKELY(from.value() > max_result || from.value() < -max_result)) { | 435 | | if (params.is_strict) { | 436 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 437 | | decimal_to_string(from.value(), scale_from), | 438 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 439 | | precision_to, scale_to); | 440 | | } | 441 | | return false; | 442 | | } | 443 | | } | 444 | | to = ToCppT(from.value()); | 445 | 74 | } else { | 446 | | if constexpr (narrow_integral) { | 447 | | if (UNLIKELY(from.value > max_result || from.value < -max_result)) { | 448 | | if (params.is_strict) { | 449 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 450 | | decimal_to_string(from.value, scale_from), | 451 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 452 | | precision_to, scale_to); | 453 | | } | 454 | | return false; | 455 | | } | 456 | | } | 457 | 74 | to = ToCppT(from.value); | 458 | 74 | } | 459 | 74 | return true; | 460 | 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 | 431 | 120 | CastParameters& params) { | 432 | | if constexpr (IsDecimal128V2<FromCppT>) { | 433 | | if constexpr (narrow_integral) { | 434 | | if (UNLIKELY(from.value() > max_result || from.value() < -max_result)) { | 435 | | if (params.is_strict) { | 436 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 437 | | decimal_to_string(from.value(), scale_from), | 438 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 439 | | precision_to, scale_to); | 440 | | } | 441 | | return false; | 442 | | } | 443 | | } | 444 | | to = ToCppT(from.value()); | 445 | 120 | } else { | 446 | | if constexpr (narrow_integral) { | 447 | | if (UNLIKELY(from.value > max_result || from.value < -max_result)) { | 448 | | if (params.is_strict) { | 449 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 450 | | decimal_to_string(from.value, scale_from), | 451 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 452 | | precision_to, scale_to); | 453 | | } | 454 | | return false; | 455 | | } | 456 | | } | 457 | 120 | to = ToCppT(from.value); | 458 | 120 | } | 459 | 120 | return true; | 460 | 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 | 431 | 128 | CastParameters& params) { | 432 | | if constexpr (IsDecimal128V2<FromCppT>) { | 433 | | if constexpr (narrow_integral) { | 434 | | if (UNLIKELY(from.value() > max_result || from.value() < -max_result)) { | 435 | | if (params.is_strict) { | 436 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 437 | | decimal_to_string(from.value(), scale_from), | 438 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 439 | | precision_to, scale_to); | 440 | | } | 441 | | return false; | 442 | | } | 443 | | } | 444 | | to = ToCppT(from.value()); | 445 | 128 | } else { | 446 | | if constexpr (narrow_integral) { | 447 | | if (UNLIKELY(from.value > max_result || from.value < -max_result)) { | 448 | | if (params.is_strict) { | 449 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 450 | | decimal_to_string(from.value, scale_from), | 451 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 452 | | precision_to, scale_to); | 453 | | } | 454 | | return false; | 455 | | } | 456 | | } | 457 | 128 | to = ToCppT(from.value); | 458 | 128 | } | 459 | 128 | return true; | 460 | 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 | 431 | 30 | CastParameters& params) { | 432 | | if constexpr (IsDecimal128V2<FromCppT>) { | 433 | | if constexpr (narrow_integral) { | 434 | | if (UNLIKELY(from.value() > max_result || from.value() < -max_result)) { | 435 | | if (params.is_strict) { | 436 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 437 | | decimal_to_string(from.value(), scale_from), | 438 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 439 | | precision_to, scale_to); | 440 | | } | 441 | | return false; | 442 | | } | 443 | | } | 444 | | to = ToCppT(from.value()); | 445 | 30 | } else { | 446 | | if constexpr (narrow_integral) { | 447 | | if (UNLIKELY(from.value > max_result || from.value < -max_result)) { | 448 | | if (params.is_strict) { | 449 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 450 | | decimal_to_string(from.value, scale_from), | 451 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 452 | | precision_to, scale_to); | 453 | | } | 454 | | return false; | 455 | | } | 456 | | } | 457 | 30 | to = ToCppT(from.value); | 458 | 30 | } | 459 | 30 | return true; | 460 | 30 | } |
_ZN5doris13CastToDecimal24_from_decimal_same_scaleINS_7DecimalIN4wide7integerILm256EiEEEES6_S5_Lb1EQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS8_jjRS7_jjRKNS7_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 431 | 42 | CastParameters& params) { | 432 | | if constexpr (IsDecimal128V2<FromCppT>) { | 433 | | if constexpr (narrow_integral) { | 434 | | if (UNLIKELY(from.value() > max_result || from.value() < -max_result)) { | 435 | | if (params.is_strict) { | 436 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 437 | | decimal_to_string(from.value(), scale_from), | 438 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 439 | | precision_to, scale_to); | 440 | | } | 441 | | return false; | 442 | | } | 443 | | } | 444 | | to = ToCppT(from.value()); | 445 | 42 | } else { | 446 | 42 | if constexpr (narrow_integral) { | 447 | 42 | if (UNLIKELY(from.value > max_result || from.value < -max_result)) { | 448 | 12 | if (params.is_strict) { | 449 | 6 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 450 | 6 | decimal_to_string(from.value, scale_from), | 451 | 6 | fmt::format("decimal({}, {})", precision_from, scale_from), | 452 | 6 | precision_to, scale_to); | 453 | 6 | } | 454 | 12 | return false; | 455 | 12 | } | 456 | 42 | } | 457 | 30 | to = ToCppT(from.value); | 458 | 42 | } | 459 | 0 | return true; | 460 | 42 | } |
_ZN5doris13CastToDecimal24_from_decimal_same_scaleINS_14DecimalV2ValueENS_7DecimalIiEEnLb0EQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RNS_14CastParametersE Line | Count | Source | 431 | 4 | CastParameters& params) { | 432 | 4 | if constexpr (IsDecimal128V2<FromCppT>) { | 433 | | if constexpr (narrow_integral) { | 434 | | if (UNLIKELY(from.value() > max_result || from.value() < -max_result)) { | 435 | | if (params.is_strict) { | 436 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 437 | | decimal_to_string(from.value(), scale_from), | 438 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 439 | | precision_to, scale_to); | 440 | | } | 441 | | return false; | 442 | | } | 443 | | } | 444 | 4 | to = ToCppT(from.value()); | 445 | | } else { | 446 | | if constexpr (narrow_integral) { | 447 | | if (UNLIKELY(from.value > max_result || from.value < -max_result)) { | 448 | | if (params.is_strict) { | 449 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 450 | | decimal_to_string(from.value, scale_from), | 451 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 452 | | precision_to, scale_to); | 453 | | } | 454 | | return false; | 455 | | } | 456 | | } | 457 | | to = ToCppT(from.value); | 458 | | } | 459 | 4 | return true; | 460 | 4 | } |
_ZN5doris13CastToDecimal24_from_decimal_same_scaleINS_14DecimalV2ValueENS_7DecimalIiEEnLb1EQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RNS_14CastParametersE Line | Count | Source | 431 | 35 | CastParameters& params) { | 432 | 35 | if constexpr (IsDecimal128V2<FromCppT>) { | 433 | 35 | if constexpr (narrow_integral) { | 434 | 35 | if (UNLIKELY(from.value() > max_result || from.value() < -max_result)) { | 435 | 18 | if (params.is_strict) { | 436 | 9 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 437 | 9 | decimal_to_string(from.value(), scale_from), | 438 | 9 | fmt::format("decimal({}, {})", precision_from, scale_from), | 439 | 9 | precision_to, scale_to); | 440 | 9 | } | 441 | 18 | return false; | 442 | 18 | } | 443 | 35 | } | 444 | 17 | to = ToCppT(from.value()); | 445 | | } else { | 446 | | if constexpr (narrow_integral) { | 447 | | if (UNLIKELY(from.value > max_result || from.value < -max_result)) { | 448 | | if (params.is_strict) { | 449 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 450 | | decimal_to_string(from.value, scale_from), | 451 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 452 | | precision_to, scale_to); | 453 | | } | 454 | | return false; | 455 | | } | 456 | | } | 457 | | to = ToCppT(from.value); | 458 | | } | 459 | 0 | return true; | 460 | 35 | } |
_ZN5doris13CastToDecimal24_from_decimal_same_scaleINS_14DecimalV2ValueENS_7DecimalIlEEnLb0EQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RNS_14CastParametersE Line | Count | Source | 431 | 7 | CastParameters& params) { | 432 | 7 | if constexpr (IsDecimal128V2<FromCppT>) { | 433 | | if constexpr (narrow_integral) { | 434 | | if (UNLIKELY(from.value() > max_result || from.value() < -max_result)) { | 435 | | if (params.is_strict) { | 436 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 437 | | decimal_to_string(from.value(), scale_from), | 438 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 439 | | precision_to, scale_to); | 440 | | } | 441 | | return false; | 442 | | } | 443 | | } | 444 | 7 | to = ToCppT(from.value()); | 445 | | } else { | 446 | | if constexpr (narrow_integral) { | 447 | | if (UNLIKELY(from.value > max_result || from.value < -max_result)) { | 448 | | if (params.is_strict) { | 449 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 450 | | decimal_to_string(from.value, scale_from), | 451 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 452 | | precision_to, scale_to); | 453 | | } | 454 | | return false; | 455 | | } | 456 | | } | 457 | | to = ToCppT(from.value); | 458 | | } | 459 | 7 | return true; | 460 | 7 | } |
_ZN5doris13CastToDecimal24_from_decimal_same_scaleINS_14DecimalV2ValueENS_7DecimalIlEEnLb1EQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKNS5_10NativeTypeESC_RNS_14CastParametersE Line | Count | Source | 431 | 60 | CastParameters& params) { | 432 | 60 | if constexpr (IsDecimal128V2<FromCppT>) { | 433 | 60 | if constexpr (narrow_integral) { | 434 | 60 | if (UNLIKELY(from.value() > max_result || from.value() < -max_result)) { | 435 | 12 | if (params.is_strict) { | 436 | 6 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 437 | 6 | decimal_to_string(from.value(), scale_from), | 438 | 6 | fmt::format("decimal({}, {})", precision_from, scale_from), | 439 | 6 | precision_to, scale_to); | 440 | 6 | } | 441 | 12 | return false; | 442 | 12 | } | 443 | 60 | } | 444 | 48 | to = ToCppT(from.value()); | 445 | | } else { | 446 | | if constexpr (narrow_integral) { | 447 | | if (UNLIKELY(from.value > max_result || from.value < -max_result)) { | 448 | | if (params.is_strict) { | 449 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 450 | | decimal_to_string(from.value, scale_from), | 451 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 452 | | precision_to, scale_to); | 453 | | } | 454 | | return false; | 455 | | } | 456 | | } | 457 | | to = ToCppT(from.value); | 458 | | } | 459 | 0 | return true; | 460 | 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 |
461 | | |
462 | | template < |
463 | | typename FromCppT, typename ToCppT, bool multiply_may_overflow, bool narrow_integral, |
464 | | typename MaxNativeType = std::conditional_t< |
465 | | (sizeof(FromCppT) == sizeof(ToCppT)) && |
466 | | (std::is_same_v<ToCppT, Decimal128V3> || |
467 | | std::is_same_v<FromCppT, Decimal128V3>), |
468 | | Decimal128V3::NativeType, |
469 | | std::conditional_t<(sizeof(FromCppT) > sizeof(ToCppT)), |
470 | | typename FromCppT::NativeType, typename ToCppT::NativeType>>> |
471 | | requires(IsDecimalNumber<ToCppT> && IsDecimalNumber<FromCppT>) |
472 | | static inline bool _from_decimal_bigger_scale(const FromCppT& from, const UInt32 precision_from, |
473 | | const UInt32 scale_from, ToCppT& to, |
474 | | UInt32 precision_to, UInt32 scale_to, |
475 | | const MaxNativeType& scale_multiplier, |
476 | | const typename ToCppT::NativeType& min_result, |
477 | | const typename ToCppT::NativeType& max_result, |
478 | 8.38k | CastParameters& params) { |
479 | 8.38k | MaxNativeType res; |
480 | 8.38k | if (from >= FromCppT(0)) { |
481 | 8.38k | if constexpr (narrow_integral) { |
482 | 3.33k | if constexpr (IsDecimal128V2<FromCppT>) { |
483 | 839 | res = (from.value() + scale_multiplier / 2) / scale_multiplier; |
484 | 839 | if (UNLIKELY(res > max_result)) { |
485 | 244 | if (params.is_strict) { |
486 | 122 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( |
487 | 122 | decimal_to_string(from.value(), scale_from), |
488 | 122 | fmt::format("decimal({}, {})", precision_from, scale_from), |
489 | 122 | precision_to, scale_to); |
490 | 122 | } |
491 | 244 | return false; |
492 | 244 | } |
493 | 2.49k | } else { |
494 | 2.49k | res = (from.value + scale_multiplier / 2) / scale_multiplier; |
495 | 2.49k | if (UNLIKELY(res > max_result)) { |
496 | 1.03k | if (params.is_strict) { |
497 | 518 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( |
498 | 518 | decimal_to_string(from.value, scale_from), |
499 | 518 | fmt::format("decimal({}, {})", precision_from, scale_from), |
500 | 518 | precision_to, scale_to); |
501 | 518 | } |
502 | 1.03k | return false; |
503 | 1.03k | } |
504 | 2.49k | } |
505 | 2.04k | to = ToCppT(res); |
506 | 5.05k | } else { |
507 | 5.05k | if constexpr (IsDecimal128V2<FromCppT>) { |
508 | 932 | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); |
509 | 4.12k | } else { |
510 | 4.12k | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); |
511 | 4.12k | } |
512 | 5.05k | } |
513 | 8.38k | } else { |
514 | 0 | if constexpr (narrow_integral) { |
515 | 0 | if constexpr (IsDecimal128V2<FromCppT>) { |
516 | 0 | res = (from.value() - scale_multiplier / 2) / scale_multiplier; |
517 | 0 | if (UNLIKELY(res < -max_result)) { |
518 | 0 | if (params.is_strict) { |
519 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( |
520 | 0 | decimal_to_string(from.value(), scale_from), |
521 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), |
522 | 0 | precision_to, scale_to); |
523 | 0 | } |
524 | 0 | return false; |
525 | 0 | } |
526 | 0 | } else { |
527 | 0 | res = (from.value - scale_multiplier / 2) / scale_multiplier; |
528 | 0 | if (UNLIKELY(res < -max_result)) { |
529 | 0 | if (params.is_strict) { |
530 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( |
531 | 0 | decimal_to_string(from.value, scale_from), |
532 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), |
533 | 0 | precision_to, scale_to); |
534 | 0 | } |
535 | 0 | return false; |
536 | 0 | } |
537 | 0 | } |
538 | 0 | to = ToCppT(res); |
539 | 0 | } else { |
540 | 0 | if constexpr (IsDecimal128V2<FromCppT>) { |
541 | 0 | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); |
542 | 0 | } else { |
543 | 0 | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); |
544 | 0 | } |
545 | 0 | } |
546 | 0 | } |
547 | 0 | return true; |
548 | 8.38k | } _ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_7DecimalIiEES3_Lb0ELb0EiQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 478 | 112 | CastParameters& params) { | 479 | 112 | MaxNativeType res; | 480 | 112 | if (from >= FromCppT(0)) { | 481 | | if constexpr (narrow_integral) { | 482 | | if constexpr (IsDecimal128V2<FromCppT>) { | 483 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 484 | | if (UNLIKELY(res > max_result)) { | 485 | | if (params.is_strict) { | 486 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 487 | | decimal_to_string(from.value(), scale_from), | 488 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 489 | | precision_to, scale_to); | 490 | | } | 491 | | return false; | 492 | | } | 493 | | } else { | 494 | | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 495 | | if (UNLIKELY(res > max_result)) { | 496 | | if (params.is_strict) { | 497 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 498 | | decimal_to_string(from.value, scale_from), | 499 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 500 | | precision_to, scale_to); | 501 | | } | 502 | | return false; | 503 | | } | 504 | | } | 505 | | to = ToCppT(res); | 506 | 112 | } else { | 507 | | if constexpr (IsDecimal128V2<FromCppT>) { | 508 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 509 | 112 | } else { | 510 | 112 | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 511 | 112 | } | 512 | 112 | } | 513 | 112 | } else { | 514 | | if constexpr (narrow_integral) { | 515 | | if constexpr (IsDecimal128V2<FromCppT>) { | 516 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 517 | | if (UNLIKELY(res < -max_result)) { | 518 | | if (params.is_strict) { | 519 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 520 | | decimal_to_string(from.value(), scale_from), | 521 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 522 | | precision_to, scale_to); | 523 | | } | 524 | | return false; | 525 | | } | 526 | | } else { | 527 | | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 528 | | if (UNLIKELY(res < -max_result)) { | 529 | | if (params.is_strict) { | 530 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 531 | | decimal_to_string(from.value, scale_from), | 532 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 533 | | precision_to, scale_to); | 534 | | } | 535 | | return false; | 536 | | } | 537 | | } | 538 | | to = ToCppT(res); | 539 | 0 | } else { | 540 | | if constexpr (IsDecimal128V2<FromCppT>) { | 541 | | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 542 | 0 | } else { | 543 | 0 | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 544 | 0 | } | 545 | 0 | } | 546 | 0 | } | 547 | 112 | return true; | 548 | 112 | } |
_ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_7DecimalIiEES3_Lb0ELb1EiQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 478 | 82 | CastParameters& params) { | 479 | 82 | MaxNativeType res; | 480 | 82 | if (from >= FromCppT(0)) { | 481 | 82 | if constexpr (narrow_integral) { | 482 | | if constexpr (IsDecimal128V2<FromCppT>) { | 483 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 484 | | if (UNLIKELY(res > max_result)) { | 485 | | if (params.is_strict) { | 486 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 487 | | decimal_to_string(from.value(), scale_from), | 488 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 489 | | precision_to, scale_to); | 490 | | } | 491 | | return false; | 492 | | } | 493 | 82 | } else { | 494 | 82 | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 495 | 82 | if (UNLIKELY(res > max_result)) { | 496 | 40 | if (params.is_strict) { | 497 | 20 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 498 | 20 | decimal_to_string(from.value, scale_from), | 499 | 20 | fmt::format("decimal({}, {})", precision_from, scale_from), | 500 | 20 | precision_to, scale_to); | 501 | 20 | } | 502 | 40 | return false; | 503 | 40 | } | 504 | 82 | } | 505 | 42 | to = ToCppT(res); | 506 | | } else { | 507 | | if constexpr (IsDecimal128V2<FromCppT>) { | 508 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 509 | | } else { | 510 | | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 511 | | } | 512 | | } | 513 | 82 | } else { | 514 | 0 | if constexpr (narrow_integral) { | 515 | | if constexpr (IsDecimal128V2<FromCppT>) { | 516 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 517 | | if (UNLIKELY(res < -max_result)) { | 518 | | if (params.is_strict) { | 519 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 520 | | decimal_to_string(from.value(), scale_from), | 521 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 522 | | precision_to, scale_to); | 523 | | } | 524 | | return false; | 525 | | } | 526 | 0 | } else { | 527 | 0 | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 528 | 0 | if (UNLIKELY(res < -max_result)) { | 529 | 0 | if (params.is_strict) { | 530 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 531 | 0 | decimal_to_string(from.value, scale_from), | 532 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 533 | 0 | precision_to, scale_to); | 534 | 0 | } | 535 | 0 | return false; | 536 | 0 | } | 537 | 0 | } | 538 | 0 | to = ToCppT(res); | 539 | | } else { | 540 | | if constexpr (IsDecimal128V2<FromCppT>) { | 541 | | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 542 | | } else { | 543 | | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 544 | | } | 545 | | } | 546 | 0 | } | 547 | 0 | return true; | 548 | 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 | 478 | 160 | CastParameters& params) { | 479 | 160 | MaxNativeType res; | 480 | 160 | if (from >= FromCppT(0)) { | 481 | | if constexpr (narrow_integral) { | 482 | | if constexpr (IsDecimal128V2<FromCppT>) { | 483 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 484 | | if (UNLIKELY(res > max_result)) { | 485 | | if (params.is_strict) { | 486 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 487 | | decimal_to_string(from.value(), scale_from), | 488 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 489 | | precision_to, scale_to); | 490 | | } | 491 | | return false; | 492 | | } | 493 | | } else { | 494 | | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 495 | | if (UNLIKELY(res > max_result)) { | 496 | | if (params.is_strict) { | 497 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 498 | | decimal_to_string(from.value, scale_from), | 499 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 500 | | precision_to, scale_to); | 501 | | } | 502 | | return false; | 503 | | } | 504 | | } | 505 | | to = ToCppT(res); | 506 | 160 | } else { | 507 | | if constexpr (IsDecimal128V2<FromCppT>) { | 508 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 509 | 160 | } else { | 510 | 160 | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 511 | 160 | } | 512 | 160 | } | 513 | 160 | } else { | 514 | | if constexpr (narrow_integral) { | 515 | | if constexpr (IsDecimal128V2<FromCppT>) { | 516 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 517 | | if (UNLIKELY(res < -max_result)) { | 518 | | if (params.is_strict) { | 519 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 520 | | decimal_to_string(from.value(), scale_from), | 521 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 522 | | precision_to, scale_to); | 523 | | } | 524 | | return false; | 525 | | } | 526 | | } else { | 527 | | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 528 | | if (UNLIKELY(res < -max_result)) { | 529 | | if (params.is_strict) { | 530 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 531 | | decimal_to_string(from.value, scale_from), | 532 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 533 | | precision_to, scale_to); | 534 | | } | 535 | | return false; | 536 | | } | 537 | | } | 538 | | to = ToCppT(res); | 539 | 0 | } else { | 540 | | if constexpr (IsDecimal128V2<FromCppT>) { | 541 | | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 542 | 0 | } else { | 543 | 0 | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 544 | 0 | } | 545 | 0 | } | 546 | 0 | } | 547 | 160 | return true; | 548 | 160 | } |
_ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_7DecimalIlEENS2_IiEELb0ELb1ElQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKT3_RKNS5_10NativeTypeESF_RNS_14CastParametersE Line | Count | Source | 478 | 323 | CastParameters& params) { | 479 | 323 | MaxNativeType res; | 480 | 323 | if (from >= FromCppT(0)) { | 481 | 323 | if constexpr (narrow_integral) { | 482 | | if constexpr (IsDecimal128V2<FromCppT>) { | 483 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 484 | | if (UNLIKELY(res > max_result)) { | 485 | | if (params.is_strict) { | 486 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 487 | | decimal_to_string(from.value(), scale_from), | 488 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 489 | | precision_to, scale_to); | 490 | | } | 491 | | return false; | 492 | | } | 493 | 323 | } else { | 494 | 323 | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 495 | 323 | if (UNLIKELY(res > max_result)) { | 496 | 133 | if (params.is_strict) { | 497 | 66 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 498 | 66 | decimal_to_string(from.value, scale_from), | 499 | 66 | fmt::format("decimal({}, {})", precision_from, scale_from), | 500 | 66 | precision_to, scale_to); | 501 | 66 | } | 502 | 133 | return false; | 503 | 133 | } | 504 | 323 | } | 505 | 190 | to = ToCppT(res); | 506 | | } else { | 507 | | if constexpr (IsDecimal128V2<FromCppT>) { | 508 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 509 | | } else { | 510 | | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 511 | | } | 512 | | } | 513 | 323 | } else { | 514 | 0 | if constexpr (narrow_integral) { | 515 | | if constexpr (IsDecimal128V2<FromCppT>) { | 516 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 517 | | if (UNLIKELY(res < -max_result)) { | 518 | | if (params.is_strict) { | 519 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 520 | | decimal_to_string(from.value(), scale_from), | 521 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 522 | | precision_to, scale_to); | 523 | | } | 524 | | return false; | 525 | | } | 526 | 0 | } else { | 527 | 0 | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 528 | 0 | if (UNLIKELY(res < -max_result)) { | 529 | 0 | if (params.is_strict) { | 530 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 531 | 0 | decimal_to_string(from.value, scale_from), | 532 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 533 | 0 | precision_to, scale_to); | 534 | 0 | } | 535 | 0 | return false; | 536 | 0 | } | 537 | 0 | } | 538 | 0 | to = ToCppT(res); | 539 | | } else { | 540 | | if constexpr (IsDecimal128V2<FromCppT>) { | 541 | | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 542 | | } else { | 543 | | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 544 | | } | 545 | | } | 546 | 0 | } | 547 | 0 | return true; | 548 | 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 | 478 | 160 | CastParameters& params) { | 479 | 160 | MaxNativeType res; | 480 | 160 | if (from >= FromCppT(0)) { | 481 | | if constexpr (narrow_integral) { | 482 | | if constexpr (IsDecimal128V2<FromCppT>) { | 483 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 484 | | if (UNLIKELY(res > max_result)) { | 485 | | if (params.is_strict) { | 486 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 487 | | decimal_to_string(from.value(), scale_from), | 488 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 489 | | precision_to, scale_to); | 490 | | } | 491 | | return false; | 492 | | } | 493 | | } else { | 494 | | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 495 | | if (UNLIKELY(res > max_result)) { | 496 | | if (params.is_strict) { | 497 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 498 | | decimal_to_string(from.value, scale_from), | 499 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 500 | | precision_to, scale_to); | 501 | | } | 502 | | return false; | 503 | | } | 504 | | } | 505 | | to = ToCppT(res); | 506 | 160 | } else { | 507 | | if constexpr (IsDecimal128V2<FromCppT>) { | 508 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 509 | 160 | } else { | 510 | 160 | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 511 | 160 | } | 512 | 160 | } | 513 | 160 | } else { | 514 | | if constexpr (narrow_integral) { | 515 | | if constexpr (IsDecimal128V2<FromCppT>) { | 516 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 517 | | if (UNLIKELY(res < -max_result)) { | 518 | | if (params.is_strict) { | 519 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 520 | | decimal_to_string(from.value(), scale_from), | 521 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 522 | | precision_to, scale_to); | 523 | | } | 524 | | return false; | 525 | | } | 526 | | } else { | 527 | | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 528 | | if (UNLIKELY(res < -max_result)) { | 529 | | if (params.is_strict) { | 530 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 531 | | decimal_to_string(from.value, scale_from), | 532 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 533 | | precision_to, scale_to); | 534 | | } | 535 | | return false; | 536 | | } | 537 | | } | 538 | | to = ToCppT(res); | 539 | 0 | } else { | 540 | | if constexpr (IsDecimal128V2<FromCppT>) { | 541 | | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 542 | 0 | } else { | 543 | 0 | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 544 | 0 | } | 545 | 0 | } | 546 | 0 | } | 547 | 160 | return true; | 548 | 160 | } |
_ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_12Decimal128V3ENS_7DecimalIiEELb0ELb1EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKT3_RKNS5_10NativeTypeESF_RNS_14CastParametersE Line | Count | Source | 478 | 357 | CastParameters& params) { | 479 | 357 | MaxNativeType res; | 480 | 357 | if (from >= FromCppT(0)) { | 481 | 357 | if constexpr (narrow_integral) { | 482 | | if constexpr (IsDecimal128V2<FromCppT>) { | 483 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 484 | | if (UNLIKELY(res > max_result)) { | 485 | | if (params.is_strict) { | 486 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 487 | | decimal_to_string(from.value(), scale_from), | 488 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 489 | | precision_to, scale_to); | 490 | | } | 491 | | return false; | 492 | | } | 493 | 357 | } else { | 494 | 357 | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 495 | 357 | if (UNLIKELY(res > max_result)) { | 496 | 161 | if (params.is_strict) { | 497 | 80 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 498 | 80 | decimal_to_string(from.value, scale_from), | 499 | 80 | fmt::format("decimal({}, {})", precision_from, scale_from), | 500 | 80 | precision_to, scale_to); | 501 | 80 | } | 502 | 161 | return false; | 503 | 161 | } | 504 | 357 | } | 505 | 196 | to = ToCppT(res); | 506 | | } else { | 507 | | if constexpr (IsDecimal128V2<FromCppT>) { | 508 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 509 | | } else { | 510 | | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 511 | | } | 512 | | } | 513 | 357 | } else { | 514 | 0 | if constexpr (narrow_integral) { | 515 | | if constexpr (IsDecimal128V2<FromCppT>) { | 516 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 517 | | if (UNLIKELY(res < -max_result)) { | 518 | | if (params.is_strict) { | 519 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 520 | | decimal_to_string(from.value(), scale_from), | 521 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 522 | | precision_to, scale_to); | 523 | | } | 524 | | return false; | 525 | | } | 526 | 0 | } else { | 527 | 0 | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 528 | 0 | if (UNLIKELY(res < -max_result)) { | 529 | 0 | if (params.is_strict) { | 530 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 531 | 0 | decimal_to_string(from.value, scale_from), | 532 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 533 | 0 | precision_to, scale_to); | 534 | 0 | } | 535 | 0 | return false; | 536 | 0 | } | 537 | 0 | } | 538 | 0 | to = ToCppT(res); | 539 | | } else { | 540 | | if constexpr (IsDecimal128V2<FromCppT>) { | 541 | | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 542 | | } else { | 543 | | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 544 | | } | 545 | | } | 546 | 0 | } | 547 | 0 | return true; | 548 | 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 | 478 | 160 | CastParameters& params) { | 479 | 160 | MaxNativeType res; | 480 | 160 | if (from >= FromCppT(0)) { | 481 | | if constexpr (narrow_integral) { | 482 | | if constexpr (IsDecimal128V2<FromCppT>) { | 483 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 484 | | if (UNLIKELY(res > max_result)) { | 485 | | if (params.is_strict) { | 486 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 487 | | decimal_to_string(from.value(), scale_from), | 488 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 489 | | precision_to, scale_to); | 490 | | } | 491 | | return false; | 492 | | } | 493 | | } else { | 494 | | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 495 | | if (UNLIKELY(res > max_result)) { | 496 | | if (params.is_strict) { | 497 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 498 | | decimal_to_string(from.value, scale_from), | 499 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 500 | | precision_to, scale_to); | 501 | | } | 502 | | return false; | 503 | | } | 504 | | } | 505 | | to = ToCppT(res); | 506 | 160 | } else { | 507 | | if constexpr (IsDecimal128V2<FromCppT>) { | 508 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 509 | 160 | } else { | 510 | 160 | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 511 | 160 | } | 512 | 160 | } | 513 | 160 | } else { | 514 | | if constexpr (narrow_integral) { | 515 | | if constexpr (IsDecimal128V2<FromCppT>) { | 516 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 517 | | if (UNLIKELY(res < -max_result)) { | 518 | | if (params.is_strict) { | 519 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 520 | | decimal_to_string(from.value(), scale_from), | 521 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 522 | | precision_to, scale_to); | 523 | | } | 524 | | return false; | 525 | | } | 526 | | } else { | 527 | | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 528 | | if (UNLIKELY(res < -max_result)) { | 529 | | if (params.is_strict) { | 530 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 531 | | decimal_to_string(from.value, scale_from), | 532 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 533 | | precision_to, scale_to); | 534 | | } | 535 | | return false; | 536 | | } | 537 | | } | 538 | | to = ToCppT(res); | 539 | 0 | } else { | 540 | | if constexpr (IsDecimal128V2<FromCppT>) { | 541 | | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 542 | 0 | } else { | 543 | 0 | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 544 | 0 | } | 545 | 0 | } | 546 | 0 | } | 547 | 160 | return true; | 548 | 160 | } |
_ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_7DecimalIN4wide7integerILm256EiEEEENS2_IiEELb0ELb1ES5_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKT3_RKNS8_10NativeTypeESI_RNS_14CastParametersE Line | Count | Source | 478 | 357 | CastParameters& params) { | 479 | 357 | MaxNativeType res; | 480 | 357 | if (from >= FromCppT(0)) { | 481 | 357 | if constexpr (narrow_integral) { | 482 | | if constexpr (IsDecimal128V2<FromCppT>) { | 483 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 484 | | if (UNLIKELY(res > max_result)) { | 485 | | if (params.is_strict) { | 486 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 487 | | decimal_to_string(from.value(), scale_from), | 488 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 489 | | precision_to, scale_to); | 490 | | } | 491 | | return false; | 492 | | } | 493 | 357 | } else { | 494 | 357 | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 495 | 357 | if (UNLIKELY(res > max_result)) { | 496 | 161 | if (params.is_strict) { | 497 | 80 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 498 | 80 | decimal_to_string(from.value, scale_from), | 499 | 80 | fmt::format("decimal({}, {})", precision_from, scale_from), | 500 | 80 | precision_to, scale_to); | 501 | 80 | } | 502 | 161 | return false; | 503 | 161 | } | 504 | 357 | } | 505 | 196 | to = ToCppT(res); | 506 | | } else { | 507 | | if constexpr (IsDecimal128V2<FromCppT>) { | 508 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 509 | | } else { | 510 | | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 511 | | } | 512 | | } | 513 | 357 | } else { | 514 | 0 | if constexpr (narrow_integral) { | 515 | | if constexpr (IsDecimal128V2<FromCppT>) { | 516 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 517 | | if (UNLIKELY(res < -max_result)) { | 518 | | if (params.is_strict) { | 519 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 520 | | decimal_to_string(from.value(), scale_from), | 521 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 522 | | precision_to, scale_to); | 523 | | } | 524 | | return false; | 525 | | } | 526 | 0 | } else { | 527 | 0 | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 528 | 0 | if (UNLIKELY(res < -max_result)) { | 529 | 0 | if (params.is_strict) { | 530 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 531 | 0 | decimal_to_string(from.value, scale_from), | 532 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 533 | 0 | precision_to, scale_to); | 534 | 0 | } | 535 | 0 | return false; | 536 | 0 | } | 537 | 0 | } | 538 | 0 | to = ToCppT(res); | 539 | | } else { | 540 | | if constexpr (IsDecimal128V2<FromCppT>) { | 541 | | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 542 | | } else { | 543 | | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 544 | | } | 545 | | } | 546 | 0 | } | 547 | 0 | return true; | 548 | 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 | 478 | 184 | CastParameters& params) { | 479 | 184 | MaxNativeType res; | 480 | 184 | if (from >= FromCppT(0)) { | 481 | | if constexpr (narrow_integral) { | 482 | | if constexpr (IsDecimal128V2<FromCppT>) { | 483 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 484 | | if (UNLIKELY(res > max_result)) { | 485 | | if (params.is_strict) { | 486 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 487 | | decimal_to_string(from.value(), scale_from), | 488 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 489 | | precision_to, scale_to); | 490 | | } | 491 | | return false; | 492 | | } | 493 | | } else { | 494 | | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 495 | | if (UNLIKELY(res > max_result)) { | 496 | | if (params.is_strict) { | 497 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 498 | | decimal_to_string(from.value, scale_from), | 499 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 500 | | precision_to, scale_to); | 501 | | } | 502 | | return false; | 503 | | } | 504 | | } | 505 | | to = ToCppT(res); | 506 | 184 | } else { | 507 | | if constexpr (IsDecimal128V2<FromCppT>) { | 508 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 509 | 184 | } else { | 510 | 184 | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 511 | 184 | } | 512 | 184 | } | 513 | 184 | } else { | 514 | | if constexpr (narrow_integral) { | 515 | | if constexpr (IsDecimal128V2<FromCppT>) { | 516 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 517 | | if (UNLIKELY(res < -max_result)) { | 518 | | if (params.is_strict) { | 519 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 520 | | decimal_to_string(from.value(), scale_from), | 521 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 522 | | precision_to, scale_to); | 523 | | } | 524 | | return false; | 525 | | } | 526 | | } else { | 527 | | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 528 | | if (UNLIKELY(res < -max_result)) { | 529 | | if (params.is_strict) { | 530 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 531 | | decimal_to_string(from.value, scale_from), | 532 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 533 | | precision_to, scale_to); | 534 | | } | 535 | | return false; | 536 | | } | 537 | | } | 538 | | to = ToCppT(res); | 539 | 0 | } else { | 540 | | if constexpr (IsDecimal128V2<FromCppT>) { | 541 | | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 542 | 0 | } else { | 543 | 0 | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 544 | 0 | } | 545 | 0 | } | 546 | 0 | } | 547 | 184 | return true; | 548 | 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 | 478 | 352 | CastParameters& params) { | 479 | 352 | MaxNativeType res; | 480 | 352 | if (from >= FromCppT(0)) { | 481 | | if constexpr (narrow_integral) { | 482 | | if constexpr (IsDecimal128V2<FromCppT>) { | 483 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 484 | | if (UNLIKELY(res > max_result)) { | 485 | | if (params.is_strict) { | 486 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 487 | | decimal_to_string(from.value(), scale_from), | 488 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 489 | | precision_to, scale_to); | 490 | | } | 491 | | return false; | 492 | | } | 493 | | } else { | 494 | | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 495 | | if (UNLIKELY(res > max_result)) { | 496 | | if (params.is_strict) { | 497 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 498 | | decimal_to_string(from.value, scale_from), | 499 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 500 | | precision_to, scale_to); | 501 | | } | 502 | | return false; | 503 | | } | 504 | | } | 505 | | to = ToCppT(res); | 506 | 352 | } else { | 507 | | if constexpr (IsDecimal128V2<FromCppT>) { | 508 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 509 | 352 | } else { | 510 | 352 | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 511 | 352 | } | 512 | 352 | } | 513 | 352 | } else { | 514 | | if constexpr (narrow_integral) { | 515 | | if constexpr (IsDecimal128V2<FromCppT>) { | 516 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 517 | | if (UNLIKELY(res < -max_result)) { | 518 | | if (params.is_strict) { | 519 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 520 | | decimal_to_string(from.value(), scale_from), | 521 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 522 | | precision_to, scale_to); | 523 | | } | 524 | | return false; | 525 | | } | 526 | | } else { | 527 | | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 528 | | if (UNLIKELY(res < -max_result)) { | 529 | | if (params.is_strict) { | 530 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 531 | | decimal_to_string(from.value, scale_from), | 532 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 533 | | precision_to, scale_to); | 534 | | } | 535 | | return false; | 536 | | } | 537 | | } | 538 | | to = ToCppT(res); | 539 | 0 | } else { | 540 | | if constexpr (IsDecimal128V2<FromCppT>) { | 541 | | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 542 | 0 | } else { | 543 | 0 | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 544 | 0 | } | 545 | 0 | } | 546 | 0 | } | 547 | 352 | return true; | 548 | 352 | } |
_ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_7DecimalIlEES3_Lb0ELb1ElQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 478 | 96 | CastParameters& params) { | 479 | 96 | MaxNativeType res; | 480 | 96 | if (from >= FromCppT(0)) { | 481 | 96 | if constexpr (narrow_integral) { | 482 | | if constexpr (IsDecimal128V2<FromCppT>) { | 483 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 484 | | if (UNLIKELY(res > max_result)) { | 485 | | if (params.is_strict) { | 486 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 487 | | decimal_to_string(from.value(), scale_from), | 488 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 489 | | precision_to, scale_to); | 490 | | } | 491 | | return false; | 492 | | } | 493 | 96 | } else { | 494 | 96 | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 495 | 96 | if (UNLIKELY(res > max_result)) { | 496 | 40 | if (params.is_strict) { | 497 | 20 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 498 | 20 | decimal_to_string(from.value, scale_from), | 499 | 20 | fmt::format("decimal({}, {})", precision_from, scale_from), | 500 | 20 | precision_to, scale_to); | 501 | 20 | } | 502 | 40 | return false; | 503 | 40 | } | 504 | 96 | } | 505 | 56 | to = ToCppT(res); | 506 | | } else { | 507 | | if constexpr (IsDecimal128V2<FromCppT>) { | 508 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 509 | | } else { | 510 | | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 511 | | } | 512 | | } | 513 | 96 | } else { | 514 | 0 | if constexpr (narrow_integral) { | 515 | | if constexpr (IsDecimal128V2<FromCppT>) { | 516 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 517 | | if (UNLIKELY(res < -max_result)) { | 518 | | if (params.is_strict) { | 519 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 520 | | decimal_to_string(from.value(), scale_from), | 521 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 522 | | precision_to, scale_to); | 523 | | } | 524 | | return false; | 525 | | } | 526 | 0 | } else { | 527 | 0 | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 528 | 0 | if (UNLIKELY(res < -max_result)) { | 529 | 0 | if (params.is_strict) { | 530 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 531 | 0 | decimal_to_string(from.value, scale_from), | 532 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 533 | 0 | precision_to, scale_to); | 534 | 0 | } | 535 | 0 | return false; | 536 | 0 | } | 537 | 0 | } | 538 | 0 | to = ToCppT(res); | 539 | | } else { | 540 | | if constexpr (IsDecimal128V2<FromCppT>) { | 541 | | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 542 | | } else { | 543 | | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 544 | | } | 545 | | } | 546 | 0 | } | 547 | 0 | return true; | 548 | 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 | 478 | 288 | CastParameters& params) { | 479 | 288 | MaxNativeType res; | 480 | 288 | if (from >= FromCppT(0)) { | 481 | | if constexpr (narrow_integral) { | 482 | | if constexpr (IsDecimal128V2<FromCppT>) { | 483 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 484 | | if (UNLIKELY(res > max_result)) { | 485 | | if (params.is_strict) { | 486 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 487 | | decimal_to_string(from.value(), scale_from), | 488 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 489 | | precision_to, scale_to); | 490 | | } | 491 | | return false; | 492 | | } | 493 | | } else { | 494 | | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 495 | | if (UNLIKELY(res > max_result)) { | 496 | | if (params.is_strict) { | 497 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 498 | | decimal_to_string(from.value, scale_from), | 499 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 500 | | precision_to, scale_to); | 501 | | } | 502 | | return false; | 503 | | } | 504 | | } | 505 | | to = ToCppT(res); | 506 | 288 | } else { | 507 | | if constexpr (IsDecimal128V2<FromCppT>) { | 508 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 509 | 288 | } else { | 510 | 288 | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 511 | 288 | } | 512 | 288 | } | 513 | 288 | } else { | 514 | | if constexpr (narrow_integral) { | 515 | | if constexpr (IsDecimal128V2<FromCppT>) { | 516 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 517 | | if (UNLIKELY(res < -max_result)) { | 518 | | if (params.is_strict) { | 519 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 520 | | decimal_to_string(from.value(), scale_from), | 521 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 522 | | precision_to, scale_to); | 523 | | } | 524 | | return false; | 525 | | } | 526 | | } else { | 527 | | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 528 | | if (UNLIKELY(res < -max_result)) { | 529 | | if (params.is_strict) { | 530 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 531 | | decimal_to_string(from.value, scale_from), | 532 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 533 | | precision_to, scale_to); | 534 | | } | 535 | | return false; | 536 | | } | 537 | | } | 538 | | to = ToCppT(res); | 539 | 0 | } else { | 540 | | if constexpr (IsDecimal128V2<FromCppT>) { | 541 | | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 542 | 0 | } else { | 543 | 0 | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 544 | 0 | } | 545 | 0 | } | 546 | 0 | } | 547 | 288 | return true; | 548 | 288 | } |
_ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_12Decimal128V3ENS_7DecimalIlEELb0ELb1EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKT3_RKNS5_10NativeTypeESF_RNS_14CastParametersE Line | Count | Source | 478 | 350 | CastParameters& params) { | 479 | 350 | MaxNativeType res; | 480 | 350 | if (from >= FromCppT(0)) { | 481 | 350 | if constexpr (narrow_integral) { | 482 | | if constexpr (IsDecimal128V2<FromCppT>) { | 483 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 484 | | if (UNLIKELY(res > max_result)) { | 485 | | if (params.is_strict) { | 486 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 487 | | decimal_to_string(from.value(), scale_from), | 488 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 489 | | precision_to, scale_to); | 490 | | } | 491 | | return false; | 492 | | } | 493 | 350 | } else { | 494 | 350 | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 495 | 350 | if (UNLIKELY(res > max_result)) { | 496 | 132 | if (params.is_strict) { | 497 | 66 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 498 | 66 | decimal_to_string(from.value, scale_from), | 499 | 66 | fmt::format("decimal({}, {})", precision_from, scale_from), | 500 | 66 | precision_to, scale_to); | 501 | 66 | } | 502 | 132 | return false; | 503 | 132 | } | 504 | 350 | } | 505 | 218 | to = ToCppT(res); | 506 | | } else { | 507 | | if constexpr (IsDecimal128V2<FromCppT>) { | 508 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 509 | | } else { | 510 | | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 511 | | } | 512 | | } | 513 | 350 | } else { | 514 | 0 | if constexpr (narrow_integral) { | 515 | | if constexpr (IsDecimal128V2<FromCppT>) { | 516 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 517 | | if (UNLIKELY(res < -max_result)) { | 518 | | if (params.is_strict) { | 519 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 520 | | decimal_to_string(from.value(), scale_from), | 521 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 522 | | precision_to, scale_to); | 523 | | } | 524 | | return false; | 525 | | } | 526 | 0 | } else { | 527 | 0 | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 528 | 0 | if (UNLIKELY(res < -max_result)) { | 529 | 0 | if (params.is_strict) { | 530 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 531 | 0 | decimal_to_string(from.value, scale_from), | 532 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 533 | 0 | precision_to, scale_to); | 534 | 0 | } | 535 | 0 | return false; | 536 | 0 | } | 537 | 0 | } | 538 | 0 | to = ToCppT(res); | 539 | | } else { | 540 | | if constexpr (IsDecimal128V2<FromCppT>) { | 541 | | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 542 | | } else { | 543 | | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 544 | | } | 545 | | } | 546 | 0 | } | 547 | 0 | return true; | 548 | 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 | 478 | 288 | CastParameters& params) { | 479 | 288 | MaxNativeType res; | 480 | 288 | if (from >= FromCppT(0)) { | 481 | | if constexpr (narrow_integral) { | 482 | | if constexpr (IsDecimal128V2<FromCppT>) { | 483 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 484 | | if (UNLIKELY(res > max_result)) { | 485 | | if (params.is_strict) { | 486 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 487 | | decimal_to_string(from.value(), scale_from), | 488 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 489 | | precision_to, scale_to); | 490 | | } | 491 | | return false; | 492 | | } | 493 | | } else { | 494 | | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 495 | | if (UNLIKELY(res > max_result)) { | 496 | | if (params.is_strict) { | 497 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 498 | | decimal_to_string(from.value, scale_from), | 499 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 500 | | precision_to, scale_to); | 501 | | } | 502 | | return false; | 503 | | } | 504 | | } | 505 | | to = ToCppT(res); | 506 | 288 | } else { | 507 | | if constexpr (IsDecimal128V2<FromCppT>) { | 508 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 509 | 288 | } else { | 510 | 288 | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 511 | 288 | } | 512 | 288 | } | 513 | 288 | } else { | 514 | | if constexpr (narrow_integral) { | 515 | | if constexpr (IsDecimal128V2<FromCppT>) { | 516 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 517 | | if (UNLIKELY(res < -max_result)) { | 518 | | if (params.is_strict) { | 519 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 520 | | decimal_to_string(from.value(), scale_from), | 521 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 522 | | precision_to, scale_to); | 523 | | } | 524 | | return false; | 525 | | } | 526 | | } else { | 527 | | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 528 | | if (UNLIKELY(res < -max_result)) { | 529 | | if (params.is_strict) { | 530 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 531 | | decimal_to_string(from.value, scale_from), | 532 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 533 | | precision_to, scale_to); | 534 | | } | 535 | | return false; | 536 | | } | 537 | | } | 538 | | to = ToCppT(res); | 539 | 0 | } else { | 540 | | if constexpr (IsDecimal128V2<FromCppT>) { | 541 | | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 542 | 0 | } else { | 543 | 0 | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 544 | 0 | } | 545 | 0 | } | 546 | 0 | } | 547 | 288 | return true; | 548 | 288 | } |
_ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_7DecimalIN4wide7integerILm256EiEEEENS2_IlEELb0ELb1ES5_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKT3_RKNS8_10NativeTypeESI_RNS_14CastParametersE Line | Count | Source | 478 | 384 | CastParameters& params) { | 479 | 384 | MaxNativeType res; | 480 | 384 | if (from >= FromCppT(0)) { | 481 | 384 | if constexpr (narrow_integral) { | 482 | | if constexpr (IsDecimal128V2<FromCppT>) { | 483 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 484 | | if (UNLIKELY(res > max_result)) { | 485 | | if (params.is_strict) { | 486 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 487 | | decimal_to_string(from.value(), scale_from), | 488 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 489 | | precision_to, scale_to); | 490 | | } | 491 | | return false; | 492 | | } | 493 | 384 | } else { | 494 | 384 | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 495 | 384 | if (UNLIKELY(res > max_result)) { | 496 | 160 | if (params.is_strict) { | 497 | 80 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 498 | 80 | decimal_to_string(from.value, scale_from), | 499 | 80 | fmt::format("decimal({}, {})", precision_from, scale_from), | 500 | 80 | precision_to, scale_to); | 501 | 80 | } | 502 | 160 | return false; | 503 | 160 | } | 504 | 384 | } | 505 | 224 | to = ToCppT(res); | 506 | | } else { | 507 | | if constexpr (IsDecimal128V2<FromCppT>) { | 508 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 509 | | } else { | 510 | | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 511 | | } | 512 | | } | 513 | 384 | } else { | 514 | 0 | if constexpr (narrow_integral) { | 515 | | if constexpr (IsDecimal128V2<FromCppT>) { | 516 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 517 | | if (UNLIKELY(res < -max_result)) { | 518 | | if (params.is_strict) { | 519 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 520 | | decimal_to_string(from.value(), scale_from), | 521 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 522 | | precision_to, scale_to); | 523 | | } | 524 | | return false; | 525 | | } | 526 | 0 | } else { | 527 | 0 | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 528 | 0 | if (UNLIKELY(res < -max_result)) { | 529 | 0 | if (params.is_strict) { | 530 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 531 | 0 | decimal_to_string(from.value, scale_from), | 532 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 533 | 0 | precision_to, scale_to); | 534 | 0 | } | 535 | 0 | return false; | 536 | 0 | } | 537 | 0 | } | 538 | 0 | to = ToCppT(res); | 539 | | } else { | 540 | | if constexpr (IsDecimal128V2<FromCppT>) { | 541 | | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 542 | | } else { | 543 | | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 544 | | } | 545 | | } | 546 | 0 | } | 547 | 0 | return true; | 548 | 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 | 478 | 184 | CastParameters& params) { | 479 | 184 | MaxNativeType res; | 480 | 184 | if (from >= FromCppT(0)) { | 481 | | if constexpr (narrow_integral) { | 482 | | if constexpr (IsDecimal128V2<FromCppT>) { | 483 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 484 | | if (UNLIKELY(res > max_result)) { | 485 | | if (params.is_strict) { | 486 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 487 | | decimal_to_string(from.value(), scale_from), | 488 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 489 | | precision_to, scale_to); | 490 | | } | 491 | | return false; | 492 | | } | 493 | | } else { | 494 | | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 495 | | if (UNLIKELY(res > max_result)) { | 496 | | if (params.is_strict) { | 497 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 498 | | decimal_to_string(from.value, scale_from), | 499 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 500 | | precision_to, scale_to); | 501 | | } | 502 | | return false; | 503 | | } | 504 | | } | 505 | | to = ToCppT(res); | 506 | 184 | } else { | 507 | | if constexpr (IsDecimal128V2<FromCppT>) { | 508 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 509 | 184 | } else { | 510 | 184 | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 511 | 184 | } | 512 | 184 | } | 513 | 184 | } else { | 514 | | if constexpr (narrow_integral) { | 515 | | if constexpr (IsDecimal128V2<FromCppT>) { | 516 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 517 | | if (UNLIKELY(res < -max_result)) { | 518 | | if (params.is_strict) { | 519 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 520 | | decimal_to_string(from.value(), scale_from), | 521 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 522 | | precision_to, scale_to); | 523 | | } | 524 | | return false; | 525 | | } | 526 | | } else { | 527 | | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 528 | | if (UNLIKELY(res < -max_result)) { | 529 | | if (params.is_strict) { | 530 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 531 | | decimal_to_string(from.value, scale_from), | 532 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 533 | | precision_to, scale_to); | 534 | | } | 535 | | return false; | 536 | | } | 537 | | } | 538 | | to = ToCppT(res); | 539 | 0 | } else { | 540 | | if constexpr (IsDecimal128V2<FromCppT>) { | 541 | | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 542 | 0 | } else { | 543 | 0 | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 544 | 0 | } | 545 | 0 | } | 546 | 0 | } | 547 | 184 | return true; | 548 | 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 | 478 | 352 | CastParameters& params) { | 479 | 352 | MaxNativeType res; | 480 | 352 | if (from >= FromCppT(0)) { | 481 | | if constexpr (narrow_integral) { | 482 | | if constexpr (IsDecimal128V2<FromCppT>) { | 483 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 484 | | if (UNLIKELY(res > max_result)) { | 485 | | if (params.is_strict) { | 486 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 487 | | decimal_to_string(from.value(), scale_from), | 488 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 489 | | precision_to, scale_to); | 490 | | } | 491 | | return false; | 492 | | } | 493 | | } else { | 494 | | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 495 | | if (UNLIKELY(res > max_result)) { | 496 | | if (params.is_strict) { | 497 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 498 | | decimal_to_string(from.value, scale_from), | 499 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 500 | | precision_to, scale_to); | 501 | | } | 502 | | return false; | 503 | | } | 504 | | } | 505 | | to = ToCppT(res); | 506 | 352 | } else { | 507 | | if constexpr (IsDecimal128V2<FromCppT>) { | 508 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 509 | 352 | } else { | 510 | 352 | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 511 | 352 | } | 512 | 352 | } | 513 | 352 | } else { | 514 | | if constexpr (narrow_integral) { | 515 | | if constexpr (IsDecimal128V2<FromCppT>) { | 516 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 517 | | if (UNLIKELY(res < -max_result)) { | 518 | | if (params.is_strict) { | 519 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 520 | | decimal_to_string(from.value(), scale_from), | 521 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 522 | | precision_to, scale_to); | 523 | | } | 524 | | return false; | 525 | | } | 526 | | } else { | 527 | | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 528 | | if (UNLIKELY(res < -max_result)) { | 529 | | if (params.is_strict) { | 530 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 531 | | decimal_to_string(from.value, scale_from), | 532 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 533 | | precision_to, scale_to); | 534 | | } | 535 | | return false; | 536 | | } | 537 | | } | 538 | | to = ToCppT(res); | 539 | 0 | } else { | 540 | | if constexpr (IsDecimal128V2<FromCppT>) { | 541 | | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 542 | 0 | } else { | 543 | 0 | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 544 | 0 | } | 545 | 0 | } | 546 | 0 | } | 547 | 352 | return true; | 548 | 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 | 478 | 352 | CastParameters& params) { | 479 | 352 | MaxNativeType res; | 480 | 352 | if (from >= FromCppT(0)) { | 481 | | if constexpr (narrow_integral) { | 482 | | if constexpr (IsDecimal128V2<FromCppT>) { | 483 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 484 | | if (UNLIKELY(res > max_result)) { | 485 | | if (params.is_strict) { | 486 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 487 | | decimal_to_string(from.value(), scale_from), | 488 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 489 | | precision_to, scale_to); | 490 | | } | 491 | | return false; | 492 | | } | 493 | | } else { | 494 | | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 495 | | if (UNLIKELY(res > max_result)) { | 496 | | if (params.is_strict) { | 497 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 498 | | decimal_to_string(from.value, scale_from), | 499 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 500 | | precision_to, scale_to); | 501 | | } | 502 | | return false; | 503 | | } | 504 | | } | 505 | | to = ToCppT(res); | 506 | 352 | } else { | 507 | | if constexpr (IsDecimal128V2<FromCppT>) { | 508 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 509 | 352 | } else { | 510 | 352 | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 511 | 352 | } | 512 | 352 | } | 513 | 352 | } else { | 514 | | if constexpr (narrow_integral) { | 515 | | if constexpr (IsDecimal128V2<FromCppT>) { | 516 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 517 | | if (UNLIKELY(res < -max_result)) { | 518 | | if (params.is_strict) { | 519 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 520 | | decimal_to_string(from.value(), scale_from), | 521 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 522 | | precision_to, scale_to); | 523 | | } | 524 | | return false; | 525 | | } | 526 | | } else { | 527 | | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 528 | | if (UNLIKELY(res < -max_result)) { | 529 | | if (params.is_strict) { | 530 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 531 | | decimal_to_string(from.value, scale_from), | 532 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 533 | | precision_to, scale_to); | 534 | | } | 535 | | return false; | 536 | | } | 537 | | } | 538 | | to = ToCppT(res); | 539 | 0 | } else { | 540 | | if constexpr (IsDecimal128V2<FromCppT>) { | 541 | | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 542 | 0 | } else { | 543 | 0 | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 544 | 0 | } | 545 | 0 | } | 546 | 0 | } | 547 | 352 | return true; | 548 | 352 | } |
_ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_12Decimal128V3ES2_Lb0ELb1EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS4_jjRS3_jjRKT3_RKNS3_10NativeTypeESD_RNS_14CastParametersE Line | Count | Source | 478 | 96 | CastParameters& params) { | 479 | 96 | MaxNativeType res; | 480 | 96 | if (from >= FromCppT(0)) { | 481 | 96 | if constexpr (narrow_integral) { | 482 | | if constexpr (IsDecimal128V2<FromCppT>) { | 483 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 484 | | if (UNLIKELY(res > max_result)) { | 485 | | if (params.is_strict) { | 486 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 487 | | decimal_to_string(from.value(), scale_from), | 488 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 489 | | precision_to, scale_to); | 490 | | } | 491 | | return false; | 492 | | } | 493 | 96 | } else { | 494 | 96 | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 495 | 96 | if (UNLIKELY(res > max_result)) { | 496 | 40 | if (params.is_strict) { | 497 | 20 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 498 | 20 | decimal_to_string(from.value, scale_from), | 499 | 20 | fmt::format("decimal({}, {})", precision_from, scale_from), | 500 | 20 | precision_to, scale_to); | 501 | 20 | } | 502 | 40 | return false; | 503 | 40 | } | 504 | 96 | } | 505 | 56 | to = ToCppT(res); | 506 | | } else { | 507 | | if constexpr (IsDecimal128V2<FromCppT>) { | 508 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 509 | | } else { | 510 | | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 511 | | } | 512 | | } | 513 | 96 | } else { | 514 | 0 | if constexpr (narrow_integral) { | 515 | | if constexpr (IsDecimal128V2<FromCppT>) { | 516 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 517 | | if (UNLIKELY(res < -max_result)) { | 518 | | if (params.is_strict) { | 519 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 520 | | decimal_to_string(from.value(), scale_from), | 521 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 522 | | precision_to, scale_to); | 523 | | } | 524 | | return false; | 525 | | } | 526 | 0 | } else { | 527 | 0 | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 528 | 0 | if (UNLIKELY(res < -max_result)) { | 529 | 0 | if (params.is_strict) { | 530 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 531 | 0 | decimal_to_string(from.value, scale_from), | 532 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 533 | 0 | precision_to, scale_to); | 534 | 0 | } | 535 | 0 | return false; | 536 | 0 | } | 537 | 0 | } | 538 | 0 | to = ToCppT(res); | 539 | | } else { | 540 | | if constexpr (IsDecimal128V2<FromCppT>) { | 541 | | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 542 | | } else { | 543 | | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 544 | | } | 545 | | } | 546 | 0 | } | 547 | 0 | return true; | 548 | 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 | 478 | 288 | CastParameters& params) { | 479 | 288 | MaxNativeType res; | 480 | 288 | if (from >= FromCppT(0)) { | 481 | | if constexpr (narrow_integral) { | 482 | | if constexpr (IsDecimal128V2<FromCppT>) { | 483 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 484 | | if (UNLIKELY(res > max_result)) { | 485 | | if (params.is_strict) { | 486 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 487 | | decimal_to_string(from.value(), scale_from), | 488 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 489 | | precision_to, scale_to); | 490 | | } | 491 | | return false; | 492 | | } | 493 | | } else { | 494 | | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 495 | | if (UNLIKELY(res > max_result)) { | 496 | | if (params.is_strict) { | 497 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 498 | | decimal_to_string(from.value, scale_from), | 499 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 500 | | precision_to, scale_to); | 501 | | } | 502 | | return false; | 503 | | } | 504 | | } | 505 | | to = ToCppT(res); | 506 | 288 | } else { | 507 | | if constexpr (IsDecimal128V2<FromCppT>) { | 508 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 509 | 288 | } else { | 510 | 288 | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 511 | 288 | } | 512 | 288 | } | 513 | 288 | } else { | 514 | | if constexpr (narrow_integral) { | 515 | | if constexpr (IsDecimal128V2<FromCppT>) { | 516 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 517 | | if (UNLIKELY(res < -max_result)) { | 518 | | if (params.is_strict) { | 519 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 520 | | decimal_to_string(from.value(), scale_from), | 521 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 522 | | precision_to, scale_to); | 523 | | } | 524 | | return false; | 525 | | } | 526 | | } else { | 527 | | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 528 | | if (UNLIKELY(res < -max_result)) { | 529 | | if (params.is_strict) { | 530 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 531 | | decimal_to_string(from.value, scale_from), | 532 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 533 | | precision_to, scale_to); | 534 | | } | 535 | | return false; | 536 | | } | 537 | | } | 538 | | to = ToCppT(res); | 539 | 0 | } else { | 540 | | if constexpr (IsDecimal128V2<FromCppT>) { | 541 | | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 542 | 0 | } else { | 543 | 0 | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 544 | 0 | } | 545 | 0 | } | 546 | 0 | } | 547 | 288 | return true; | 548 | 288 | } |
_ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_7DecimalIN4wide7integerILm256EiEEEENS_12Decimal128V3ELb0ELb1ES5_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS9_jjRS8_jjRKT3_RKNS8_10NativeTypeESI_RNS_14CastParametersE Line | Count | Source | 478 | 350 | CastParameters& params) { | 479 | 350 | MaxNativeType res; | 480 | 350 | if (from >= FromCppT(0)) { | 481 | 350 | if constexpr (narrow_integral) { | 482 | | if constexpr (IsDecimal128V2<FromCppT>) { | 483 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 484 | | if (UNLIKELY(res > max_result)) { | 485 | | if (params.is_strict) { | 486 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 487 | | decimal_to_string(from.value(), scale_from), | 488 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 489 | | precision_to, scale_to); | 490 | | } | 491 | | return false; | 492 | | } | 493 | 350 | } else { | 494 | 350 | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 495 | 350 | if (UNLIKELY(res > max_result)) { | 496 | 132 | if (params.is_strict) { | 497 | 66 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 498 | 66 | decimal_to_string(from.value, scale_from), | 499 | 66 | fmt::format("decimal({}, {})", precision_from, scale_from), | 500 | 66 | precision_to, scale_to); | 501 | 66 | } | 502 | 132 | return false; | 503 | 132 | } | 504 | 350 | } | 505 | 218 | to = ToCppT(res); | 506 | | } else { | 507 | | if constexpr (IsDecimal128V2<FromCppT>) { | 508 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 509 | | } else { | 510 | | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 511 | | } | 512 | | } | 513 | 350 | } else { | 514 | 0 | if constexpr (narrow_integral) { | 515 | | if constexpr (IsDecimal128V2<FromCppT>) { | 516 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 517 | | if (UNLIKELY(res < -max_result)) { | 518 | | if (params.is_strict) { | 519 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 520 | | decimal_to_string(from.value(), scale_from), | 521 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 522 | | precision_to, scale_to); | 523 | | } | 524 | | return false; | 525 | | } | 526 | 0 | } else { | 527 | 0 | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 528 | 0 | if (UNLIKELY(res < -max_result)) { | 529 | 0 | if (params.is_strict) { | 530 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 531 | 0 | decimal_to_string(from.value, scale_from), | 532 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 533 | 0 | precision_to, scale_to); | 534 | 0 | } | 535 | 0 | return false; | 536 | 0 | } | 537 | 0 | } | 538 | 0 | to = ToCppT(res); | 539 | | } else { | 540 | | if constexpr (IsDecimal128V2<FromCppT>) { | 541 | | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 542 | | } else { | 543 | | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 544 | | } | 545 | | } | 546 | 0 | } | 547 | 0 | return true; | 548 | 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 | 478 | 184 | CastParameters& params) { | 479 | 184 | MaxNativeType res; | 480 | 184 | if (from >= FromCppT(0)) { | 481 | | if constexpr (narrow_integral) { | 482 | | if constexpr (IsDecimal128V2<FromCppT>) { | 483 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 484 | | if (UNLIKELY(res > max_result)) { | 485 | | if (params.is_strict) { | 486 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 487 | | decimal_to_string(from.value(), scale_from), | 488 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 489 | | precision_to, scale_to); | 490 | | } | 491 | | return false; | 492 | | } | 493 | | } else { | 494 | | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 495 | | if (UNLIKELY(res > max_result)) { | 496 | | if (params.is_strict) { | 497 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 498 | | decimal_to_string(from.value, scale_from), | 499 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 500 | | precision_to, scale_to); | 501 | | } | 502 | | return false; | 503 | | } | 504 | | } | 505 | | to = ToCppT(res); | 506 | 184 | } else { | 507 | | if constexpr (IsDecimal128V2<FromCppT>) { | 508 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 509 | 184 | } else { | 510 | 184 | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 511 | 184 | } | 512 | 184 | } | 513 | 184 | } else { | 514 | | if constexpr (narrow_integral) { | 515 | | if constexpr (IsDecimal128V2<FromCppT>) { | 516 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 517 | | if (UNLIKELY(res < -max_result)) { | 518 | | if (params.is_strict) { | 519 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 520 | | decimal_to_string(from.value(), scale_from), | 521 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 522 | | precision_to, scale_to); | 523 | | } | 524 | | return false; | 525 | | } | 526 | | } else { | 527 | | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 528 | | if (UNLIKELY(res < -max_result)) { | 529 | | if (params.is_strict) { | 530 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 531 | | decimal_to_string(from.value, scale_from), | 532 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 533 | | precision_to, scale_to); | 534 | | } | 535 | | return false; | 536 | | } | 537 | | } | 538 | | to = ToCppT(res); | 539 | 0 | } else { | 540 | | if constexpr (IsDecimal128V2<FromCppT>) { | 541 | | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 542 | 0 | } else { | 543 | 0 | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 544 | 0 | } | 545 | 0 | } | 546 | 0 | } | 547 | 184 | return true; | 548 | 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 | 478 | 352 | CastParameters& params) { | 479 | 352 | MaxNativeType res; | 480 | 352 | if (from >= FromCppT(0)) { | 481 | | if constexpr (narrow_integral) { | 482 | | if constexpr (IsDecimal128V2<FromCppT>) { | 483 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 484 | | if (UNLIKELY(res > max_result)) { | 485 | | if (params.is_strict) { | 486 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 487 | | decimal_to_string(from.value(), scale_from), | 488 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 489 | | precision_to, scale_to); | 490 | | } | 491 | | return false; | 492 | | } | 493 | | } else { | 494 | | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 495 | | if (UNLIKELY(res > max_result)) { | 496 | | if (params.is_strict) { | 497 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 498 | | decimal_to_string(from.value, scale_from), | 499 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 500 | | precision_to, scale_to); | 501 | | } | 502 | | return false; | 503 | | } | 504 | | } | 505 | | to = ToCppT(res); | 506 | 352 | } else { | 507 | | if constexpr (IsDecimal128V2<FromCppT>) { | 508 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 509 | 352 | } else { | 510 | 352 | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 511 | 352 | } | 512 | 352 | } | 513 | 352 | } else { | 514 | | if constexpr (narrow_integral) { | 515 | | if constexpr (IsDecimal128V2<FromCppT>) { | 516 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 517 | | if (UNLIKELY(res < -max_result)) { | 518 | | if (params.is_strict) { | 519 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 520 | | decimal_to_string(from.value(), scale_from), | 521 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 522 | | precision_to, scale_to); | 523 | | } | 524 | | return false; | 525 | | } | 526 | | } else { | 527 | | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 528 | | if (UNLIKELY(res < -max_result)) { | 529 | | if (params.is_strict) { | 530 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 531 | | decimal_to_string(from.value, scale_from), | 532 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 533 | | precision_to, scale_to); | 534 | | } | 535 | | return false; | 536 | | } | 537 | | } | 538 | | to = ToCppT(res); | 539 | 0 | } else { | 540 | | if constexpr (IsDecimal128V2<FromCppT>) { | 541 | | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 542 | 0 | } else { | 543 | 0 | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 544 | 0 | } | 545 | 0 | } | 546 | 0 | } | 547 | 352 | return true; | 548 | 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 | 478 | 352 | CastParameters& params) { | 479 | 352 | MaxNativeType res; | 480 | 352 | if (from >= FromCppT(0)) { | 481 | | if constexpr (narrow_integral) { | 482 | | if constexpr (IsDecimal128V2<FromCppT>) { | 483 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 484 | | if (UNLIKELY(res > max_result)) { | 485 | | if (params.is_strict) { | 486 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 487 | | decimal_to_string(from.value(), scale_from), | 488 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 489 | | precision_to, scale_to); | 490 | | } | 491 | | return false; | 492 | | } | 493 | | } else { | 494 | | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 495 | | if (UNLIKELY(res > max_result)) { | 496 | | if (params.is_strict) { | 497 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 498 | | decimal_to_string(from.value, scale_from), | 499 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 500 | | precision_to, scale_to); | 501 | | } | 502 | | return false; | 503 | | } | 504 | | } | 505 | | to = ToCppT(res); | 506 | 352 | } else { | 507 | | if constexpr (IsDecimal128V2<FromCppT>) { | 508 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 509 | 352 | } else { | 510 | 352 | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 511 | 352 | } | 512 | 352 | } | 513 | 352 | } else { | 514 | | if constexpr (narrow_integral) { | 515 | | if constexpr (IsDecimal128V2<FromCppT>) { | 516 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 517 | | if (UNLIKELY(res < -max_result)) { | 518 | | if (params.is_strict) { | 519 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 520 | | decimal_to_string(from.value(), scale_from), | 521 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 522 | | precision_to, scale_to); | 523 | | } | 524 | | return false; | 525 | | } | 526 | | } else { | 527 | | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 528 | | if (UNLIKELY(res < -max_result)) { | 529 | | if (params.is_strict) { | 530 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 531 | | decimal_to_string(from.value, scale_from), | 532 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 533 | | precision_to, scale_to); | 534 | | } | 535 | | return false; | 536 | | } | 537 | | } | 538 | | to = ToCppT(res); | 539 | 0 | } else { | 540 | | if constexpr (IsDecimal128V2<FromCppT>) { | 541 | | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 542 | 0 | } else { | 543 | 0 | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 544 | 0 | } | 545 | 0 | } | 546 | 0 | } | 547 | 352 | return true; | 548 | 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 | 478 | 352 | CastParameters& params) { | 479 | 352 | MaxNativeType res; | 480 | 352 | if (from >= FromCppT(0)) { | 481 | | if constexpr (narrow_integral) { | 482 | | if constexpr (IsDecimal128V2<FromCppT>) { | 483 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 484 | | if (UNLIKELY(res > max_result)) { | 485 | | if (params.is_strict) { | 486 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 487 | | decimal_to_string(from.value(), scale_from), | 488 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 489 | | precision_to, scale_to); | 490 | | } | 491 | | return false; | 492 | | } | 493 | | } else { | 494 | | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 495 | | if (UNLIKELY(res > max_result)) { | 496 | | if (params.is_strict) { | 497 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 498 | | decimal_to_string(from.value, scale_from), | 499 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 500 | | precision_to, scale_to); | 501 | | } | 502 | | return false; | 503 | | } | 504 | | } | 505 | | to = ToCppT(res); | 506 | 352 | } else { | 507 | | if constexpr (IsDecimal128V2<FromCppT>) { | 508 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 509 | 352 | } else { | 510 | 352 | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 511 | 352 | } | 512 | 352 | } | 513 | 352 | } else { | 514 | | if constexpr (narrow_integral) { | 515 | | if constexpr (IsDecimal128V2<FromCppT>) { | 516 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 517 | | if (UNLIKELY(res < -max_result)) { | 518 | | if (params.is_strict) { | 519 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 520 | | decimal_to_string(from.value(), scale_from), | 521 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 522 | | precision_to, scale_to); | 523 | | } | 524 | | return false; | 525 | | } | 526 | | } else { | 527 | | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 528 | | if (UNLIKELY(res < -max_result)) { | 529 | | if (params.is_strict) { | 530 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 531 | | decimal_to_string(from.value, scale_from), | 532 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 533 | | precision_to, scale_to); | 534 | | } | 535 | | return false; | 536 | | } | 537 | | } | 538 | | to = ToCppT(res); | 539 | 0 | } else { | 540 | | if constexpr (IsDecimal128V2<FromCppT>) { | 541 | | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 542 | 0 | } else { | 543 | 0 | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 544 | 0 | } | 545 | 0 | } | 546 | 0 | } | 547 | 352 | return true; | 548 | 352 | } |
_ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_7DecimalIN4wide7integerILm256EiEEEES6_Lb0ELb1ES5_Qaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS8_jjRS7_jjRKT3_RKNS7_10NativeTypeESH_RNS_14CastParametersE Line | Count | Source | 478 | 96 | CastParameters& params) { | 479 | 96 | MaxNativeType res; | 480 | 96 | if (from >= FromCppT(0)) { | 481 | 96 | if constexpr (narrow_integral) { | 482 | | if constexpr (IsDecimal128V2<FromCppT>) { | 483 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 484 | | if (UNLIKELY(res > max_result)) { | 485 | | if (params.is_strict) { | 486 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 487 | | decimal_to_string(from.value(), scale_from), | 488 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 489 | | precision_to, scale_to); | 490 | | } | 491 | | return false; | 492 | | } | 493 | 96 | } else { | 494 | 96 | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 495 | 96 | if (UNLIKELY(res > max_result)) { | 496 | 40 | if (params.is_strict) { | 497 | 20 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 498 | 20 | decimal_to_string(from.value, scale_from), | 499 | 20 | fmt::format("decimal({}, {})", precision_from, scale_from), | 500 | 20 | precision_to, scale_to); | 501 | 20 | } | 502 | 40 | return false; | 503 | 40 | } | 504 | 96 | } | 505 | 56 | to = ToCppT(res); | 506 | | } else { | 507 | | if constexpr (IsDecimal128V2<FromCppT>) { | 508 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 509 | | } else { | 510 | | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 511 | | } | 512 | | } | 513 | 96 | } else { | 514 | 0 | if constexpr (narrow_integral) { | 515 | | if constexpr (IsDecimal128V2<FromCppT>) { | 516 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 517 | | if (UNLIKELY(res < -max_result)) { | 518 | | if (params.is_strict) { | 519 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 520 | | decimal_to_string(from.value(), scale_from), | 521 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 522 | | precision_to, scale_to); | 523 | | } | 524 | | return false; | 525 | | } | 526 | 0 | } else { | 527 | 0 | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 528 | 0 | if (UNLIKELY(res < -max_result)) { | 529 | 0 | if (params.is_strict) { | 530 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 531 | 0 | decimal_to_string(from.value, scale_from), | 532 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 533 | 0 | precision_to, scale_to); | 534 | 0 | } | 535 | 0 | return false; | 536 | 0 | } | 537 | 0 | } | 538 | 0 | to = ToCppT(res); | 539 | | } else { | 540 | | if constexpr (IsDecimal128V2<FromCppT>) { | 541 | | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 542 | | } else { | 543 | | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 544 | | } | 545 | | } | 546 | 0 | } | 547 | 0 | return true; | 548 | 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 | 478 | 32 | CastParameters& params) { | 479 | 32 | MaxNativeType res; | 480 | 32 | if (from >= FromCppT(0)) { | 481 | | if constexpr (narrow_integral) { | 482 | | if constexpr (IsDecimal128V2<FromCppT>) { | 483 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 484 | | if (UNLIKELY(res > max_result)) { | 485 | | if (params.is_strict) { | 486 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 487 | | decimal_to_string(from.value(), scale_from), | 488 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 489 | | precision_to, scale_to); | 490 | | } | 491 | | return false; | 492 | | } | 493 | | } else { | 494 | | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 495 | | if (UNLIKELY(res > max_result)) { | 496 | | if (params.is_strict) { | 497 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 498 | | decimal_to_string(from.value, scale_from), | 499 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 500 | | precision_to, scale_to); | 501 | | } | 502 | | return false; | 503 | | } | 504 | | } | 505 | | to = ToCppT(res); | 506 | 32 | } else { | 507 | 32 | if constexpr (IsDecimal128V2<FromCppT>) { | 508 | 32 | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 509 | | } else { | 510 | | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 511 | | } | 512 | 32 | } | 513 | 32 | } else { | 514 | | if constexpr (narrow_integral) { | 515 | | if constexpr (IsDecimal128V2<FromCppT>) { | 516 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 517 | | if (UNLIKELY(res < -max_result)) { | 518 | | if (params.is_strict) { | 519 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 520 | | decimal_to_string(from.value(), scale_from), | 521 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 522 | | precision_to, scale_to); | 523 | | } | 524 | | return false; | 525 | | } | 526 | | } else { | 527 | | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 528 | | if (UNLIKELY(res < -max_result)) { | 529 | | if (params.is_strict) { | 530 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 531 | | decimal_to_string(from.value, scale_from), | 532 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 533 | | precision_to, scale_to); | 534 | | } | 535 | | return false; | 536 | | } | 537 | | } | 538 | | to = ToCppT(res); | 539 | 0 | } else { | 540 | 0 | if constexpr (IsDecimal128V2<FromCppT>) { | 541 | 0 | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 542 | | } else { | 543 | | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 544 | | } | 545 | 0 | } | 546 | 0 | } | 547 | 32 | return true; | 548 | 32 | } |
_ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_14DecimalV2ValueENS_7DecimalIiEELb0ELb1EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKT3_RKNS5_10NativeTypeESF_RNS_14CastParametersE Line | Count | Source | 478 | 435 | CastParameters& params) { | 479 | 435 | MaxNativeType res; | 480 | 435 | if (from >= FromCppT(0)) { | 481 | 435 | if constexpr (narrow_integral) { | 482 | 435 | if constexpr (IsDecimal128V2<FromCppT>) { | 483 | 435 | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 484 | 435 | if (UNLIKELY(res > max_result)) { | 485 | 156 | if (params.is_strict) { | 486 | 78 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 487 | 78 | decimal_to_string(from.value(), scale_from), | 488 | 78 | fmt::format("decimal({}, {})", precision_from, scale_from), | 489 | 78 | precision_to, scale_to); | 490 | 78 | } | 491 | 156 | return false; | 492 | 156 | } | 493 | | } else { | 494 | | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 495 | | if (UNLIKELY(res > max_result)) { | 496 | | if (params.is_strict) { | 497 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 498 | | decimal_to_string(from.value, scale_from), | 499 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 500 | | precision_to, scale_to); | 501 | | } | 502 | | return false; | 503 | | } | 504 | | } | 505 | 279 | to = ToCppT(res); | 506 | | } else { | 507 | | if constexpr (IsDecimal128V2<FromCppT>) { | 508 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 509 | | } else { | 510 | | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 511 | | } | 512 | | } | 513 | 435 | } else { | 514 | 0 | if constexpr (narrow_integral) { | 515 | 0 | if constexpr (IsDecimal128V2<FromCppT>) { | 516 | 0 | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 517 | 0 | if (UNLIKELY(res < -max_result)) { | 518 | 0 | if (params.is_strict) { | 519 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 520 | 0 | decimal_to_string(from.value(), scale_from), | 521 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 522 | 0 | precision_to, scale_to); | 523 | 0 | } | 524 | 0 | return false; | 525 | 0 | } | 526 | | } else { | 527 | | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 528 | | if (UNLIKELY(res < -max_result)) { | 529 | | if (params.is_strict) { | 530 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 531 | | decimal_to_string(from.value, scale_from), | 532 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 533 | | precision_to, scale_to); | 534 | | } | 535 | | return false; | 536 | | } | 537 | | } | 538 | 0 | to = ToCppT(res); | 539 | | } else { | 540 | | if constexpr (IsDecimal128V2<FromCppT>) { | 541 | | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 542 | | } else { | 543 | | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 544 | | } | 545 | | } | 546 | 0 | } | 547 | 0 | return true; | 548 | 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 | 478 | 124 | CastParameters& params) { | 479 | 124 | MaxNativeType res; | 480 | 124 | if (from >= FromCppT(0)) { | 481 | | if constexpr (narrow_integral) { | 482 | | if constexpr (IsDecimal128V2<FromCppT>) { | 483 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 484 | | if (UNLIKELY(res > max_result)) { | 485 | | if (params.is_strict) { | 486 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 487 | | decimal_to_string(from.value(), scale_from), | 488 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 489 | | precision_to, scale_to); | 490 | | } | 491 | | return false; | 492 | | } | 493 | | } else { | 494 | | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 495 | | if (UNLIKELY(res > max_result)) { | 496 | | if (params.is_strict) { | 497 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 498 | | decimal_to_string(from.value, scale_from), | 499 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 500 | | precision_to, scale_to); | 501 | | } | 502 | | return false; | 503 | | } | 504 | | } | 505 | | to = ToCppT(res); | 506 | 124 | } else { | 507 | 124 | if constexpr (IsDecimal128V2<FromCppT>) { | 508 | 124 | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 509 | | } else { | 510 | | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 511 | | } | 512 | 124 | } | 513 | 124 | } else { | 514 | | if constexpr (narrow_integral) { | 515 | | if constexpr (IsDecimal128V2<FromCppT>) { | 516 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 517 | | if (UNLIKELY(res < -max_result)) { | 518 | | if (params.is_strict) { | 519 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 520 | | decimal_to_string(from.value(), scale_from), | 521 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 522 | | precision_to, scale_to); | 523 | | } | 524 | | return false; | 525 | | } | 526 | | } else { | 527 | | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 528 | | if (UNLIKELY(res < -max_result)) { | 529 | | if (params.is_strict) { | 530 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 531 | | decimal_to_string(from.value, scale_from), | 532 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 533 | | precision_to, scale_to); | 534 | | } | 535 | | return false; | 536 | | } | 537 | | } | 538 | | to = ToCppT(res); | 539 | 0 | } else { | 540 | 0 | if constexpr (IsDecimal128V2<FromCppT>) { | 541 | 0 | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 542 | | } else { | 543 | | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 544 | | } | 545 | 0 | } | 546 | 0 | } | 547 | 124 | return true; | 548 | 124 | } |
_ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_14DecimalV2ValueENS_7DecimalIlEELb0ELb1EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS6_jjRS5_jjRKT3_RKNS5_10NativeTypeESF_RNS_14CastParametersE Line | Count | Source | 478 | 354 | CastParameters& params) { | 479 | 354 | MaxNativeType res; | 480 | 354 | if (from >= FromCppT(0)) { | 481 | 354 | if constexpr (narrow_integral) { | 482 | 354 | if constexpr (IsDecimal128V2<FromCppT>) { | 483 | 354 | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 484 | 354 | if (UNLIKELY(res > max_result)) { | 485 | 84 | if (params.is_strict) { | 486 | 42 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 487 | 42 | decimal_to_string(from.value(), scale_from), | 488 | 42 | fmt::format("decimal({}, {})", precision_from, scale_from), | 489 | 42 | precision_to, scale_to); | 490 | 42 | } | 491 | 84 | return false; | 492 | 84 | } | 493 | | } else { | 494 | | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 495 | | if (UNLIKELY(res > max_result)) { | 496 | | if (params.is_strict) { | 497 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 498 | | decimal_to_string(from.value, scale_from), | 499 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 500 | | precision_to, scale_to); | 501 | | } | 502 | | return false; | 503 | | } | 504 | | } | 505 | 270 | to = ToCppT(res); | 506 | | } else { | 507 | | if constexpr (IsDecimal128V2<FromCppT>) { | 508 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 509 | | } else { | 510 | | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 511 | | } | 512 | | } | 513 | 354 | } else { | 514 | 0 | if constexpr (narrow_integral) { | 515 | 0 | if constexpr (IsDecimal128V2<FromCppT>) { | 516 | 0 | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 517 | 0 | if (UNLIKELY(res < -max_result)) { | 518 | 0 | if (params.is_strict) { | 519 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 520 | 0 | decimal_to_string(from.value(), scale_from), | 521 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 522 | 0 | precision_to, scale_to); | 523 | 0 | } | 524 | 0 | return false; | 525 | 0 | } | 526 | | } else { | 527 | | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 528 | | if (UNLIKELY(res < -max_result)) { | 529 | | if (params.is_strict) { | 530 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 531 | | decimal_to_string(from.value, scale_from), | 532 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 533 | | precision_to, scale_to); | 534 | | } | 535 | | return false; | 536 | | } | 537 | | } | 538 | 0 | to = ToCppT(res); | 539 | | } else { | 540 | | if constexpr (IsDecimal128V2<FromCppT>) { | 541 | | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 542 | | } else { | 543 | | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 544 | | } | 545 | | } | 546 | 0 | } | 547 | 0 | return true; | 548 | 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 | 478 | 364 | CastParameters& params) { | 479 | 364 | MaxNativeType res; | 480 | 364 | if (from >= FromCppT(0)) { | 481 | | if constexpr (narrow_integral) { | 482 | | if constexpr (IsDecimal128V2<FromCppT>) { | 483 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 484 | | if (UNLIKELY(res > max_result)) { | 485 | | if (params.is_strict) { | 486 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 487 | | decimal_to_string(from.value(), scale_from), | 488 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 489 | | precision_to, scale_to); | 490 | | } | 491 | | return false; | 492 | | } | 493 | | } else { | 494 | | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 495 | | if (UNLIKELY(res > max_result)) { | 496 | | if (params.is_strict) { | 497 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 498 | | decimal_to_string(from.value, scale_from), | 499 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 500 | | precision_to, scale_to); | 501 | | } | 502 | | return false; | 503 | | } | 504 | | } | 505 | | to = ToCppT(res); | 506 | 364 | } else { | 507 | 364 | if constexpr (IsDecimal128V2<FromCppT>) { | 508 | 364 | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 509 | | } else { | 510 | | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 511 | | } | 512 | 364 | } | 513 | 364 | } else { | 514 | | if constexpr (narrow_integral) { | 515 | | if constexpr (IsDecimal128V2<FromCppT>) { | 516 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 517 | | if (UNLIKELY(res < -max_result)) { | 518 | | if (params.is_strict) { | 519 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 520 | | decimal_to_string(from.value(), scale_from), | 521 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 522 | | precision_to, scale_to); | 523 | | } | 524 | | return false; | 525 | | } | 526 | | } else { | 527 | | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 528 | | if (UNLIKELY(res < -max_result)) { | 529 | | if (params.is_strict) { | 530 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 531 | | decimal_to_string(from.value, scale_from), | 532 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 533 | | precision_to, scale_to); | 534 | | } | 535 | | return false; | 536 | | } | 537 | | } | 538 | | to = ToCppT(res); | 539 | 0 | } else { | 540 | 0 | if constexpr (IsDecimal128V2<FromCppT>) { | 541 | 0 | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 542 | | } else { | 543 | | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 544 | | } | 545 | 0 | } | 546 | 0 | } | 547 | 364 | return true; | 548 | 364 | } |
_ZN5doris13CastToDecimal26_from_decimal_bigger_scaleINS_14DecimalV2ValueENS_12Decimal128V3ELb0ELb1EnQaa15IsDecimalNumberIT0_E15IsDecimalNumberIT_EEEbRKS5_jjRS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 478 | 50 | CastParameters& params) { | 479 | 50 | MaxNativeType res; | 480 | 50 | if (from >= FromCppT(0)) { | 481 | 50 | if constexpr (narrow_integral) { | 482 | 50 | if constexpr (IsDecimal128V2<FromCppT>) { | 483 | 50 | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 484 | 50 | if (UNLIKELY(res > max_result)) { | 485 | 4 | if (params.is_strict) { | 486 | 2 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 487 | 2 | decimal_to_string(from.value(), scale_from), | 488 | 2 | fmt::format("decimal({}, {})", precision_from, scale_from), | 489 | 2 | precision_to, scale_to); | 490 | 2 | } | 491 | 4 | return false; | 492 | 4 | } | 493 | | } else { | 494 | | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 495 | | if (UNLIKELY(res > max_result)) { | 496 | | if (params.is_strict) { | 497 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 498 | | decimal_to_string(from.value, scale_from), | 499 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 500 | | precision_to, scale_to); | 501 | | } | 502 | | return false; | 503 | | } | 504 | | } | 505 | 46 | to = ToCppT(res); | 506 | | } else { | 507 | | if constexpr (IsDecimal128V2<FromCppT>) { | 508 | | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 509 | | } else { | 510 | | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 511 | | } | 512 | | } | 513 | 50 | } else { | 514 | 0 | if constexpr (narrow_integral) { | 515 | 0 | if constexpr (IsDecimal128V2<FromCppT>) { | 516 | 0 | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 517 | 0 | if (UNLIKELY(res < -max_result)) { | 518 | 0 | if (params.is_strict) { | 519 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 520 | 0 | decimal_to_string(from.value(), scale_from), | 521 | 0 | fmt::format("decimal({}, {})", precision_from, scale_from), | 522 | 0 | precision_to, scale_to); | 523 | 0 | } | 524 | 0 | return false; | 525 | 0 | } | 526 | | } else { | 527 | | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 528 | | if (UNLIKELY(res < -max_result)) { | 529 | | if (params.is_strict) { | 530 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 531 | | decimal_to_string(from.value, scale_from), | 532 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 533 | | precision_to, scale_to); | 534 | | } | 535 | | return false; | 536 | | } | 537 | | } | 538 | 0 | to = ToCppT(res); | 539 | | } else { | 540 | | if constexpr (IsDecimal128V2<FromCppT>) { | 541 | | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 542 | | } else { | 543 | | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 544 | | } | 545 | | } | 546 | 0 | } | 547 | 0 | return true; | 548 | 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 | 478 | 412 | CastParameters& params) { | 479 | 412 | MaxNativeType res; | 480 | 412 | if (from >= FromCppT(0)) { | 481 | | if constexpr (narrow_integral) { | 482 | | if constexpr (IsDecimal128V2<FromCppT>) { | 483 | | res = (from.value() + scale_multiplier / 2) / scale_multiplier; | 484 | | if (UNLIKELY(res > max_result)) { | 485 | | if (params.is_strict) { | 486 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 487 | | decimal_to_string(from.value(), scale_from), | 488 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 489 | | precision_to, scale_to); | 490 | | } | 491 | | return false; | 492 | | } | 493 | | } else { | 494 | | res = (from.value + scale_multiplier / 2) / scale_multiplier; | 495 | | if (UNLIKELY(res > max_result)) { | 496 | | if (params.is_strict) { | 497 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 498 | | decimal_to_string(from.value, scale_from), | 499 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 500 | | precision_to, scale_to); | 501 | | } | 502 | | return false; | 503 | | } | 504 | | } | 505 | | to = ToCppT(res); | 506 | 412 | } else { | 507 | 412 | if constexpr (IsDecimal128V2<FromCppT>) { | 508 | 412 | to = ToCppT((from.value() + scale_multiplier / 2) / scale_multiplier); | 509 | | } else { | 510 | | to = ToCppT((from.value + scale_multiplier / 2) / scale_multiplier); | 511 | | } | 512 | 412 | } | 513 | 412 | } else { | 514 | | if constexpr (narrow_integral) { | 515 | | if constexpr (IsDecimal128V2<FromCppT>) { | 516 | | res = (from.value() - scale_multiplier / 2) / scale_multiplier; | 517 | | if (UNLIKELY(res < -max_result)) { | 518 | | if (params.is_strict) { | 519 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 520 | | decimal_to_string(from.value(), scale_from), | 521 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 522 | | precision_to, scale_to); | 523 | | } | 524 | | return false; | 525 | | } | 526 | | } else { | 527 | | res = (from.value - scale_multiplier / 2) / scale_multiplier; | 528 | | if (UNLIKELY(res < -max_result)) { | 529 | | if (params.is_strict) { | 530 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 531 | | decimal_to_string(from.value, scale_from), | 532 | | fmt::format("decimal({}, {})", precision_from, scale_from), | 533 | | precision_to, scale_to); | 534 | | } | 535 | | return false; | 536 | | } | 537 | | } | 538 | | to = ToCppT(res); | 539 | 0 | } else { | 540 | 0 | if constexpr (IsDecimal128V2<FromCppT>) { | 541 | 0 | to = ToCppT((from.value() - scale_multiplier / 2) / scale_multiplier); | 542 | | } else { | 543 | | to = ToCppT((from.value - scale_multiplier / 2) / scale_multiplier); | 544 | | } | 545 | 0 | } | 546 | 0 | } | 547 | 412 | return true; | 548 | 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 |
549 | | |
550 | | template <typename FromCppT, typename ToCppT, bool multiply_may_overflow, bool narrow_integral, |
551 | | typename MaxNativeType = |
552 | | std::conditional_t<(sizeof(FromCppT) > sizeof(typename ToCppT::NativeType)), |
553 | | FromCppT, typename ToCppT::NativeType>> |
554 | | requires(IsDecimalNumber<ToCppT> && !IsDecimal128V2<ToCppT> && |
555 | | (IsCppTypeInt<FromCppT> || std::is_same_v<FromCppT, UInt8>)) |
556 | | static inline bool _from_int(const FromCppT& from, ToCppT& to, UInt32 precision, UInt32 scale, |
557 | | const MaxNativeType& scale_multiplier, |
558 | | const typename ToCppT::NativeType& min_result, |
559 | | const typename ToCppT::NativeType& max_result, |
560 | 3.33k | CastParameters& params) { |
561 | 3.33k | MaxNativeType tmp; |
562 | 3.33k | if constexpr (multiply_may_overflow) { |
563 | 1.05k | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { |
564 | 154 | if (params.is_strict) { |
565 | 76 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, |
566 | 76 | precision, scale); |
567 | 76 | } |
568 | 154 | return false; |
569 | 154 | } |
570 | 901 | if constexpr (narrow_integral) { |
571 | 901 | if (tmp < min_result || tmp > max_result) { |
572 | 177 | if (params.is_strict) { |
573 | 88 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( |
574 | 88 | from, int_type_name<FromCppT>, precision, scale); |
575 | 88 | } |
576 | 177 | return false; |
577 | 177 | } |
578 | 901 | } |
579 | 724 | to.value = static_cast<typename ToCppT::NativeType>(tmp); |
580 | 2.28k | } else { |
581 | 2.28k | tmp = scale_multiplier * from; |
582 | 2.28k | if constexpr (narrow_integral) { |
583 | 1.42k | if (tmp < min_result || tmp > max_result) { |
584 | 433 | if (params.is_strict) { |
585 | 216 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( |
586 | 216 | from, int_type_name<FromCppT>, precision, scale); |
587 | 216 | } |
588 | 433 | return false; |
589 | 433 | } |
590 | 1.42k | } |
591 | 988 | to.value = static_cast<typename ToCppT::NativeType>(tmp); |
592 | 2.28k | } |
593 | | |
594 | 0 | return true; |
595 | 3.33k | } _ZN5doris13CastToDecimal9_from_intIhNS_7DecimalIiEELb0ELb0EiQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS4_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 560 | 10 | CastParameters& params) { | 561 | 10 | MaxNativeType tmp; | 562 | | if constexpr (multiply_may_overflow) { | 563 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | | if (params.is_strict) { | 565 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | | precision, scale); | 567 | | } | 568 | | return false; | 569 | | } | 570 | | if constexpr (narrow_integral) { | 571 | | if (tmp < min_result || tmp > max_result) { | 572 | | if (params.is_strict) { | 573 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | | from, int_type_name<FromCppT>, precision, scale); | 575 | | } | 576 | | return false; | 577 | | } | 578 | | } | 579 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | 10 | } else { | 581 | 10 | tmp = scale_multiplier * from; | 582 | | if constexpr (narrow_integral) { | 583 | | if (tmp < min_result || tmp > max_result) { | 584 | | if (params.is_strict) { | 585 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | | from, int_type_name<FromCppT>, precision, scale); | 587 | | } | 588 | | return false; | 589 | | } | 590 | | } | 591 | 10 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | 10 | } | 593 | | | 594 | 10 | return true; | 595 | 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 | 560 | 4 | CastParameters& params) { | 561 | 4 | MaxNativeType tmp; | 562 | 4 | if constexpr (multiply_may_overflow) { | 563 | 4 | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | 0 | if (params.is_strict) { | 565 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | 0 | precision, scale); | 567 | 0 | } | 568 | 0 | return false; | 569 | 0 | } | 570 | 4 | if constexpr (narrow_integral) { | 571 | 4 | if (tmp < min_result || tmp > max_result) { | 572 | 2 | if (params.is_strict) { | 573 | 1 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | 1 | from, int_type_name<FromCppT>, precision, scale); | 575 | 1 | } | 576 | 2 | return false; | 577 | 2 | } | 578 | 4 | } | 579 | 2 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | | } else { | 581 | | tmp = scale_multiplier * from; | 582 | | if constexpr (narrow_integral) { | 583 | | if (tmp < min_result || tmp > max_result) { | 584 | | if (params.is_strict) { | 585 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | | from, int_type_name<FromCppT>, precision, scale); | 587 | | } | 588 | | return false; | 589 | | } | 590 | | } | 591 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | | } | 593 | | | 594 | 0 | return true; | 595 | 4 | } |
_ZN5doris13CastToDecimal9_from_intIaNS_7DecimalIiEELb0ELb0EiQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS4_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 560 | 55 | CastParameters& params) { | 561 | 55 | MaxNativeType tmp; | 562 | | if constexpr (multiply_may_overflow) { | 563 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | | if (params.is_strict) { | 565 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | | precision, scale); | 567 | | } | 568 | | return false; | 569 | | } | 570 | | if constexpr (narrow_integral) { | 571 | | if (tmp < min_result || tmp > max_result) { | 572 | | if (params.is_strict) { | 573 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | | from, int_type_name<FromCppT>, precision, scale); | 575 | | } | 576 | | return false; | 577 | | } | 578 | | } | 579 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | 55 | } else { | 581 | 55 | tmp = scale_multiplier * from; | 582 | | if constexpr (narrow_integral) { | 583 | | if (tmp < min_result || tmp > max_result) { | 584 | | if (params.is_strict) { | 585 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | | from, int_type_name<FromCppT>, precision, scale); | 587 | | } | 588 | | return false; | 589 | | } | 590 | | } | 591 | 55 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | 55 | } | 593 | | | 594 | 55 | return true; | 595 | 55 | } |
_ZN5doris13CastToDecimal9_from_intIaNS_7DecimalIiEELb0ELb1EiQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS4_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 560 | 74 | CastParameters& params) { | 561 | 74 | MaxNativeType tmp; | 562 | | if constexpr (multiply_may_overflow) { | 563 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | | if (params.is_strict) { | 565 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | | precision, scale); | 567 | | } | 568 | | return false; | 569 | | } | 570 | | if constexpr (narrow_integral) { | 571 | | if (tmp < min_result || tmp > max_result) { | 572 | | if (params.is_strict) { | 573 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | | from, int_type_name<FromCppT>, precision, scale); | 575 | | } | 576 | | return false; | 577 | | } | 578 | | } | 579 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | 74 | } else { | 581 | 74 | tmp = scale_multiplier * from; | 582 | 74 | if constexpr (narrow_integral) { | 583 | 74 | if (tmp < min_result || tmp > max_result) { | 584 | 24 | if (params.is_strict) { | 585 | 12 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | 12 | from, int_type_name<FromCppT>, precision, scale); | 587 | 12 | } | 588 | 24 | return false; | 589 | 24 | } | 590 | 74 | } | 591 | 50 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | 74 | } | 593 | | | 594 | 0 | return true; | 595 | 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 | 560 | 22 | CastParameters& params) { | 561 | 22 | MaxNativeType tmp; | 562 | 22 | if constexpr (multiply_may_overflow) { | 563 | 22 | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | 4 | if (params.is_strict) { | 565 | 2 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | 2 | precision, scale); | 567 | 2 | } | 568 | 4 | return false; | 569 | 4 | } | 570 | 18 | if constexpr (narrow_integral) { | 571 | 18 | if (tmp < min_result || tmp > max_result) { | 572 | 4 | if (params.is_strict) { | 573 | 2 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | 2 | from, int_type_name<FromCppT>, precision, scale); | 575 | 2 | } | 576 | 4 | return false; | 577 | 4 | } | 578 | 18 | } | 579 | 14 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | | } else { | 581 | | tmp = scale_multiplier * from; | 582 | | if constexpr (narrow_integral) { | 583 | | if (tmp < min_result || tmp > max_result) { | 584 | | if (params.is_strict) { | 585 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | | from, int_type_name<FromCppT>, precision, scale); | 587 | | } | 588 | | return false; | 589 | | } | 590 | | } | 591 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | | } | 593 | | | 594 | 0 | return true; | 595 | 22 | } |
_ZN5doris13CastToDecimal9_from_intIsNS_7DecimalIiEELb0ELb0EiQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS4_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 560 | 36 | CastParameters& params) { | 561 | 36 | MaxNativeType tmp; | 562 | | if constexpr (multiply_may_overflow) { | 563 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | | if (params.is_strict) { | 565 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | | precision, scale); | 567 | | } | 568 | | return false; | 569 | | } | 570 | | if constexpr (narrow_integral) { | 571 | | if (tmp < min_result || tmp > max_result) { | 572 | | if (params.is_strict) { | 573 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | | from, int_type_name<FromCppT>, precision, scale); | 575 | | } | 576 | | return false; | 577 | | } | 578 | | } | 579 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | 36 | } else { | 581 | 36 | tmp = scale_multiplier * from; | 582 | | if constexpr (narrow_integral) { | 583 | | if (tmp < min_result || tmp > max_result) { | 584 | | if (params.is_strict) { | 585 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | | from, int_type_name<FromCppT>, precision, scale); | 587 | | } | 588 | | return false; | 589 | | } | 590 | | } | 591 | 36 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | 36 | } | 593 | | | 594 | 36 | return true; | 595 | 36 | } |
_ZN5doris13CastToDecimal9_from_intIsNS_7DecimalIiEELb0ELb1EiQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS4_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 560 | 109 | CastParameters& params) { | 561 | 109 | MaxNativeType tmp; | 562 | | if constexpr (multiply_may_overflow) { | 563 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | | if (params.is_strict) { | 565 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | | precision, scale); | 567 | | } | 568 | | return false; | 569 | | } | 570 | | if constexpr (narrow_integral) { | 571 | | if (tmp < min_result || tmp > max_result) { | 572 | | if (params.is_strict) { | 573 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | | from, int_type_name<FromCppT>, precision, scale); | 575 | | } | 576 | | return false; | 577 | | } | 578 | | } | 579 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | 109 | } else { | 581 | 109 | tmp = scale_multiplier * from; | 582 | 109 | if constexpr (narrow_integral) { | 583 | 109 | if (tmp < min_result || tmp > max_result) { | 584 | 33 | if (params.is_strict) { | 585 | 16 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | 16 | from, int_type_name<FromCppT>, precision, scale); | 587 | 16 | } | 588 | 33 | return false; | 589 | 33 | } | 590 | 109 | } | 591 | 76 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | 109 | } | 593 | | | 594 | 0 | return true; | 595 | 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 | 560 | 22 | CastParameters& params) { | 561 | 22 | MaxNativeType tmp; | 562 | 22 | if constexpr (multiply_may_overflow) { | 563 | 22 | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | 4 | if (params.is_strict) { | 565 | 2 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | 2 | precision, scale); | 567 | 2 | } | 568 | 4 | return false; | 569 | 4 | } | 570 | 18 | if constexpr (narrow_integral) { | 571 | 18 | if (tmp < min_result || tmp > max_result) { | 572 | 4 | if (params.is_strict) { | 573 | 2 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | 2 | from, int_type_name<FromCppT>, precision, scale); | 575 | 2 | } | 576 | 4 | return false; | 577 | 4 | } | 578 | 18 | } | 579 | 14 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | | } else { | 581 | | tmp = scale_multiplier * from; | 582 | | if constexpr (narrow_integral) { | 583 | | if (tmp < min_result || tmp > max_result) { | 584 | | if (params.is_strict) { | 585 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | | from, int_type_name<FromCppT>, precision, scale); | 587 | | } | 588 | | return false; | 589 | | } | 590 | | } | 591 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | | } | 593 | | | 594 | 0 | return true; | 595 | 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 | 560 | 90 | CastParameters& params) { | 561 | 90 | MaxNativeType tmp; | 562 | | if constexpr (multiply_may_overflow) { | 563 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | | if (params.is_strict) { | 565 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | | precision, scale); | 567 | | } | 568 | | return false; | 569 | | } | 570 | | if constexpr (narrow_integral) { | 571 | | if (tmp < min_result || tmp > max_result) { | 572 | | if (params.is_strict) { | 573 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | | from, int_type_name<FromCppT>, precision, scale); | 575 | | } | 576 | | return false; | 577 | | } | 578 | | } | 579 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | 90 | } else { | 581 | 90 | tmp = scale_multiplier * from; | 582 | 90 | if constexpr (narrow_integral) { | 583 | 90 | if (tmp < min_result || tmp > max_result) { | 584 | 24 | if (params.is_strict) { | 585 | 12 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | 12 | from, int_type_name<FromCppT>, precision, scale); | 587 | 12 | } | 588 | 24 | return false; | 589 | 24 | } | 590 | 90 | } | 591 | 66 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | 90 | } | 593 | | | 594 | 0 | return true; | 595 | 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 | 560 | 109 | CastParameters& params) { | 561 | 109 | MaxNativeType tmp; | 562 | 109 | if constexpr (multiply_may_overflow) { | 563 | 109 | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | 17 | if (params.is_strict) { | 565 | 8 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | 8 | precision, scale); | 567 | 8 | } | 568 | 17 | return false; | 569 | 17 | } | 570 | 92 | if constexpr (narrow_integral) { | 571 | 92 | if (tmp < min_result || tmp > max_result) { | 572 | 16 | if (params.is_strict) { | 573 | 8 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | 8 | from, int_type_name<FromCppT>, precision, scale); | 575 | 8 | } | 576 | 16 | return false; | 577 | 16 | } | 578 | 92 | } | 579 | 76 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | | } else { | 581 | | tmp = scale_multiplier * from; | 582 | | if constexpr (narrow_integral) { | 583 | | if (tmp < min_result || tmp > max_result) { | 584 | | if (params.is_strict) { | 585 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | | from, int_type_name<FromCppT>, precision, scale); | 587 | | } | 588 | | return false; | 589 | | } | 590 | | } | 591 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | | } | 593 | | | 594 | 0 | return true; | 595 | 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 | 560 | 90 | CastParameters& params) { | 561 | 90 | MaxNativeType tmp; | 562 | | if constexpr (multiply_may_overflow) { | 563 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | | if (params.is_strict) { | 565 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | | precision, scale); | 567 | | } | 568 | | return false; | 569 | | } | 570 | | if constexpr (narrow_integral) { | 571 | | if (tmp < min_result || tmp > max_result) { | 572 | | if (params.is_strict) { | 573 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | | from, int_type_name<FromCppT>, precision, scale); | 575 | | } | 576 | | return false; | 577 | | } | 578 | | } | 579 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | 90 | } else { | 581 | 90 | tmp = scale_multiplier * from; | 582 | 90 | if constexpr (narrow_integral) { | 583 | 90 | if (tmp < min_result || tmp > max_result) { | 584 | 24 | if (params.is_strict) { | 585 | 12 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | 12 | from, int_type_name<FromCppT>, precision, scale); | 587 | 12 | } | 588 | 24 | return false; | 589 | 24 | } | 590 | 90 | } | 591 | 66 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | 90 | } | 593 | | | 594 | 0 | return true; | 595 | 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 | 560 | 109 | CastParameters& params) { | 561 | 109 | MaxNativeType tmp; | 562 | 109 | if constexpr (multiply_may_overflow) { | 563 | 109 | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | 17 | if (params.is_strict) { | 565 | 8 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | 8 | precision, scale); | 567 | 8 | } | 568 | 17 | return false; | 569 | 17 | } | 570 | 92 | if constexpr (narrow_integral) { | 571 | 92 | if (tmp < min_result || tmp > max_result) { | 572 | 16 | if (params.is_strict) { | 573 | 8 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | 8 | from, int_type_name<FromCppT>, precision, scale); | 575 | 8 | } | 576 | 16 | return false; | 577 | 16 | } | 578 | 92 | } | 579 | 76 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | | } else { | 581 | | tmp = scale_multiplier * from; | 582 | | if constexpr (narrow_integral) { | 583 | | if (tmp < min_result || tmp > max_result) { | 584 | | if (params.is_strict) { | 585 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | | from, int_type_name<FromCppT>, precision, scale); | 587 | | } | 588 | | return false; | 589 | | } | 590 | | } | 591 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | | } | 593 | | | 594 | 0 | return true; | 595 | 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 | 560 | 90 | CastParameters& params) { | 561 | 90 | MaxNativeType tmp; | 562 | | if constexpr (multiply_may_overflow) { | 563 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | | if (params.is_strict) { | 565 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | | precision, scale); | 567 | | } | 568 | | return false; | 569 | | } | 570 | | if constexpr (narrow_integral) { | 571 | | if (tmp < min_result || tmp > max_result) { | 572 | | if (params.is_strict) { | 573 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | | from, int_type_name<FromCppT>, precision, scale); | 575 | | } | 576 | | return false; | 577 | | } | 578 | | } | 579 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | 90 | } else { | 581 | 90 | tmp = scale_multiplier * from; | 582 | 90 | if constexpr (narrow_integral) { | 583 | 90 | if (tmp < min_result || tmp > max_result) { | 584 | 24 | if (params.is_strict) { | 585 | 12 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | 12 | from, int_type_name<FromCppT>, precision, scale); | 587 | 12 | } | 588 | 24 | return false; | 589 | 24 | } | 590 | 90 | } | 591 | 66 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | 90 | } | 593 | | | 594 | 0 | return true; | 595 | 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 | 560 | 109 | CastParameters& params) { | 561 | 109 | MaxNativeType tmp; | 562 | 109 | if constexpr (multiply_may_overflow) { | 563 | 109 | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | 16 | if (params.is_strict) { | 565 | 8 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | 8 | precision, scale); | 567 | 8 | } | 568 | 16 | return false; | 569 | 16 | } | 570 | 93 | if constexpr (narrow_integral) { | 571 | 93 | if (tmp < min_result || tmp > max_result) { | 572 | 17 | if (params.is_strict) { | 573 | 8 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | 8 | from, int_type_name<FromCppT>, precision, scale); | 575 | 8 | } | 576 | 17 | return false; | 577 | 17 | } | 578 | 93 | } | 579 | 76 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | | } else { | 581 | | tmp = scale_multiplier * from; | 582 | | if constexpr (narrow_integral) { | 583 | | if (tmp < min_result || tmp > max_result) { | 584 | | if (params.is_strict) { | 585 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | | from, int_type_name<FromCppT>, precision, scale); | 587 | | } | 588 | | return false; | 589 | | } | 590 | | } | 591 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | | } | 593 | | | 594 | 0 | return true; | 595 | 109 | } |
_ZN5doris13CastToDecimal9_from_intIhNS_7DecimalIlEELb0ELb0ElQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS4_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 560 | 8 | CastParameters& params) { | 561 | 8 | MaxNativeType tmp; | 562 | | if constexpr (multiply_may_overflow) { | 563 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | | if (params.is_strict) { | 565 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | | precision, scale); | 567 | | } | 568 | | return false; | 569 | | } | 570 | | if constexpr (narrow_integral) { | 571 | | if (tmp < min_result || tmp > max_result) { | 572 | | if (params.is_strict) { | 573 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | | from, int_type_name<FromCppT>, precision, scale); | 575 | | } | 576 | | return false; | 577 | | } | 578 | | } | 579 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | 8 | } else { | 581 | 8 | tmp = scale_multiplier * from; | 582 | | if constexpr (narrow_integral) { | 583 | | if (tmp < min_result || tmp > max_result) { | 584 | | if (params.is_strict) { | 585 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | | from, int_type_name<FromCppT>, precision, scale); | 587 | | } | 588 | | return false; | 589 | | } | 590 | | } | 591 | 8 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | 8 | } | 593 | | | 594 | 8 | return true; | 595 | 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 | 560 | 4 | CastParameters& params) { | 561 | 4 | MaxNativeType tmp; | 562 | 4 | if constexpr (multiply_may_overflow) { | 563 | 4 | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | 0 | if (params.is_strict) { | 565 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | 0 | precision, scale); | 567 | 0 | } | 568 | 0 | return false; | 569 | 0 | } | 570 | 4 | if constexpr (narrow_integral) { | 571 | 4 | if (tmp < min_result || tmp > max_result) { | 572 | 2 | if (params.is_strict) { | 573 | 1 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | 1 | from, int_type_name<FromCppT>, precision, scale); | 575 | 1 | } | 576 | 2 | return false; | 577 | 2 | } | 578 | 4 | } | 579 | 2 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | | } else { | 581 | | tmp = scale_multiplier * from; | 582 | | if constexpr (narrow_integral) { | 583 | | if (tmp < min_result || tmp > max_result) { | 584 | | if (params.is_strict) { | 585 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | | from, int_type_name<FromCppT>, precision, scale); | 587 | | } | 588 | | return false; | 589 | | } | 590 | | } | 591 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | | } | 593 | | | 594 | 0 | return true; | 595 | 4 | } |
_ZN5doris13CastToDecimal9_from_intIaNS_7DecimalIlEELb0ELb0ElQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS4_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 560 | 72 | CastParameters& params) { | 561 | 72 | MaxNativeType tmp; | 562 | | if constexpr (multiply_may_overflow) { | 563 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | | if (params.is_strict) { | 565 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | | precision, scale); | 567 | | } | 568 | | return false; | 569 | | } | 570 | | if constexpr (narrow_integral) { | 571 | | if (tmp < min_result || tmp > max_result) { | 572 | | if (params.is_strict) { | 573 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | | from, int_type_name<FromCppT>, precision, scale); | 575 | | } | 576 | | return false; | 577 | | } | 578 | | } | 579 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | 72 | } else { | 581 | 72 | tmp = scale_multiplier * from; | 582 | | if constexpr (narrow_integral) { | 583 | | if (tmp < min_result || tmp > max_result) { | 584 | | if (params.is_strict) { | 585 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | | from, int_type_name<FromCppT>, precision, scale); | 587 | | } | 588 | | return false; | 589 | | } | 590 | | } | 591 | 72 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | 72 | } | 593 | | | 594 | 72 | return true; | 595 | 72 | } |
_ZN5doris13CastToDecimal9_from_intIaNS_7DecimalIlEELb0ELb1ElQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS4_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 560 | 44 | CastParameters& params) { | 561 | 44 | MaxNativeType tmp; | 562 | | if constexpr (multiply_may_overflow) { | 563 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | | if (params.is_strict) { | 565 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | | precision, scale); | 567 | | } | 568 | | return false; | 569 | | } | 570 | | if constexpr (narrow_integral) { | 571 | | if (tmp < min_result || tmp > max_result) { | 572 | | if (params.is_strict) { | 573 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | | from, int_type_name<FromCppT>, precision, scale); | 575 | | } | 576 | | return false; | 577 | | } | 578 | | } | 579 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | 44 | } else { | 581 | 44 | tmp = scale_multiplier * from; | 582 | 44 | if constexpr (narrow_integral) { | 583 | 44 | if (tmp < min_result || tmp > max_result) { | 584 | 16 | if (params.is_strict) { | 585 | 8 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | 8 | from, int_type_name<FromCppT>, precision, scale); | 587 | 8 | } | 588 | 16 | return false; | 589 | 16 | } | 590 | 44 | } | 591 | 28 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | 44 | } | 593 | | | 594 | 0 | return true; | 595 | 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 | 560 | 22 | CastParameters& params) { | 561 | 22 | MaxNativeType tmp; | 562 | 22 | if constexpr (multiply_may_overflow) { | 563 | 22 | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | 4 | if (params.is_strict) { | 565 | 2 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | 2 | precision, scale); | 567 | 2 | } | 568 | 4 | return false; | 569 | 4 | } | 570 | 18 | if constexpr (narrow_integral) { | 571 | 18 | if (tmp < min_result || tmp > max_result) { | 572 | 4 | if (params.is_strict) { | 573 | 2 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | 2 | from, int_type_name<FromCppT>, precision, scale); | 575 | 2 | } | 576 | 4 | return false; | 577 | 4 | } | 578 | 18 | } | 579 | 14 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | | } else { | 581 | | tmp = scale_multiplier * from; | 582 | | if constexpr (narrow_integral) { | 583 | | if (tmp < min_result || tmp > max_result) { | 584 | | if (params.is_strict) { | 585 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | | from, int_type_name<FromCppT>, precision, scale); | 587 | | } | 588 | | return false; | 589 | | } | 590 | | } | 591 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | | } | 593 | | | 594 | 0 | return true; | 595 | 22 | } |
_ZN5doris13CastToDecimal9_from_intIsNS_7DecimalIlEELb0ELb0ElQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS4_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 560 | 72 | CastParameters& params) { | 561 | 72 | MaxNativeType tmp; | 562 | | if constexpr (multiply_may_overflow) { | 563 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | | if (params.is_strict) { | 565 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | | precision, scale); | 567 | | } | 568 | | return false; | 569 | | } | 570 | | if constexpr (narrow_integral) { | 571 | | if (tmp < min_result || tmp > max_result) { | 572 | | if (params.is_strict) { | 573 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | | from, int_type_name<FromCppT>, precision, scale); | 575 | | } | 576 | | return false; | 577 | | } | 578 | | } | 579 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | 72 | } else { | 581 | 72 | tmp = scale_multiplier * from; | 582 | | if constexpr (narrow_integral) { | 583 | | if (tmp < min_result || tmp > max_result) { | 584 | | if (params.is_strict) { | 585 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | | from, int_type_name<FromCppT>, precision, scale); | 587 | | } | 588 | | return false; | 589 | | } | 590 | | } | 591 | 72 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | 72 | } | 593 | | | 594 | 72 | return true; | 595 | 72 | } |
_ZN5doris13CastToDecimal9_from_intIsNS_7DecimalIlEELb0ELb1ElQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS4_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 560 | 44 | CastParameters& params) { | 561 | 44 | MaxNativeType tmp; | 562 | | if constexpr (multiply_may_overflow) { | 563 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | | if (params.is_strict) { | 565 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | | precision, scale); | 567 | | } | 568 | | return false; | 569 | | } | 570 | | if constexpr (narrow_integral) { | 571 | | if (tmp < min_result || tmp > max_result) { | 572 | | if (params.is_strict) { | 573 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | | from, int_type_name<FromCppT>, precision, scale); | 575 | | } | 576 | | return false; | 577 | | } | 578 | | } | 579 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | 44 | } else { | 581 | 44 | tmp = scale_multiplier * from; | 582 | 44 | if constexpr (narrow_integral) { | 583 | 44 | if (tmp < min_result || tmp > max_result) { | 584 | 16 | if (params.is_strict) { | 585 | 8 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | 8 | from, int_type_name<FromCppT>, precision, scale); | 587 | 8 | } | 588 | 16 | return false; | 589 | 16 | } | 590 | 44 | } | 591 | 28 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | 44 | } | 593 | | | 594 | 0 | return true; | 595 | 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 | 560 | 22 | CastParameters& params) { | 561 | 22 | MaxNativeType tmp; | 562 | 22 | if constexpr (multiply_may_overflow) { | 563 | 22 | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | 4 | if (params.is_strict) { | 565 | 2 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | 2 | precision, scale); | 567 | 2 | } | 568 | 4 | return false; | 569 | 4 | } | 570 | 18 | if constexpr (narrow_integral) { | 571 | 18 | if (tmp < min_result || tmp > max_result) { | 572 | 4 | if (params.is_strict) { | 573 | 2 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | 2 | from, int_type_name<FromCppT>, precision, scale); | 575 | 2 | } | 576 | 4 | return false; | 577 | 4 | } | 578 | 18 | } | 579 | 14 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | | } else { | 581 | | tmp = scale_multiplier * from; | 582 | | if constexpr (narrow_integral) { | 583 | | if (tmp < min_result || tmp > max_result) { | 584 | | if (params.is_strict) { | 585 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | | from, int_type_name<FromCppT>, precision, scale); | 587 | | } | 588 | | return false; | 589 | | } | 590 | | } | 591 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | | } | 593 | | | 594 | 0 | return true; | 595 | 22 | } |
_ZN5doris13CastToDecimal9_from_intIiNS_7DecimalIlEELb0ELb0ElQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS4_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 560 | 18 | CastParameters& params) { | 561 | 18 | MaxNativeType tmp; | 562 | | if constexpr (multiply_may_overflow) { | 563 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | | if (params.is_strict) { | 565 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | | precision, scale); | 567 | | } | 568 | | return false; | 569 | | } | 570 | | if constexpr (narrow_integral) { | 571 | | if (tmp < min_result || tmp > max_result) { | 572 | | if (params.is_strict) { | 573 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | | from, int_type_name<FromCppT>, precision, scale); | 575 | | } | 576 | | return false; | 577 | | } | 578 | | } | 579 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | 18 | } else { | 581 | 18 | tmp = scale_multiplier * from; | 582 | | if constexpr (narrow_integral) { | 583 | | if (tmp < min_result || tmp > max_result) { | 584 | | if (params.is_strict) { | 585 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | | from, int_type_name<FromCppT>, precision, scale); | 587 | | } | 588 | | return false; | 589 | | } | 590 | | } | 591 | 18 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | 18 | } | 593 | | | 594 | 18 | return true; | 595 | 18 | } |
_ZN5doris13CastToDecimal9_from_intIiNS_7DecimalIlEELb0ELb1ElQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS4_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 560 | 112 | CastParameters& params) { | 561 | 112 | MaxNativeType tmp; | 562 | | if constexpr (multiply_may_overflow) { | 563 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | | if (params.is_strict) { | 565 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | | precision, scale); | 567 | | } | 568 | | return false; | 569 | | } | 570 | | if constexpr (narrow_integral) { | 571 | | if (tmp < min_result || tmp > max_result) { | 572 | | if (params.is_strict) { | 573 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | | from, int_type_name<FromCppT>, precision, scale); | 575 | | } | 576 | | return false; | 577 | | } | 578 | | } | 579 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | 112 | } else { | 581 | 112 | tmp = scale_multiplier * from; | 582 | 112 | if constexpr (narrow_integral) { | 583 | 112 | if (tmp < min_result || tmp > max_result) { | 584 | 32 | if (params.is_strict) { | 585 | 16 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | 16 | from, int_type_name<FromCppT>, precision, scale); | 587 | 16 | } | 588 | 32 | return false; | 589 | 32 | } | 590 | 112 | } | 591 | 80 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | 112 | } | 593 | | | 594 | 0 | return true; | 595 | 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 | 560 | 56 | CastParameters& params) { | 561 | 56 | MaxNativeType tmp; | 562 | 56 | if constexpr (multiply_may_overflow) { | 563 | 56 | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | 4 | if (params.is_strict) { | 565 | 2 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | 2 | precision, scale); | 567 | 2 | } | 568 | 4 | return false; | 569 | 4 | } | 570 | 52 | if constexpr (narrow_integral) { | 571 | 52 | if (tmp < min_result || tmp > max_result) { | 572 | 12 | if (params.is_strict) { | 573 | 6 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | 6 | from, int_type_name<FromCppT>, precision, scale); | 575 | 6 | } | 576 | 12 | return false; | 577 | 12 | } | 578 | 52 | } | 579 | 40 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | | } else { | 581 | | tmp = scale_multiplier * from; | 582 | | if constexpr (narrow_integral) { | 583 | | if (tmp < min_result || tmp > max_result) { | 584 | | if (params.is_strict) { | 585 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | | from, int_type_name<FromCppT>, precision, scale); | 587 | | } | 588 | | return false; | 589 | | } | 590 | | } | 591 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | | } | 593 | | | 594 | 0 | return true; | 595 | 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 | 560 | 90 | CastParameters& params) { | 561 | 90 | MaxNativeType tmp; | 562 | | if constexpr (multiply_may_overflow) { | 563 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | | if (params.is_strict) { | 565 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | | precision, scale); | 567 | | } | 568 | | return false; | 569 | | } | 570 | | if constexpr (narrow_integral) { | 571 | | if (tmp < min_result || tmp > max_result) { | 572 | | if (params.is_strict) { | 573 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | | from, int_type_name<FromCppT>, precision, scale); | 575 | | } | 576 | | return false; | 577 | | } | 578 | | } | 579 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | 90 | } else { | 581 | 90 | tmp = scale_multiplier * from; | 582 | 90 | if constexpr (narrow_integral) { | 583 | 90 | if (tmp < min_result || tmp > max_result) { | 584 | 24 | if (params.is_strict) { | 585 | 12 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | 12 | from, int_type_name<FromCppT>, precision, scale); | 587 | 12 | } | 588 | 24 | return false; | 589 | 24 | } | 590 | 90 | } | 591 | 66 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | 90 | } | 593 | | | 594 | 0 | return true; | 595 | 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 | 560 | 112 | CastParameters& params) { | 561 | 112 | MaxNativeType tmp; | 562 | 112 | if constexpr (multiply_may_overflow) { | 563 | 112 | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | 16 | if (params.is_strict) { | 565 | 8 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | 8 | precision, scale); | 567 | 8 | } | 568 | 16 | return false; | 569 | 16 | } | 570 | 96 | if constexpr (narrow_integral) { | 571 | 96 | if (tmp < min_result || tmp > max_result) { | 572 | 16 | if (params.is_strict) { | 573 | 8 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | 8 | from, int_type_name<FromCppT>, precision, scale); | 575 | 8 | } | 576 | 16 | return false; | 577 | 16 | } | 578 | 96 | } | 579 | 80 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | | } else { | 581 | | tmp = scale_multiplier * from; | 582 | | if constexpr (narrow_integral) { | 583 | | if (tmp < min_result || tmp > max_result) { | 584 | | if (params.is_strict) { | 585 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | | from, int_type_name<FromCppT>, precision, scale); | 587 | | } | 588 | | return false; | 589 | | } | 590 | | } | 591 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | | } | 593 | | | 594 | 0 | return true; | 595 | 112 | } |
Unexecuted instantiation: _ZN5doris13CastToDecimal9_from_intInNS_7DecimalIlEELb0ELb0EnQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS4_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE _ZN5doris13CastToDecimal9_from_intInNS_7DecimalIlEELb0ELb1EnQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS4_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS5_hEEEbRKS5_RS4_jjRKT3_RKNS4_10NativeTypeESE_RNS_14CastParametersE Line | Count | Source | 560 | 90 | CastParameters& params) { | 561 | 90 | MaxNativeType tmp; | 562 | | if constexpr (multiply_may_overflow) { | 563 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | | if (params.is_strict) { | 565 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | | precision, scale); | 567 | | } | 568 | | return false; | 569 | | } | 570 | | if constexpr (narrow_integral) { | 571 | | if (tmp < min_result || tmp > max_result) { | 572 | | if (params.is_strict) { | 573 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | | from, int_type_name<FromCppT>, precision, scale); | 575 | | } | 576 | | return false; | 577 | | } | 578 | | } | 579 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | 90 | } else { | 581 | 90 | tmp = scale_multiplier * from; | 582 | 90 | if constexpr (narrow_integral) { | 583 | 90 | if (tmp < min_result || tmp > max_result) { | 584 | 24 | if (params.is_strict) { | 585 | 12 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | 12 | from, int_type_name<FromCppT>, precision, scale); | 587 | 12 | } | 588 | 24 | return false; | 589 | 24 | } | 590 | 90 | } | 591 | 66 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | 90 | } | 593 | | | 594 | 0 | return true; | 595 | 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 | 560 | 112 | CastParameters& params) { | 561 | 112 | MaxNativeType tmp; | 562 | 112 | if constexpr (multiply_may_overflow) { | 563 | 112 | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | 16 | if (params.is_strict) { | 565 | 8 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | 8 | precision, scale); | 567 | 8 | } | 568 | 16 | return false; | 569 | 16 | } | 570 | 96 | if constexpr (narrow_integral) { | 571 | 96 | if (tmp < min_result || tmp > max_result) { | 572 | 16 | if (params.is_strict) { | 573 | 8 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | 8 | from, int_type_name<FromCppT>, precision, scale); | 575 | 8 | } | 576 | 16 | return false; | 577 | 16 | } | 578 | 96 | } | 579 | 80 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | | } else { | 581 | | tmp = scale_multiplier * from; | 582 | | if constexpr (narrow_integral) { | 583 | | if (tmp < min_result || tmp > max_result) { | 584 | | if (params.is_strict) { | 585 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | | from, int_type_name<FromCppT>, precision, scale); | 587 | | } | 588 | | return false; | 589 | | } | 590 | | } | 591 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | | } | 593 | | | 594 | 0 | return true; | 595 | 112 | } |
_ZN5doris13CastToDecimal9_from_intIhNS_12Decimal128V3ELb0ELb0EnQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS3_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRKT3_RKNS3_10NativeTypeESD_RNS_14CastParametersE Line | Count | Source | 560 | 8 | CastParameters& params) { | 561 | 8 | MaxNativeType tmp; | 562 | | if constexpr (multiply_may_overflow) { | 563 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | | if (params.is_strict) { | 565 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | | precision, scale); | 567 | | } | 568 | | return false; | 569 | | } | 570 | | if constexpr (narrow_integral) { | 571 | | if (tmp < min_result || tmp > max_result) { | 572 | | if (params.is_strict) { | 573 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | | from, int_type_name<FromCppT>, precision, scale); | 575 | | } | 576 | | return false; | 577 | | } | 578 | | } | 579 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | 8 | } else { | 581 | 8 | tmp = scale_multiplier * from; | 582 | | if constexpr (narrow_integral) { | 583 | | if (tmp < min_result || tmp > max_result) { | 584 | | if (params.is_strict) { | 585 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | | from, int_type_name<FromCppT>, precision, scale); | 587 | | } | 588 | | return false; | 589 | | } | 590 | | } | 591 | 8 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | 8 | } | 593 | | | 594 | 8 | return true; | 595 | 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 | 560 | 4 | CastParameters& params) { | 561 | 4 | MaxNativeType tmp; | 562 | 4 | if constexpr (multiply_may_overflow) { | 563 | 4 | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | 0 | if (params.is_strict) { | 565 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | 0 | precision, scale); | 567 | 0 | } | 568 | 0 | return false; | 569 | 0 | } | 570 | 4 | if constexpr (narrow_integral) { | 571 | 4 | if (tmp < min_result || tmp > max_result) { | 572 | 2 | if (params.is_strict) { | 573 | 1 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | 1 | from, int_type_name<FromCppT>, precision, scale); | 575 | 1 | } | 576 | 2 | return false; | 577 | 2 | } | 578 | 4 | } | 579 | 2 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | | } else { | 581 | | tmp = scale_multiplier * from; | 582 | | if constexpr (narrow_integral) { | 583 | | if (tmp < min_result || tmp > max_result) { | 584 | | if (params.is_strict) { | 585 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | | from, int_type_name<FromCppT>, precision, scale); | 587 | | } | 588 | | return false; | 589 | | } | 590 | | } | 591 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | | } | 593 | | | 594 | 0 | return true; | 595 | 4 | } |
_ZN5doris13CastToDecimal9_from_intIaNS_12Decimal128V3ELb0ELb0EnQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS3_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRKT3_RKNS3_10NativeTypeESD_RNS_14CastParametersE Line | Count | Source | 560 | 72 | CastParameters& params) { | 561 | 72 | MaxNativeType tmp; | 562 | | if constexpr (multiply_may_overflow) { | 563 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | | if (params.is_strict) { | 565 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | | precision, scale); | 567 | | } | 568 | | return false; | 569 | | } | 570 | | if constexpr (narrow_integral) { | 571 | | if (tmp < min_result || tmp > max_result) { | 572 | | if (params.is_strict) { | 573 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | | from, int_type_name<FromCppT>, precision, scale); | 575 | | } | 576 | | return false; | 577 | | } | 578 | | } | 579 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | 72 | } else { | 581 | 72 | tmp = scale_multiplier * from; | 582 | | if constexpr (narrow_integral) { | 583 | | if (tmp < min_result || tmp > max_result) { | 584 | | if (params.is_strict) { | 585 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | | from, int_type_name<FromCppT>, precision, scale); | 587 | | } | 588 | | return false; | 589 | | } | 590 | | } | 591 | 72 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | 72 | } | 593 | | | 594 | 72 | return true; | 595 | 72 | } |
_ZN5doris13CastToDecimal9_from_intIaNS_12Decimal128V3ELb0ELb1EnQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS3_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRKT3_RKNS3_10NativeTypeESD_RNS_14CastParametersE Line | Count | Source | 560 | 44 | CastParameters& params) { | 561 | 44 | MaxNativeType tmp; | 562 | | if constexpr (multiply_may_overflow) { | 563 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | | if (params.is_strict) { | 565 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | | precision, scale); | 567 | | } | 568 | | return false; | 569 | | } | 570 | | if constexpr (narrow_integral) { | 571 | | if (tmp < min_result || tmp > max_result) { | 572 | | if (params.is_strict) { | 573 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | | from, int_type_name<FromCppT>, precision, scale); | 575 | | } | 576 | | return false; | 577 | | } | 578 | | } | 579 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | 44 | } else { | 581 | 44 | tmp = scale_multiplier * from; | 582 | 44 | if constexpr (narrow_integral) { | 583 | 44 | if (tmp < min_result || tmp > max_result) { | 584 | 16 | if (params.is_strict) { | 585 | 8 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | 8 | from, int_type_name<FromCppT>, precision, scale); | 587 | 8 | } | 588 | 16 | return false; | 589 | 16 | } | 590 | 44 | } | 591 | 28 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | 44 | } | 593 | | | 594 | 0 | return true; | 595 | 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 | 560 | 22 | CastParameters& params) { | 561 | 22 | MaxNativeType tmp; | 562 | 22 | if constexpr (multiply_may_overflow) { | 563 | 22 | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | 4 | if (params.is_strict) { | 565 | 2 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | 2 | precision, scale); | 567 | 2 | } | 568 | 4 | return false; | 569 | 4 | } | 570 | 18 | if constexpr (narrow_integral) { | 571 | 18 | if (tmp < min_result || tmp > max_result) { | 572 | 4 | if (params.is_strict) { | 573 | 2 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | 2 | from, int_type_name<FromCppT>, precision, scale); | 575 | 2 | } | 576 | 4 | return false; | 577 | 4 | } | 578 | 18 | } | 579 | 14 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | | } else { | 581 | | tmp = scale_multiplier * from; | 582 | | if constexpr (narrow_integral) { | 583 | | if (tmp < min_result || tmp > max_result) { | 584 | | if (params.is_strict) { | 585 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | | from, int_type_name<FromCppT>, precision, scale); | 587 | | } | 588 | | return false; | 589 | | } | 590 | | } | 591 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | | } | 593 | | | 594 | 0 | return true; | 595 | 22 | } |
_ZN5doris13CastToDecimal9_from_intIsNS_12Decimal128V3ELb0ELb0EnQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS3_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRKT3_RKNS3_10NativeTypeESD_RNS_14CastParametersE Line | Count | Source | 560 | 72 | CastParameters& params) { | 561 | 72 | MaxNativeType tmp; | 562 | | if constexpr (multiply_may_overflow) { | 563 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | | if (params.is_strict) { | 565 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | | precision, scale); | 567 | | } | 568 | | return false; | 569 | | } | 570 | | if constexpr (narrow_integral) { | 571 | | if (tmp < min_result || tmp > max_result) { | 572 | | if (params.is_strict) { | 573 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | | from, int_type_name<FromCppT>, precision, scale); | 575 | | } | 576 | | return false; | 577 | | } | 578 | | } | 579 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | 72 | } else { | 581 | 72 | tmp = scale_multiplier * from; | 582 | | if constexpr (narrow_integral) { | 583 | | if (tmp < min_result || tmp > max_result) { | 584 | | if (params.is_strict) { | 585 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | | from, int_type_name<FromCppT>, precision, scale); | 587 | | } | 588 | | return false; | 589 | | } | 590 | | } | 591 | 72 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | 72 | } | 593 | | | 594 | 72 | return true; | 595 | 72 | } |
_ZN5doris13CastToDecimal9_from_intIsNS_12Decimal128V3ELb0ELb1EnQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS3_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRKT3_RKNS3_10NativeTypeESD_RNS_14CastParametersE Line | Count | Source | 560 | 44 | CastParameters& params) { | 561 | 44 | MaxNativeType tmp; | 562 | | if constexpr (multiply_may_overflow) { | 563 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | | if (params.is_strict) { | 565 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | | precision, scale); | 567 | | } | 568 | | return false; | 569 | | } | 570 | | if constexpr (narrow_integral) { | 571 | | if (tmp < min_result || tmp > max_result) { | 572 | | if (params.is_strict) { | 573 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | | from, int_type_name<FromCppT>, precision, scale); | 575 | | } | 576 | | return false; | 577 | | } | 578 | | } | 579 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | 44 | } else { | 581 | 44 | tmp = scale_multiplier * from; | 582 | 44 | if constexpr (narrow_integral) { | 583 | 44 | if (tmp < min_result || tmp > max_result) { | 584 | 16 | if (params.is_strict) { | 585 | 8 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | 8 | from, int_type_name<FromCppT>, precision, scale); | 587 | 8 | } | 588 | 16 | return false; | 589 | 16 | } | 590 | 44 | } | 591 | 28 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | 44 | } | 593 | | | 594 | 0 | return true; | 595 | 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 | 560 | 22 | CastParameters& params) { | 561 | 22 | MaxNativeType tmp; | 562 | 22 | if constexpr (multiply_may_overflow) { | 563 | 22 | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | 4 | if (params.is_strict) { | 565 | 2 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | 2 | precision, scale); | 567 | 2 | } | 568 | 4 | return false; | 569 | 4 | } | 570 | 18 | if constexpr (narrow_integral) { | 571 | 18 | if (tmp < min_result || tmp > max_result) { | 572 | 4 | if (params.is_strict) { | 573 | 2 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | 2 | from, int_type_name<FromCppT>, precision, scale); | 575 | 2 | } | 576 | 4 | return false; | 577 | 4 | } | 578 | 18 | } | 579 | 14 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | | } else { | 581 | | tmp = scale_multiplier * from; | 582 | | if constexpr (narrow_integral) { | 583 | | if (tmp < min_result || tmp > max_result) { | 584 | | if (params.is_strict) { | 585 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | | from, int_type_name<FromCppT>, precision, scale); | 587 | | } | 588 | | return false; | 589 | | } | 590 | | } | 591 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | | } | 593 | | | 594 | 0 | return true; | 595 | 22 | } |
_ZN5doris13CastToDecimal9_from_intIiNS_12Decimal128V3ELb0ELb0EnQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS3_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRKT3_RKNS3_10NativeTypeESD_RNS_14CastParametersE Line | Count | Source | 560 | 72 | CastParameters& params) { | 561 | 72 | MaxNativeType tmp; | 562 | | if constexpr (multiply_may_overflow) { | 563 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | | if (params.is_strict) { | 565 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | | precision, scale); | 567 | | } | 568 | | return false; | 569 | | } | 570 | | if constexpr (narrow_integral) { | 571 | | if (tmp < min_result || tmp > max_result) { | 572 | | if (params.is_strict) { | 573 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | | from, int_type_name<FromCppT>, precision, scale); | 575 | | } | 576 | | return false; | 577 | | } | 578 | | } | 579 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | 72 | } else { | 581 | 72 | tmp = scale_multiplier * from; | 582 | | if constexpr (narrow_integral) { | 583 | | if (tmp < min_result || tmp > max_result) { | 584 | | if (params.is_strict) { | 585 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | | from, int_type_name<FromCppT>, precision, scale); | 587 | | } | 588 | | return false; | 589 | | } | 590 | | } | 591 | 72 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | 72 | } | 593 | | | 594 | 72 | return true; | 595 | 72 | } |
_ZN5doris13CastToDecimal9_from_intIiNS_12Decimal128V3ELb0ELb1EnQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS3_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRKT3_RKNS3_10NativeTypeESD_RNS_14CastParametersE Line | Count | Source | 560 | 44 | CastParameters& params) { | 561 | 44 | MaxNativeType tmp; | 562 | | if constexpr (multiply_may_overflow) { | 563 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | | if (params.is_strict) { | 565 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | | precision, scale); | 567 | | } | 568 | | return false; | 569 | | } | 570 | | if constexpr (narrow_integral) { | 571 | | if (tmp < min_result || tmp > max_result) { | 572 | | if (params.is_strict) { | 573 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | | from, int_type_name<FromCppT>, precision, scale); | 575 | | } | 576 | | return false; | 577 | | } | 578 | | } | 579 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | 44 | } else { | 581 | 44 | tmp = scale_multiplier * from; | 582 | 44 | if constexpr (narrow_integral) { | 583 | 44 | if (tmp < min_result || tmp > max_result) { | 584 | 16 | if (params.is_strict) { | 585 | 8 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | 8 | from, int_type_name<FromCppT>, precision, scale); | 587 | 8 | } | 588 | 16 | return false; | 589 | 16 | } | 590 | 44 | } | 591 | 28 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | 44 | } | 593 | | | 594 | 0 | return true; | 595 | 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 | 560 | 22 | CastParameters& params) { | 561 | 22 | MaxNativeType tmp; | 562 | 22 | if constexpr (multiply_may_overflow) { | 563 | 22 | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | 4 | if (params.is_strict) { | 565 | 2 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | 2 | precision, scale); | 567 | 2 | } | 568 | 4 | return false; | 569 | 4 | } | 570 | 18 | if constexpr (narrow_integral) { | 571 | 18 | if (tmp < min_result || tmp > max_result) { | 572 | 4 | if (params.is_strict) { | 573 | 2 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | 2 | from, int_type_name<FromCppT>, precision, scale); | 575 | 2 | } | 576 | 4 | return false; | 577 | 4 | } | 578 | 18 | } | 579 | 14 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | | } else { | 581 | | tmp = scale_multiplier * from; | 582 | | if constexpr (narrow_integral) { | 583 | | if (tmp < min_result || tmp > max_result) { | 584 | | if (params.is_strict) { | 585 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | | from, int_type_name<FromCppT>, precision, scale); | 587 | | } | 588 | | return false; | 589 | | } | 590 | | } | 591 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | | } | 593 | | | 594 | 0 | return true; | 595 | 22 | } |
_ZN5doris13CastToDecimal9_from_intIlNS_12Decimal128V3ELb0ELb0EnQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS3_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRKT3_RKNS3_10NativeTypeESD_RNS_14CastParametersE Line | Count | Source | 560 | 54 | CastParameters& params) { | 561 | 54 | MaxNativeType tmp; | 562 | | if constexpr (multiply_may_overflow) { | 563 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | | if (params.is_strict) { | 565 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | | precision, scale); | 567 | | } | 568 | | return false; | 569 | | } | 570 | | if constexpr (narrow_integral) { | 571 | | if (tmp < min_result || tmp > max_result) { | 572 | | if (params.is_strict) { | 573 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | | from, int_type_name<FromCppT>, precision, scale); | 575 | | } | 576 | | return false; | 577 | | } | 578 | | } | 579 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | 54 | } else { | 581 | 54 | tmp = scale_multiplier * from; | 582 | | if constexpr (narrow_integral) { | 583 | | if (tmp < min_result || tmp > max_result) { | 584 | | if (params.is_strict) { | 585 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | | from, int_type_name<FromCppT>, precision, scale); | 587 | | } | 588 | | return false; | 589 | | } | 590 | | } | 591 | 54 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | 54 | } | 593 | | | 594 | 54 | return true; | 595 | 54 | } |
_ZN5doris13CastToDecimal9_from_intIlNS_12Decimal128V3ELb0ELb1EnQaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS3_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRKT3_RKNS3_10NativeTypeESD_RNS_14CastParametersE Line | Count | Source | 560 | 78 | CastParameters& params) { | 561 | 78 | MaxNativeType tmp; | 562 | | if constexpr (multiply_may_overflow) { | 563 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | | if (params.is_strict) { | 565 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | | precision, scale); | 567 | | } | 568 | | return false; | 569 | | } | 570 | | if constexpr (narrow_integral) { | 571 | | if (tmp < min_result || tmp > max_result) { | 572 | | if (params.is_strict) { | 573 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | | from, int_type_name<FromCppT>, precision, scale); | 575 | | } | 576 | | return false; | 577 | | } | 578 | | } | 579 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | 78 | } else { | 581 | 78 | tmp = scale_multiplier * from; | 582 | 78 | if constexpr (narrow_integral) { | 583 | 78 | if (tmp < min_result || tmp > max_result) { | 584 | 24 | if (params.is_strict) { | 585 | 12 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | 12 | from, int_type_name<FromCppT>, precision, scale); | 587 | 12 | } | 588 | 24 | return false; | 589 | 24 | } | 590 | 78 | } | 591 | 54 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | 78 | } | 593 | | | 594 | 0 | return true; | 595 | 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 | 560 | 22 | CastParameters& params) { | 561 | 22 | MaxNativeType tmp; | 562 | 22 | if constexpr (multiply_may_overflow) { | 563 | 22 | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | 4 | if (params.is_strict) { | 565 | 2 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | 2 | precision, scale); | 567 | 2 | } | 568 | 4 | return false; | 569 | 4 | } | 570 | 18 | if constexpr (narrow_integral) { | 571 | 18 | if (tmp < min_result || tmp > max_result) { | 572 | 4 | if (params.is_strict) { | 573 | 2 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | 2 | from, int_type_name<FromCppT>, precision, scale); | 575 | 2 | } | 576 | 4 | return false; | 577 | 4 | } | 578 | 18 | } | 579 | 14 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | | } else { | 581 | | tmp = scale_multiplier * from; | 582 | | if constexpr (narrow_integral) { | 583 | | if (tmp < min_result || tmp > max_result) { | 584 | | if (params.is_strict) { | 585 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | | from, int_type_name<FromCppT>, precision, scale); | 587 | | } | 588 | | return false; | 589 | | } | 590 | | } | 591 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | | } | 593 | | | 594 | 0 | return true; | 595 | 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 | 560 | 90 | CastParameters& params) { | 561 | 90 | MaxNativeType tmp; | 562 | | if constexpr (multiply_may_overflow) { | 563 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | | if (params.is_strict) { | 565 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | | precision, scale); | 567 | | } | 568 | | return false; | 569 | | } | 570 | | if constexpr (narrow_integral) { | 571 | | if (tmp < min_result || tmp > max_result) { | 572 | | if (params.is_strict) { | 573 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | | from, int_type_name<FromCppT>, precision, scale); | 575 | | } | 576 | | return false; | 577 | | } | 578 | | } | 579 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | 90 | } else { | 581 | 90 | tmp = scale_multiplier * from; | 582 | 90 | if constexpr (narrow_integral) { | 583 | 90 | if (tmp < min_result || tmp > max_result) { | 584 | 24 | if (params.is_strict) { | 585 | 12 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | 12 | from, int_type_name<FromCppT>, precision, scale); | 587 | 12 | } | 588 | 24 | return false; | 589 | 24 | } | 590 | 90 | } | 591 | 66 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | 90 | } | 593 | | | 594 | 0 | return true; | 595 | 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 | 560 | 112 | CastParameters& params) { | 561 | 112 | MaxNativeType tmp; | 562 | 112 | if constexpr (multiply_may_overflow) { | 563 | 112 | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | 16 | if (params.is_strict) { | 565 | 8 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | 8 | precision, scale); | 567 | 8 | } | 568 | 16 | return false; | 569 | 16 | } | 570 | 96 | if constexpr (narrow_integral) { | 571 | 96 | if (tmp < min_result || tmp > max_result) { | 572 | 16 | if (params.is_strict) { | 573 | 8 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | 8 | from, int_type_name<FromCppT>, precision, scale); | 575 | 8 | } | 576 | 16 | return false; | 577 | 16 | } | 578 | 96 | } | 579 | 80 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | | } else { | 581 | | tmp = scale_multiplier * from; | 582 | | if constexpr (narrow_integral) { | 583 | | if (tmp < min_result || tmp > max_result) { | 584 | | if (params.is_strict) { | 585 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | | from, int_type_name<FromCppT>, precision, scale); | 587 | | } | 588 | | return false; | 589 | | } | 590 | | } | 591 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | | } | 593 | | | 594 | 0 | return true; | 595 | 112 | } |
_ZN5doris13CastToDecimal9_from_intIhNS_7DecimalIN4wide7integerILm256EiEEEELb0ELb0ES5_Qaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS7_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS8_hEEEbRKS8_RS7_jjRKT3_RKNS7_10NativeTypeESH_RNS_14CastParametersE Line | Count | Source | 560 | 8 | CastParameters& params) { | 561 | 8 | MaxNativeType tmp; | 562 | | if constexpr (multiply_may_overflow) { | 563 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | | if (params.is_strict) { | 565 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | | precision, scale); | 567 | | } | 568 | | return false; | 569 | | } | 570 | | if constexpr (narrow_integral) { | 571 | | if (tmp < min_result || tmp > max_result) { | 572 | | if (params.is_strict) { | 573 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | | from, int_type_name<FromCppT>, precision, scale); | 575 | | } | 576 | | return false; | 577 | | } | 578 | | } | 579 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | 8 | } else { | 581 | 8 | tmp = scale_multiplier * from; | 582 | | if constexpr (narrow_integral) { | 583 | | if (tmp < min_result || tmp > max_result) { | 584 | | if (params.is_strict) { | 585 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | | from, int_type_name<FromCppT>, precision, scale); | 587 | | } | 588 | | return false; | 589 | | } | 590 | | } | 591 | 8 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | 8 | } | 593 | | | 594 | 8 | return true; | 595 | 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 | 560 | 4 | CastParameters& params) { | 561 | 4 | MaxNativeType tmp; | 562 | 4 | if constexpr (multiply_may_overflow) { | 563 | 4 | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | 0 | if (params.is_strict) { | 565 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | 0 | precision, scale); | 567 | 0 | } | 568 | 0 | return false; | 569 | 0 | } | 570 | 4 | if constexpr (narrow_integral) { | 571 | 4 | if (tmp < min_result || tmp > max_result) { | 572 | 2 | if (params.is_strict) { | 573 | 1 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | 1 | from, int_type_name<FromCppT>, precision, scale); | 575 | 1 | } | 576 | 2 | return false; | 577 | 2 | } | 578 | 4 | } | 579 | 2 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | | } else { | 581 | | tmp = scale_multiplier * from; | 582 | | if constexpr (narrow_integral) { | 583 | | if (tmp < min_result || tmp > max_result) { | 584 | | if (params.is_strict) { | 585 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | | from, int_type_name<FromCppT>, precision, scale); | 587 | | } | 588 | | return false; | 589 | | } | 590 | | } | 591 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | | } | 593 | | | 594 | 0 | return true; | 595 | 4 | } |
_ZN5doris13CastToDecimal9_from_intIaNS_7DecimalIN4wide7integerILm256EiEEEELb0ELb0ES5_Qaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS7_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS8_hEEEbRKS8_RS7_jjRKT3_RKNS7_10NativeTypeESH_RNS_14CastParametersE Line | Count | Source | 560 | 72 | CastParameters& params) { | 561 | 72 | MaxNativeType tmp; | 562 | | if constexpr (multiply_may_overflow) { | 563 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | | if (params.is_strict) { | 565 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | | precision, scale); | 567 | | } | 568 | | return false; | 569 | | } | 570 | | if constexpr (narrow_integral) { | 571 | | if (tmp < min_result || tmp > max_result) { | 572 | | if (params.is_strict) { | 573 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | | from, int_type_name<FromCppT>, precision, scale); | 575 | | } | 576 | | return false; | 577 | | } | 578 | | } | 579 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | 72 | } else { | 581 | 72 | tmp = scale_multiplier * from; | 582 | | if constexpr (narrow_integral) { | 583 | | if (tmp < min_result || tmp > max_result) { | 584 | | if (params.is_strict) { | 585 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | | from, int_type_name<FromCppT>, precision, scale); | 587 | | } | 588 | | return false; | 589 | | } | 590 | | } | 591 | 72 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | 72 | } | 593 | | | 594 | 72 | return true; | 595 | 72 | } |
_ZN5doris13CastToDecimal9_from_intIaNS_7DecimalIN4wide7integerILm256EiEEEELb0ELb1ES5_Qaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS7_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS8_hEEEbRKS8_RS7_jjRKT3_RKNS7_10NativeTypeESH_RNS_14CastParametersE Line | Count | Source | 560 | 44 | CastParameters& params) { | 561 | 44 | MaxNativeType tmp; | 562 | | if constexpr (multiply_may_overflow) { | 563 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | | if (params.is_strict) { | 565 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | | precision, scale); | 567 | | } | 568 | | return false; | 569 | | } | 570 | | if constexpr (narrow_integral) { | 571 | | if (tmp < min_result || tmp > max_result) { | 572 | | if (params.is_strict) { | 573 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | | from, int_type_name<FromCppT>, precision, scale); | 575 | | } | 576 | | return false; | 577 | | } | 578 | | } | 579 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | 44 | } else { | 581 | 44 | tmp = scale_multiplier * from; | 582 | 44 | if constexpr (narrow_integral) { | 583 | 44 | if (tmp < min_result || tmp > max_result) { | 584 | 16 | if (params.is_strict) { | 585 | 8 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | 8 | from, int_type_name<FromCppT>, precision, scale); | 587 | 8 | } | 588 | 16 | return false; | 589 | 16 | } | 590 | 44 | } | 591 | 28 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | 44 | } | 593 | | | 594 | 0 | return true; | 595 | 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 | 560 | 22 | CastParameters& params) { | 561 | 22 | MaxNativeType tmp; | 562 | 22 | if constexpr (multiply_may_overflow) { | 563 | 22 | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | 4 | if (params.is_strict) { | 565 | 2 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | 2 | precision, scale); | 567 | 2 | } | 568 | 4 | return false; | 569 | 4 | } | 570 | 18 | if constexpr (narrow_integral) { | 571 | 18 | if (tmp < min_result || tmp > max_result) { | 572 | 4 | if (params.is_strict) { | 573 | 2 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | 2 | from, int_type_name<FromCppT>, precision, scale); | 575 | 2 | } | 576 | 4 | return false; | 577 | 4 | } | 578 | 18 | } | 579 | 14 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | | } else { | 581 | | tmp = scale_multiplier * from; | 582 | | if constexpr (narrow_integral) { | 583 | | if (tmp < min_result || tmp > max_result) { | 584 | | if (params.is_strict) { | 585 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | | from, int_type_name<FromCppT>, precision, scale); | 587 | | } | 588 | | return false; | 589 | | } | 590 | | } | 591 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | | } | 593 | | | 594 | 0 | return true; | 595 | 22 | } |
_ZN5doris13CastToDecimal9_from_intIsNS_7DecimalIN4wide7integerILm256EiEEEELb0ELb0ES5_Qaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS7_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS8_hEEEbRKS8_RS7_jjRKT3_RKNS7_10NativeTypeESH_RNS_14CastParametersE Line | Count | Source | 560 | 72 | CastParameters& params) { | 561 | 72 | MaxNativeType tmp; | 562 | | if constexpr (multiply_may_overflow) { | 563 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | | if (params.is_strict) { | 565 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | | precision, scale); | 567 | | } | 568 | | return false; | 569 | | } | 570 | | if constexpr (narrow_integral) { | 571 | | if (tmp < min_result || tmp > max_result) { | 572 | | if (params.is_strict) { | 573 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | | from, int_type_name<FromCppT>, precision, scale); | 575 | | } | 576 | | return false; | 577 | | } | 578 | | } | 579 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | 72 | } else { | 581 | 72 | tmp = scale_multiplier * from; | 582 | | if constexpr (narrow_integral) { | 583 | | if (tmp < min_result || tmp > max_result) { | 584 | | if (params.is_strict) { | 585 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | | from, int_type_name<FromCppT>, precision, scale); | 587 | | } | 588 | | return false; | 589 | | } | 590 | | } | 591 | 72 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | 72 | } | 593 | | | 594 | 72 | return true; | 595 | 72 | } |
_ZN5doris13CastToDecimal9_from_intIsNS_7DecimalIN4wide7integerILm256EiEEEELb0ELb1ES5_Qaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS7_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS8_hEEEbRKS8_RS7_jjRKT3_RKNS7_10NativeTypeESH_RNS_14CastParametersE Line | Count | Source | 560 | 44 | CastParameters& params) { | 561 | 44 | MaxNativeType tmp; | 562 | | if constexpr (multiply_may_overflow) { | 563 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | | if (params.is_strict) { | 565 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | | precision, scale); | 567 | | } | 568 | | return false; | 569 | | } | 570 | | if constexpr (narrow_integral) { | 571 | | if (tmp < min_result || tmp > max_result) { | 572 | | if (params.is_strict) { | 573 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | | from, int_type_name<FromCppT>, precision, scale); | 575 | | } | 576 | | return false; | 577 | | } | 578 | | } | 579 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | 44 | } else { | 581 | 44 | tmp = scale_multiplier * from; | 582 | 44 | if constexpr (narrow_integral) { | 583 | 44 | if (tmp < min_result || tmp > max_result) { | 584 | 16 | if (params.is_strict) { | 585 | 8 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | 8 | from, int_type_name<FromCppT>, precision, scale); | 587 | 8 | } | 588 | 16 | return false; | 589 | 16 | } | 590 | 44 | } | 591 | 28 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | 44 | } | 593 | | | 594 | 0 | return true; | 595 | 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 | 560 | 22 | CastParameters& params) { | 561 | 22 | MaxNativeType tmp; | 562 | 22 | if constexpr (multiply_may_overflow) { | 563 | 22 | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | 4 | if (params.is_strict) { | 565 | 2 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | 2 | precision, scale); | 567 | 2 | } | 568 | 4 | return false; | 569 | 4 | } | 570 | 18 | if constexpr (narrow_integral) { | 571 | 18 | if (tmp < min_result || tmp > max_result) { | 572 | 4 | if (params.is_strict) { | 573 | 2 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | 2 | from, int_type_name<FromCppT>, precision, scale); | 575 | 2 | } | 576 | 4 | return false; | 577 | 4 | } | 578 | 18 | } | 579 | 14 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | | } else { | 581 | | tmp = scale_multiplier * from; | 582 | | if constexpr (narrow_integral) { | 583 | | if (tmp < min_result || tmp > max_result) { | 584 | | if (params.is_strict) { | 585 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | | from, int_type_name<FromCppT>, precision, scale); | 587 | | } | 588 | | return false; | 589 | | } | 590 | | } | 591 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | | } | 593 | | | 594 | 0 | return true; | 595 | 22 | } |
_ZN5doris13CastToDecimal9_from_intIiNS_7DecimalIN4wide7integerILm256EiEEEELb0ELb0ES5_Qaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS7_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS8_hEEEbRKS8_RS7_jjRKT3_RKNS7_10NativeTypeESH_RNS_14CastParametersE Line | Count | Source | 560 | 72 | CastParameters& params) { | 561 | 72 | MaxNativeType tmp; | 562 | | if constexpr (multiply_may_overflow) { | 563 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | | if (params.is_strict) { | 565 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | | precision, scale); | 567 | | } | 568 | | return false; | 569 | | } | 570 | | if constexpr (narrow_integral) { | 571 | | if (tmp < min_result || tmp > max_result) { | 572 | | if (params.is_strict) { | 573 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | | from, int_type_name<FromCppT>, precision, scale); | 575 | | } | 576 | | return false; | 577 | | } | 578 | | } | 579 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | 72 | } else { | 581 | 72 | tmp = scale_multiplier * from; | 582 | | if constexpr (narrow_integral) { | 583 | | if (tmp < min_result || tmp > max_result) { | 584 | | if (params.is_strict) { | 585 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | | from, int_type_name<FromCppT>, precision, scale); | 587 | | } | 588 | | return false; | 589 | | } | 590 | | } | 591 | 72 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | 72 | } | 593 | | | 594 | 72 | return true; | 595 | 72 | } |
_ZN5doris13CastToDecimal9_from_intIiNS_7DecimalIN4wide7integerILm256EiEEEELb0ELb1ES5_Qaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS7_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS8_hEEEbRKS8_RS7_jjRKT3_RKNS7_10NativeTypeESH_RNS_14CastParametersE Line | Count | Source | 560 | 44 | CastParameters& params) { | 561 | 44 | MaxNativeType tmp; | 562 | | if constexpr (multiply_may_overflow) { | 563 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | | if (params.is_strict) { | 565 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | | precision, scale); | 567 | | } | 568 | | return false; | 569 | | } | 570 | | if constexpr (narrow_integral) { | 571 | | if (tmp < min_result || tmp > max_result) { | 572 | | if (params.is_strict) { | 573 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | | from, int_type_name<FromCppT>, precision, scale); | 575 | | } | 576 | | return false; | 577 | | } | 578 | | } | 579 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | 44 | } else { | 581 | 44 | tmp = scale_multiplier * from; | 582 | 44 | if constexpr (narrow_integral) { | 583 | 44 | if (tmp < min_result || tmp > max_result) { | 584 | 16 | if (params.is_strict) { | 585 | 8 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | 8 | from, int_type_name<FromCppT>, precision, scale); | 587 | 8 | } | 588 | 16 | return false; | 589 | 16 | } | 590 | 44 | } | 591 | 28 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | 44 | } | 593 | | | 594 | 0 | return true; | 595 | 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 | 560 | 22 | CastParameters& params) { | 561 | 22 | MaxNativeType tmp; | 562 | 22 | if constexpr (multiply_may_overflow) { | 563 | 22 | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | 4 | if (params.is_strict) { | 565 | 2 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | 2 | precision, scale); | 567 | 2 | } | 568 | 4 | return false; | 569 | 4 | } | 570 | 18 | if constexpr (narrow_integral) { | 571 | 18 | if (tmp < min_result || tmp > max_result) { | 572 | 4 | if (params.is_strict) { | 573 | 2 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | 2 | from, int_type_name<FromCppT>, precision, scale); | 575 | 2 | } | 576 | 4 | return false; | 577 | 4 | } | 578 | 18 | } | 579 | 14 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | | } else { | 581 | | tmp = scale_multiplier * from; | 582 | | if constexpr (narrow_integral) { | 583 | | if (tmp < min_result || tmp > max_result) { | 584 | | if (params.is_strict) { | 585 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | | from, int_type_name<FromCppT>, precision, scale); | 587 | | } | 588 | | return false; | 589 | | } | 590 | | } | 591 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | | } | 593 | | | 594 | 0 | return true; | 595 | 22 | } |
_ZN5doris13CastToDecimal9_from_intIlNS_7DecimalIN4wide7integerILm256EiEEEELb0ELb0ES5_Qaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS7_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS8_hEEEbRKS8_RS7_jjRKT3_RKNS7_10NativeTypeESH_RNS_14CastParametersE Line | Count | Source | 560 | 72 | CastParameters& params) { | 561 | 72 | MaxNativeType tmp; | 562 | | if constexpr (multiply_may_overflow) { | 563 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | | if (params.is_strict) { | 565 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | | precision, scale); | 567 | | } | 568 | | return false; | 569 | | } | 570 | | if constexpr (narrow_integral) { | 571 | | if (tmp < min_result || tmp > max_result) { | 572 | | if (params.is_strict) { | 573 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | | from, int_type_name<FromCppT>, precision, scale); | 575 | | } | 576 | | return false; | 577 | | } | 578 | | } | 579 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | 72 | } else { | 581 | 72 | tmp = scale_multiplier * from; | 582 | | if constexpr (narrow_integral) { | 583 | | if (tmp < min_result || tmp > max_result) { | 584 | | if (params.is_strict) { | 585 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | | from, int_type_name<FromCppT>, precision, scale); | 587 | | } | 588 | | return false; | 589 | | } | 590 | | } | 591 | 72 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | 72 | } | 593 | | | 594 | 72 | return true; | 595 | 72 | } |
_ZN5doris13CastToDecimal9_from_intIlNS_7DecimalIN4wide7integerILm256EiEEEELb0ELb1ES5_Qaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS7_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS8_hEEEbRKS8_RS7_jjRKT3_RKNS7_10NativeTypeESH_RNS_14CastParametersE Line | Count | Source | 560 | 44 | CastParameters& params) { | 561 | 44 | MaxNativeType tmp; | 562 | | if constexpr (multiply_may_overflow) { | 563 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | | if (params.is_strict) { | 565 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | | precision, scale); | 567 | | } | 568 | | return false; | 569 | | } | 570 | | if constexpr (narrow_integral) { | 571 | | if (tmp < min_result || tmp > max_result) { | 572 | | if (params.is_strict) { | 573 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | | from, int_type_name<FromCppT>, precision, scale); | 575 | | } | 576 | | return false; | 577 | | } | 578 | | } | 579 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | 44 | } else { | 581 | 44 | tmp = scale_multiplier * from; | 582 | 44 | if constexpr (narrow_integral) { | 583 | 44 | if (tmp < min_result || tmp > max_result) { | 584 | 16 | if (params.is_strict) { | 585 | 8 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | 8 | from, int_type_name<FromCppT>, precision, scale); | 587 | 8 | } | 588 | 16 | return false; | 589 | 16 | } | 590 | 44 | } | 591 | 28 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | 44 | } | 593 | | | 594 | 0 | return true; | 595 | 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 | 560 | 22 | CastParameters& params) { | 561 | 22 | MaxNativeType tmp; | 562 | 22 | if constexpr (multiply_may_overflow) { | 563 | 22 | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | 4 | if (params.is_strict) { | 565 | 2 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | 2 | precision, scale); | 567 | 2 | } | 568 | 4 | return false; | 569 | 4 | } | 570 | 18 | if constexpr (narrow_integral) { | 571 | 18 | if (tmp < min_result || tmp > max_result) { | 572 | 4 | if (params.is_strict) { | 573 | 2 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | 2 | from, int_type_name<FromCppT>, precision, scale); | 575 | 2 | } | 576 | 4 | return false; | 577 | 4 | } | 578 | 18 | } | 579 | 14 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | | } else { | 581 | | tmp = scale_multiplier * from; | 582 | | if constexpr (narrow_integral) { | 583 | | if (tmp < min_result || tmp > max_result) { | 584 | | if (params.is_strict) { | 585 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | | from, int_type_name<FromCppT>, precision, scale); | 587 | | } | 588 | | return false; | 589 | | } | 590 | | } | 591 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | | } | 593 | | | 594 | 0 | return true; | 595 | 22 | } |
_ZN5doris13CastToDecimal9_from_intInNS_7DecimalIN4wide7integerILm256EiEEEELb0ELb0ES5_Qaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS7_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS8_hEEEbRKS8_RS7_jjRKT3_RKNS7_10NativeTypeESH_RNS_14CastParametersE Line | Count | Source | 560 | 18 | CastParameters& params) { | 561 | 18 | MaxNativeType tmp; | 562 | | if constexpr (multiply_may_overflow) { | 563 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | | if (params.is_strict) { | 565 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | | precision, scale); | 567 | | } | 568 | | return false; | 569 | | } | 570 | | if constexpr (narrow_integral) { | 571 | | if (tmp < min_result || tmp > max_result) { | 572 | | if (params.is_strict) { | 573 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | | from, int_type_name<FromCppT>, precision, scale); | 575 | | } | 576 | | return false; | 577 | | } | 578 | | } | 579 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | 18 | } else { | 581 | 18 | tmp = scale_multiplier * from; | 582 | | if constexpr (narrow_integral) { | 583 | | if (tmp < min_result || tmp > max_result) { | 584 | | if (params.is_strict) { | 585 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | | from, int_type_name<FromCppT>, precision, scale); | 587 | | } | 588 | | return false; | 589 | | } | 590 | | } | 591 | 18 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | 18 | } | 593 | | | 594 | 18 | return true; | 595 | 18 | } |
_ZN5doris13CastToDecimal9_from_intInNS_7DecimalIN4wide7integerILm256EiEEEELb0ELb1ES5_Qaaaa15IsDecimalNumberIT0_Ent14IsDecimal128V2IS7_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS8_hEEEbRKS8_RS7_jjRKT3_RKNS7_10NativeTypeESH_RNS_14CastParametersE Line | Count | Source | 560 | 112 | CastParameters& params) { | 561 | 112 | MaxNativeType tmp; | 562 | | if constexpr (multiply_may_overflow) { | 563 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | | if (params.is_strict) { | 565 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | | precision, scale); | 567 | | } | 568 | | return false; | 569 | | } | 570 | | if constexpr (narrow_integral) { | 571 | | if (tmp < min_result || tmp > max_result) { | 572 | | if (params.is_strict) { | 573 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | | from, int_type_name<FromCppT>, precision, scale); | 575 | | } | 576 | | return false; | 577 | | } | 578 | | } | 579 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | 112 | } else { | 581 | 112 | tmp = scale_multiplier * from; | 582 | 112 | if constexpr (narrow_integral) { | 583 | 112 | if (tmp < min_result || tmp > max_result) { | 584 | 32 | if (params.is_strict) { | 585 | 16 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | 16 | from, int_type_name<FromCppT>, precision, scale); | 587 | 16 | } | 588 | 32 | return false; | 589 | 32 | } | 590 | 112 | } | 591 | 80 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | 112 | } | 593 | | | 594 | 0 | return true; | 595 | 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 | 560 | 56 | CastParameters& params) { | 561 | 56 | MaxNativeType tmp; | 562 | 56 | if constexpr (multiply_may_overflow) { | 563 | 56 | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 564 | 4 | if (params.is_strict) { | 565 | 2 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 566 | 2 | precision, scale); | 567 | 2 | } | 568 | 4 | return false; | 569 | 4 | } | 570 | 52 | if constexpr (narrow_integral) { | 571 | 52 | if (tmp < min_result || tmp > max_result) { | 572 | 12 | if (params.is_strict) { | 573 | 6 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 574 | 6 | from, int_type_name<FromCppT>, precision, scale); | 575 | 6 | } | 576 | 12 | return false; | 577 | 12 | } | 578 | 52 | } | 579 | 40 | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 580 | | } else { | 581 | | tmp = scale_multiplier * from; | 582 | | if constexpr (narrow_integral) { | 583 | | if (tmp < min_result || tmp > max_result) { | 584 | | if (params.is_strict) { | 585 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 586 | | from, int_type_name<FromCppT>, precision, scale); | 587 | | } | 588 | | return false; | 589 | | } | 590 | | } | 591 | | to.value = static_cast<typename ToCppT::NativeType>(tmp); | 592 | | } | 593 | | | 594 | 0 | return true; | 595 | 56 | } |
|
596 | | |
597 | | template <typename FromCppT, typename ToCppT, bool multiply_may_overflow, bool narrow_integral, |
598 | | typename MaxNativeType = |
599 | | std::conditional_t<(sizeof(FromCppT) > sizeof(typename ToCppT::NativeType)), |
600 | | FromCppT, typename ToCppT::NativeType>> |
601 | | requires(IsDecimalV2<ToCppT> && (IsCppTypeInt<FromCppT> || std::is_same_v<FromCppT, UInt8>)) |
602 | | static inline bool _from_int(const FromCppT& from, ToCppT& to, UInt32 precision, UInt32 scale, |
603 | | const MaxNativeType& scale_multiplier, |
604 | | const typename ToCppT::NativeType& min_result, |
605 | | const typename ToCppT::NativeType& max_result, |
606 | 6 | CastParameters& params) { |
607 | 6 | MaxNativeType tmp; |
608 | 6 | if constexpr (multiply_may_overflow) { |
609 | 0 | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { |
610 | 0 | if (params.is_strict) { |
611 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, |
612 | 0 | precision, scale); |
613 | 0 | } |
614 | 0 | return false; |
615 | 0 | } |
616 | 0 | if constexpr (narrow_integral) { |
617 | 0 | if (tmp < min_result || tmp > max_result) { |
618 | 0 | if (params.is_strict) { |
619 | 0 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( |
620 | 0 | from, int_type_name<FromCppT>, precision, scale); |
621 | 0 | } |
622 | 0 | return false; |
623 | 0 | } |
624 | 0 | } |
625 | 0 | to = DecimalV2Value(static_cast<typename ToCppT::NativeType>(tmp)); |
626 | 6 | } else { |
627 | 6 | tmp = scale_multiplier * from; |
628 | 6 | if constexpr (narrow_integral) { |
629 | 4 | if (tmp < min_result || tmp > max_result) { |
630 | 2 | if (params.is_strict) { |
631 | 1 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( |
632 | 1 | from, int_type_name<FromCppT>, precision, scale); |
633 | 1 | } |
634 | 2 | return false; |
635 | 2 | } |
636 | 4 | } |
637 | 2 | to = DecimalV2Value(static_cast<typename ToCppT::NativeType>(tmp)); |
638 | 6 | } |
639 | | |
640 | 0 | return true; |
641 | 6 | } _ZN5doris13CastToDecimal9_from_intIhNS_14DecimalV2ValueELb0ELb0EnQaa11IsDecimalV2IT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRKT3_RKNS3_10NativeTypeESD_RNS_14CastParametersE Line | Count | Source | 606 | 2 | CastParameters& params) { | 607 | 2 | MaxNativeType tmp; | 608 | | if constexpr (multiply_may_overflow) { | 609 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 610 | | if (params.is_strict) { | 611 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 612 | | precision, scale); | 613 | | } | 614 | | return false; | 615 | | } | 616 | | if constexpr (narrow_integral) { | 617 | | if (tmp < min_result || tmp > max_result) { | 618 | | if (params.is_strict) { | 619 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 620 | | from, int_type_name<FromCppT>, precision, scale); | 621 | | } | 622 | | return false; | 623 | | } | 624 | | } | 625 | | to = DecimalV2Value(static_cast<typename ToCppT::NativeType>(tmp)); | 626 | 2 | } else { | 627 | 2 | tmp = scale_multiplier * from; | 628 | | if constexpr (narrow_integral) { | 629 | | if (tmp < min_result || tmp > max_result) { | 630 | | if (params.is_strict) { | 631 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 632 | | from, int_type_name<FromCppT>, precision, scale); | 633 | | } | 634 | | return false; | 635 | | } | 636 | | } | 637 | 2 | to = DecimalV2Value(static_cast<typename ToCppT::NativeType>(tmp)); | 638 | 2 | } | 639 | | | 640 | 2 | return true; | 641 | 2 | } |
_ZN5doris13CastToDecimal9_from_intIhNS_14DecimalV2ValueELb0ELb1EnQaa11IsDecimalV2IT0_Eoo12IsCppTypeIntIT_Esr3stdE9is_same_vIS4_hEEEbRKS4_RS3_jjRKT3_RKNS3_10NativeTypeESD_RNS_14CastParametersE Line | Count | Source | 606 | 4 | CastParameters& params) { | 607 | 4 | MaxNativeType tmp; | 608 | | if constexpr (multiply_may_overflow) { | 609 | | if (common::mul_overflow(static_cast<MaxNativeType>(from), scale_multiplier, tmp)) { | 610 | | if (params.is_strict) { | 611 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR(from, int_type_name<FromCppT>, | 612 | | precision, scale); | 613 | | } | 614 | | return false; | 615 | | } | 616 | | if constexpr (narrow_integral) { | 617 | | if (tmp < min_result || tmp > max_result) { | 618 | | if (params.is_strict) { | 619 | | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 620 | | from, int_type_name<FromCppT>, precision, scale); | 621 | | } | 622 | | return false; | 623 | | } | 624 | | } | 625 | | to = DecimalV2Value(static_cast<typename ToCppT::NativeType>(tmp)); | 626 | 4 | } else { | 627 | 4 | tmp = scale_multiplier * from; | 628 | 4 | if constexpr (narrow_integral) { | 629 | 4 | if (tmp < min_result || tmp > max_result) { | 630 | 2 | if (params.is_strict) { | 631 | 1 | params.status = DECIMAL_CONVERT_OVERFLOW_ERROR( | 632 | 1 | from, int_type_name<FromCppT>, precision, scale); | 633 | 1 | } | 634 | 2 | return false; | 635 | 2 | } | 636 | 4 | } | 637 | 2 | to = DecimalV2Value(static_cast<typename ToCppT::NativeType>(tmp)); | 638 | 4 | } | 639 | | | 640 | 0 | return true; | 641 | 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 |
642 | | }; |
643 | | |
644 | | // Casting from string to decimal types. |
645 | | template <CastModeType Mode, typename ToDataType> |
646 | | requires(IsDataTypeDecimal<ToDataType>) |
647 | | class CastToImpl<Mode, DataTypeString, ToDataType> : public CastToBase { |
648 | | Status execute_impl(FunctionContext* context, Block& block, const ColumnNumbers& arguments, |
649 | | uint32_t result, size_t input_rows_count, |
650 | 5.86k | const NullMap::value_type* null_map = nullptr) const override { |
651 | 5.86k | const auto* col_from = check_and_get_column<DataTypeString::ColumnType>( |
652 | 5.86k | block.get_by_position(arguments[0]).column.get()); |
653 | | |
654 | 5.86k | auto to_type = block.get_by_position(result).type; |
655 | 5.86k | auto serde = remove_nullable(to_type)->get_serde(); |
656 | | |
657 | | // by default framework, to_type is already unwrapped nullable |
658 | 5.86k | MutableColumnPtr column_to = to_type->create_column(); |
659 | 5.86k | ColumnNullable::MutablePtr nullable_col_to = ColumnNullable::create( |
660 | 5.86k | std::move(column_to), ColumnUInt8::create(input_rows_count, 0)); |
661 | | |
662 | 5.86k | if constexpr (Mode == CastModeType::NonStrictMode) { |
663 | | // may write nulls to nullable_col_to |
664 | 2.89k | RETURN_IF_ERROR(serde->from_string_batch(*col_from, *nullable_col_to, {})); |
665 | 2.96k | } else if constexpr (Mode == CastModeType::StrictMode) { |
666 | | // WON'T write nulls to nullable_col_to, just raise errors. null_map is only used to skip invalid rows |
667 | 2.96k | RETURN_IF_ERROR(serde->from_string_strict_mode_batch( |
668 | 2.96k | *col_from, nullable_col_to->get_nested_column(), {}, null_map)); |
669 | | } else { |
670 | | return Status::InternalError("Unsupported cast mode"); |
671 | | } |
672 | | |
673 | 5.45k | block.get_by_position(result).column = std::move(nullable_col_to); |
674 | 5.86k | return Status::OK(); |
675 | 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 | 650 | 854 | const NullMap::value_type* null_map = nullptr) const override { | 651 | 854 | const auto* col_from = check_and_get_column<DataTypeString::ColumnType>( | 652 | 854 | block.get_by_position(arguments[0]).column.get()); | 653 | | | 654 | 854 | auto to_type = block.get_by_position(result).type; | 655 | 854 | auto serde = remove_nullable(to_type)->get_serde(); | 656 | | | 657 | | // by default framework, to_type is already unwrapped nullable | 658 | 854 | MutableColumnPtr column_to = to_type->create_column(); | 659 | 854 | ColumnNullable::MutablePtr nullable_col_to = ColumnNullable::create( | 660 | 854 | std::move(column_to), ColumnUInt8::create(input_rows_count, 0)); | 661 | | | 662 | | if constexpr (Mode == CastModeType::NonStrictMode) { | 663 | | // may write nulls to nullable_col_to | 664 | | RETURN_IF_ERROR(serde->from_string_batch(*col_from, *nullable_col_to, {})); | 665 | 854 | } else if constexpr (Mode == CastModeType::StrictMode) { | 666 | | // WON'T write nulls to nullable_col_to, just raise errors. null_map is only used to skip invalid rows | 667 | 854 | RETURN_IF_ERROR(serde->from_string_strict_mode_batch( | 668 | 854 | *col_from, nullable_col_to->get_nested_column(), {}, null_map)); | 669 | | } else { | 670 | | return Status::InternalError("Unsupported cast mode"); | 671 | | } | 672 | | | 673 | 665 | block.get_by_position(result).column = std::move(nullable_col_to); | 674 | 854 | return Status::OK(); | 675 | 854 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeStringENS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 650 | 782 | const NullMap::value_type* null_map = nullptr) const override { | 651 | 782 | const auto* col_from = check_and_get_column<DataTypeString::ColumnType>( | 652 | 782 | block.get_by_position(arguments[0]).column.get()); | 653 | | | 654 | 782 | auto to_type = block.get_by_position(result).type; | 655 | 782 | auto serde = remove_nullable(to_type)->get_serde(); | 656 | | | 657 | | // by default framework, to_type is already unwrapped nullable | 658 | 782 | MutableColumnPtr column_to = to_type->create_column(); | 659 | 782 | ColumnNullable::MutablePtr nullable_col_to = ColumnNullable::create( | 660 | 782 | std::move(column_to), ColumnUInt8::create(input_rows_count, 0)); | 661 | | | 662 | 782 | if constexpr (Mode == CastModeType::NonStrictMode) { | 663 | | // may write nulls to nullable_col_to | 664 | 782 | RETURN_IF_ERROR(serde->from_string_batch(*col_from, *nullable_col_to, {})); | 665 | | } else if constexpr (Mode == CastModeType::StrictMode) { | 666 | | // WON'T write nulls to nullable_col_to, just raise errors. null_map is only used to skip invalid rows | 667 | | RETURN_IF_ERROR(serde->from_string_strict_mode_batch( | 668 | | *col_from, nullable_col_to->get_nested_column(), {}, null_map)); | 669 | | } else { | 670 | | return Status::InternalError("Unsupported cast mode"); | 671 | | } | 672 | | | 673 | 782 | block.get_by_position(result).column = std::move(nullable_col_to); | 674 | 782 | return Status::OK(); | 675 | 782 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeStringENS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 650 | 709 | const NullMap::value_type* null_map = nullptr) const override { | 651 | 709 | const auto* col_from = check_and_get_column<DataTypeString::ColumnType>( | 652 | 709 | block.get_by_position(arguments[0]).column.get()); | 653 | | | 654 | 709 | auto to_type = block.get_by_position(result).type; | 655 | 709 | auto serde = remove_nullable(to_type)->get_serde(); | 656 | | | 657 | | // by default framework, to_type is already unwrapped nullable | 658 | 709 | MutableColumnPtr column_to = to_type->create_column(); | 659 | 709 | ColumnNullable::MutablePtr nullable_col_to = ColumnNullable::create( | 660 | 709 | std::move(column_to), ColumnUInt8::create(input_rows_count, 0)); | 661 | | | 662 | | if constexpr (Mode == CastModeType::NonStrictMode) { | 663 | | // may write nulls to nullable_col_to | 664 | | RETURN_IF_ERROR(serde->from_string_batch(*col_from, *nullable_col_to, {})); | 665 | 709 | } else if constexpr (Mode == CastModeType::StrictMode) { | 666 | | // WON'T write nulls to nullable_col_to, just raise errors. null_map is only used to skip invalid rows | 667 | 709 | RETURN_IF_ERROR(serde->from_string_strict_mode_batch( | 668 | 709 | *col_from, nullable_col_to->get_nested_column(), {}, null_map)); | 669 | | } else { | 670 | | return Status::InternalError("Unsupported cast mode"); | 671 | | } | 672 | | | 673 | 631 | block.get_by_position(result).column = std::move(nullable_col_to); | 674 | 709 | return Status::OK(); | 675 | 709 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeStringENS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 650 | 709 | const NullMap::value_type* null_map = nullptr) const override { | 651 | 709 | const auto* col_from = check_and_get_column<DataTypeString::ColumnType>( | 652 | 709 | block.get_by_position(arguments[0]).column.get()); | 653 | | | 654 | 709 | auto to_type = block.get_by_position(result).type; | 655 | 709 | auto serde = remove_nullable(to_type)->get_serde(); | 656 | | | 657 | | // by default framework, to_type is already unwrapped nullable | 658 | 709 | MutableColumnPtr column_to = to_type->create_column(); | 659 | 709 | ColumnNullable::MutablePtr nullable_col_to = ColumnNullable::create( | 660 | 709 | std::move(column_to), ColumnUInt8::create(input_rows_count, 0)); | 661 | | | 662 | 709 | if constexpr (Mode == CastModeType::NonStrictMode) { | 663 | | // may write nulls to nullable_col_to | 664 | 709 | RETURN_IF_ERROR(serde->from_string_batch(*col_from, *nullable_col_to, {})); | 665 | | } else if constexpr (Mode == CastModeType::StrictMode) { | 666 | | // WON'T write nulls to nullable_col_to, just raise errors. null_map is only used to skip invalid rows | 667 | | RETURN_IF_ERROR(serde->from_string_strict_mode_batch( | 668 | | *col_from, nullable_col_to->get_nested_column(), {}, null_map)); | 669 | | } else { | 670 | | return Status::InternalError("Unsupported cast mode"); | 671 | | } | 672 | | | 673 | 709 | block.get_by_position(result).column = std::move(nullable_col_to); | 674 | 709 | return Status::OK(); | 675 | 709 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeStringENS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 650 | 709 | const NullMap::value_type* null_map = nullptr) const override { | 651 | 709 | const auto* col_from = check_and_get_column<DataTypeString::ColumnType>( | 652 | 709 | block.get_by_position(arguments[0]).column.get()); | 653 | | | 654 | 709 | auto to_type = block.get_by_position(result).type; | 655 | 709 | auto serde = remove_nullable(to_type)->get_serde(); | 656 | | | 657 | | // by default framework, to_type is already unwrapped nullable | 658 | 709 | MutableColumnPtr column_to = to_type->create_column(); | 659 | 709 | ColumnNullable::MutablePtr nullable_col_to = ColumnNullable::create( | 660 | 709 | std::move(column_to), ColumnUInt8::create(input_rows_count, 0)); | 661 | | | 662 | | if constexpr (Mode == CastModeType::NonStrictMode) { | 663 | | // may write nulls to nullable_col_to | 664 | | RETURN_IF_ERROR(serde->from_string_batch(*col_from, *nullable_col_to, {})); | 665 | 709 | } else if constexpr (Mode == CastModeType::StrictMode) { | 666 | | // WON'T write nulls to nullable_col_to, just raise errors. null_map is only used to skip invalid rows | 667 | 709 | RETURN_IF_ERROR(serde->from_string_strict_mode_batch( | 668 | 709 | *col_from, nullable_col_to->get_nested_column(), {}, null_map)); | 669 | | } else { | 670 | | return Status::InternalError("Unsupported cast mode"); | 671 | | } | 672 | | | 673 | 631 | block.get_by_position(result).column = std::move(nullable_col_to); | 674 | 709 | return Status::OK(); | 675 | 709 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeStringENS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 650 | 709 | const NullMap::value_type* null_map = nullptr) const override { | 651 | 709 | const auto* col_from = check_and_get_column<DataTypeString::ColumnType>( | 652 | 709 | block.get_by_position(arguments[0]).column.get()); | 653 | | | 654 | 709 | auto to_type = block.get_by_position(result).type; | 655 | 709 | auto serde = remove_nullable(to_type)->get_serde(); | 656 | | | 657 | | // by default framework, to_type is already unwrapped nullable | 658 | 709 | MutableColumnPtr column_to = to_type->create_column(); | 659 | 709 | ColumnNullable::MutablePtr nullable_col_to = ColumnNullable::create( | 660 | 709 | std::move(column_to), ColumnUInt8::create(input_rows_count, 0)); | 661 | | | 662 | 709 | if constexpr (Mode == CastModeType::NonStrictMode) { | 663 | | // may write nulls to nullable_col_to | 664 | 709 | RETURN_IF_ERROR(serde->from_string_batch(*col_from, *nullable_col_to, {})); | 665 | | } else if constexpr (Mode == CastModeType::StrictMode) { | 666 | | // WON'T write nulls to nullable_col_to, just raise errors. null_map is only used to skip invalid rows | 667 | | RETURN_IF_ERROR(serde->from_string_strict_mode_batch( | 668 | | *col_from, nullable_col_to->get_nested_column(), {}, null_map)); | 669 | | } else { | 670 | | return Status::InternalError("Unsupported cast mode"); | 671 | | } | 672 | | | 673 | 709 | block.get_by_position(result).column = std::move(nullable_col_to); | 674 | 709 | return Status::OK(); | 675 | 709 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeStringENS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 650 | 695 | const NullMap::value_type* null_map = nullptr) const override { | 651 | 695 | const auto* col_from = check_and_get_column<DataTypeString::ColumnType>( | 652 | 695 | block.get_by_position(arguments[0]).column.get()); | 653 | | | 654 | 695 | auto to_type = block.get_by_position(result).type; | 655 | 695 | auto serde = remove_nullable(to_type)->get_serde(); | 656 | | | 657 | | // by default framework, to_type is already unwrapped nullable | 658 | 695 | MutableColumnPtr column_to = to_type->create_column(); | 659 | 695 | ColumnNullable::MutablePtr nullable_col_to = ColumnNullable::create( | 660 | 695 | std::move(column_to), ColumnUInt8::create(input_rows_count, 0)); | 661 | | | 662 | | if constexpr (Mode == CastModeType::NonStrictMode) { | 663 | | // may write nulls to nullable_col_to | 664 | | RETURN_IF_ERROR(serde->from_string_batch(*col_from, *nullable_col_to, {})); | 665 | 695 | } else if constexpr (Mode == CastModeType::StrictMode) { | 666 | | // WON'T write nulls to nullable_col_to, just raise errors. null_map is only used to skip invalid rows | 667 | 695 | RETURN_IF_ERROR(serde->from_string_strict_mode_batch( | 668 | 695 | *col_from, nullable_col_to->get_nested_column(), {}, null_map)); | 669 | | } else { | 670 | | return Status::InternalError("Unsupported cast mode"); | 671 | | } | 672 | | | 673 | 631 | block.get_by_position(result).column = std::move(nullable_col_to); | 674 | 695 | return Status::OK(); | 675 | 695 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeStringENS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 650 | 695 | const NullMap::value_type* null_map = nullptr) const override { | 651 | 695 | const auto* col_from = check_and_get_column<DataTypeString::ColumnType>( | 652 | 695 | block.get_by_position(arguments[0]).column.get()); | 653 | | | 654 | 695 | auto to_type = block.get_by_position(result).type; | 655 | 695 | auto serde = remove_nullable(to_type)->get_serde(); | 656 | | | 657 | | // by default framework, to_type is already unwrapped nullable | 658 | 695 | MutableColumnPtr column_to = to_type->create_column(); | 659 | 695 | ColumnNullable::MutablePtr nullable_col_to = ColumnNullable::create( | 660 | 695 | std::move(column_to), ColumnUInt8::create(input_rows_count, 0)); | 661 | | | 662 | 695 | if constexpr (Mode == CastModeType::NonStrictMode) { | 663 | | // may write nulls to nullable_col_to | 664 | 695 | RETURN_IF_ERROR(serde->from_string_batch(*col_from, *nullable_col_to, {})); | 665 | | } else if constexpr (Mode == CastModeType::StrictMode) { | 666 | | // WON'T write nulls to nullable_col_to, just raise errors. null_map is only used to skip invalid rows | 667 | | RETURN_IF_ERROR(serde->from_string_strict_mode_batch( | 668 | | *col_from, nullable_col_to->get_nested_column(), {}, null_map)); | 669 | | } else { | 670 | | return Status::InternalError("Unsupported cast mode"); | 671 | | } | 672 | | | 673 | 695 | block.get_by_position(result).column = std::move(nullable_col_to); | 674 | 695 | return Status::OK(); | 675 | 695 | } |
|
676 | | }; |
677 | | |
678 | | // cast bool and int to decimal. when may overflow, result column is nullable. |
679 | | template <CastModeType CastMode, typename FromDataType, typename ToDataType> |
680 | | requires(IsDataTypeDecimal<ToDataType> && |
681 | | (IsDataTypeInt<FromDataType> || IsDataTypeBool<FromDataType>)) |
682 | | class CastToImpl<CastMode, FromDataType, ToDataType> : public CastToBase { |
683 | | public: |
684 | | Status execute_impl(FunctionContext* context, Block& block, const ColumnNumbers& arguments, |
685 | | uint32_t result, size_t input_rows_count, |
686 | 782 | const NullMap::value_type* null_map = nullptr) const override { |
687 | 782 | using FromFieldType = typename FromDataType::FieldType; |
688 | 782 | using ToFieldType = typename ToDataType::FieldType; |
689 | 782 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); |
690 | 782 | const auto* col_from = |
691 | 782 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); |
692 | 782 | if (!col_from) { |
693 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", |
694 | 0 | named_from.column->get_name()); |
695 | 0 | } |
696 | | |
697 | 782 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); |
698 | 782 | constexpr UInt32 from_scale = 0; |
699 | | |
700 | 782 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); |
701 | 782 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); |
702 | 782 | UInt32 to_precision = to_decimal_type.get_precision(); |
703 | 782 | ToDataType::check_type_precision(to_precision); |
704 | 782 | UInt32 to_scale = to_decimal_type.get_scale(); |
705 | 782 | ToDataType::check_type_scale(to_scale); |
706 | | |
707 | 782 | auto from_max_int_digit_count = from_precision - from_scale; |
708 | 782 | auto to_max_int_digit_count = to_precision - to_scale; |
709 | | // may overflow. nullable result column. |
710 | 782 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); |
711 | | // only in non-strict mode and may overflow, we set nullable |
712 | 782 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; |
713 | | |
714 | 782 | constexpr UInt32 to_max_digits = |
715 | 782 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); |
716 | 782 | bool multiply_may_overflow = false; |
717 | 782 | if (to_scale > from_scale) { |
718 | 483 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; |
719 | 483 | } |
720 | 782 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > |
721 | 782 | sizeof(typename ToFieldType::NativeType)), |
722 | 782 | FromFieldType, typename ToFieldType::NativeType>; |
723 | 782 | MaxNativeType scale_multiplier = |
724 | 782 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); |
725 | 782 | typename ToFieldType::NativeType max_result = |
726 | 782 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); |
727 | 782 | typename ToFieldType::NativeType min_result = -max_result; |
728 | | |
729 | 782 | ColumnUInt8::MutablePtr col_null_map_to; |
730 | 782 | NullMap::value_type* null_map_data = nullptr; |
731 | 782 | if (narrow_integral) { |
732 | 673 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); |
733 | 673 | null_map_data = col_null_map_to->get_data().data(); |
734 | 673 | } |
735 | | |
736 | 782 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); |
737 | 782 | const auto& vec_from = col_from->get_data(); |
738 | 782 | const auto* vec_from_data = vec_from.data(); |
739 | 782 | auto& vec_to = col_to->get_data(); |
740 | 782 | auto* vec_to_data = vec_to.data(); |
741 | | |
742 | 782 | CastParameters params; |
743 | 782 | params.is_strict = (CastMode == CastModeType::StrictMode); |
744 | 782 | size_t size = vec_from.size(); |
745 | | |
746 | 782 | RETURN_IF_ERROR(std::visit( |
747 | 782 | [&](auto multiply_may_overflow, auto narrow_integral) { |
748 | 782 | for (size_t i = 0; i < size; i++) { |
749 | 782 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, |
750 | 782 | typename ToDataType::FieldType, |
751 | 782 | multiply_may_overflow, narrow_integral>( |
752 | 782 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, |
753 | 782 | scale_multiplier, min_result, max_result, params)) { |
754 | 782 | if (set_nullable) { |
755 | 782 | null_map_data[i] = 1; |
756 | 782 | } else { |
757 | 782 | return params.status; |
758 | 782 | } |
759 | 782 | } |
760 | 782 | } |
761 | 782 | return Status::OK(); |
762 | 782 | }, |
763 | 782 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); |
764 | | |
765 | 401 | if (narrow_integral) { |
766 | 292 | block.get_by_position(result).column = |
767 | 292 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); |
768 | 292 | } else { |
769 | 109 | block.get_by_position(result).column = std::move(col_to); |
770 | 109 | } |
771 | 401 | return Status::OK(); |
772 | 782 | } _ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE2EEENS_15DataTypeDecimalILS3_20EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 686 | 2 | const NullMap::value_type* null_map = nullptr) const override { | 687 | 2 | using FromFieldType = typename FromDataType::FieldType; | 688 | 2 | using ToFieldType = typename ToDataType::FieldType; | 689 | 2 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 690 | 2 | const auto* col_from = | 691 | 2 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 692 | 2 | if (!col_from) { | 693 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 694 | 0 | named_from.column->get_name()); | 695 | 0 | } | 696 | | | 697 | 2 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 698 | 2 | constexpr UInt32 from_scale = 0; | 699 | | | 700 | 2 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 701 | 2 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 702 | 2 | UInt32 to_precision = to_decimal_type.get_precision(); | 703 | 2 | ToDataType::check_type_precision(to_precision); | 704 | 2 | UInt32 to_scale = to_decimal_type.get_scale(); | 705 | 2 | ToDataType::check_type_scale(to_scale); | 706 | | | 707 | 2 | auto from_max_int_digit_count = from_precision - from_scale; | 708 | 2 | auto to_max_int_digit_count = to_precision - to_scale; | 709 | | // may overflow. nullable result column. | 710 | 2 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 711 | | // only in non-strict mode and may overflow, we set nullable | 712 | 2 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 713 | | | 714 | 2 | constexpr UInt32 to_max_digits = | 715 | 2 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 716 | 2 | bool multiply_may_overflow = false; | 717 | 2 | if (to_scale > from_scale) { | 718 | 2 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 719 | 2 | } | 720 | 2 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 721 | 2 | sizeof(typename ToFieldType::NativeType)), | 722 | 2 | FromFieldType, typename ToFieldType::NativeType>; | 723 | 2 | MaxNativeType scale_multiplier = | 724 | 2 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 725 | 2 | typename ToFieldType::NativeType max_result = | 726 | 2 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 727 | 2 | typename ToFieldType::NativeType min_result = -max_result; | 728 | | | 729 | 2 | ColumnUInt8::MutablePtr col_null_map_to; | 730 | 2 | NullMap::value_type* null_map_data = nullptr; | 731 | 2 | if (narrow_integral) { | 732 | 2 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 733 | 2 | null_map_data = col_null_map_to->get_data().data(); | 734 | 2 | } | 735 | | | 736 | 2 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 737 | 2 | const auto& vec_from = col_from->get_data(); | 738 | 2 | const auto* vec_from_data = vec_from.data(); | 739 | 2 | auto& vec_to = col_to->get_data(); | 740 | 2 | auto* vec_to_data = vec_to.data(); | 741 | | | 742 | 2 | CastParameters params; | 743 | 2 | params.is_strict = (CastMode == CastModeType::StrictMode); | 744 | 2 | size_t size = vec_from.size(); | 745 | | | 746 | 2 | RETURN_IF_ERROR(std::visit( | 747 | 2 | [&](auto multiply_may_overflow, auto narrow_integral) { | 748 | 2 | for (size_t i = 0; i < size; i++) { | 749 | 2 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 750 | 2 | typename ToDataType::FieldType, | 751 | 2 | multiply_may_overflow, narrow_integral>( | 752 | 2 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 753 | 2 | scale_multiplier, min_result, max_result, params)) { | 754 | 2 | if (set_nullable) { | 755 | 2 | null_map_data[i] = 1; | 756 | 2 | } else { | 757 | 2 | return params.status; | 758 | 2 | } | 759 | 2 | } | 760 | 2 | } | 761 | 2 | return Status::OK(); | 762 | 2 | }, | 763 | 2 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 764 | | | 765 | 1 | if (narrow_integral) { | 766 | 1 | block.get_by_position(result).column = | 767 | 1 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 768 | 1 | } else { | 769 | 0 | block.get_by_position(result).column = std::move(col_to); | 770 | 0 | } | 771 | 1 | return Status::OK(); | 772 | 2 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE2EEENS_15DataTypeDecimalILS3_20EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 686 | 2 | const NullMap::value_type* null_map = nullptr) const override { | 687 | 2 | using FromFieldType = typename FromDataType::FieldType; | 688 | 2 | using ToFieldType = typename ToDataType::FieldType; | 689 | 2 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 690 | 2 | const auto* col_from = | 691 | 2 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 692 | 2 | if (!col_from) { | 693 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 694 | 0 | named_from.column->get_name()); | 695 | 0 | } | 696 | | | 697 | 2 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 698 | 2 | constexpr UInt32 from_scale = 0; | 699 | | | 700 | 2 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 701 | 2 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 702 | 2 | UInt32 to_precision = to_decimal_type.get_precision(); | 703 | 2 | ToDataType::check_type_precision(to_precision); | 704 | 2 | UInt32 to_scale = to_decimal_type.get_scale(); | 705 | 2 | ToDataType::check_type_scale(to_scale); | 706 | | | 707 | 2 | auto from_max_int_digit_count = from_precision - from_scale; | 708 | 2 | auto to_max_int_digit_count = to_precision - to_scale; | 709 | | // may overflow. nullable result column. | 710 | 2 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 711 | | // only in non-strict mode and may overflow, we set nullable | 712 | 2 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 713 | | | 714 | 2 | constexpr UInt32 to_max_digits = | 715 | 2 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 716 | 2 | bool multiply_may_overflow = false; | 717 | 2 | if (to_scale > from_scale) { | 718 | 2 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 719 | 2 | } | 720 | 2 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 721 | 2 | sizeof(typename ToFieldType::NativeType)), | 722 | 2 | FromFieldType, typename ToFieldType::NativeType>; | 723 | 2 | MaxNativeType scale_multiplier = | 724 | 2 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 725 | 2 | typename ToFieldType::NativeType max_result = | 726 | 2 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 727 | 2 | typename ToFieldType::NativeType min_result = -max_result; | 728 | | | 729 | 2 | ColumnUInt8::MutablePtr col_null_map_to; | 730 | 2 | NullMap::value_type* null_map_data = nullptr; | 731 | 2 | if (narrow_integral) { | 732 | 1 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 733 | 1 | null_map_data = col_null_map_to->get_data().data(); | 734 | 1 | } | 735 | | | 736 | 2 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 737 | 2 | const auto& vec_from = col_from->get_data(); | 738 | 2 | const auto* vec_from_data = vec_from.data(); | 739 | 2 | auto& vec_to = col_to->get_data(); | 740 | 2 | auto* vec_to_data = vec_to.data(); | 741 | | | 742 | 2 | CastParameters params; | 743 | 2 | params.is_strict = (CastMode == CastModeType::StrictMode); | 744 | 2 | size_t size = vec_from.size(); | 745 | | | 746 | 2 | RETURN_IF_ERROR(std::visit( | 747 | 2 | [&](auto multiply_may_overflow, auto narrow_integral) { | 748 | 2 | for (size_t i = 0; i < size; i++) { | 749 | 2 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 750 | 2 | typename ToDataType::FieldType, | 751 | 2 | multiply_may_overflow, narrow_integral>( | 752 | 2 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 753 | 2 | scale_multiplier, min_result, max_result, params)) { | 754 | 2 | if (set_nullable) { | 755 | 2 | null_map_data[i] = 1; | 756 | 2 | } else { | 757 | 2 | return params.status; | 758 | 2 | } | 759 | 2 | } | 760 | 2 | } | 761 | 2 | return Status::OK(); | 762 | 2 | }, | 763 | 2 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 764 | | | 765 | 2 | if (narrow_integral) { | 766 | 1 | block.get_by_position(result).column = | 767 | 1 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 768 | 1 | } else { | 769 | 1 | block.get_by_position(result).column = std::move(col_to); | 770 | 1 | } | 771 | 2 | return Status::OK(); | 772 | 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 | 686 | 2 | const NullMap::value_type* null_map = nullptr) const override { | 687 | 2 | using FromFieldType = typename FromDataType::FieldType; | 688 | 2 | using ToFieldType = typename ToDataType::FieldType; | 689 | 2 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 690 | 2 | const auto* col_from = | 691 | 2 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 692 | 2 | if (!col_from) { | 693 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 694 | 0 | named_from.column->get_name()); | 695 | 0 | } | 696 | | | 697 | 2 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 698 | 2 | constexpr UInt32 from_scale = 0; | 699 | | | 700 | 2 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 701 | 2 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 702 | 2 | UInt32 to_precision = to_decimal_type.get_precision(); | 703 | 2 | ToDataType::check_type_precision(to_precision); | 704 | 2 | UInt32 to_scale = to_decimal_type.get_scale(); | 705 | 2 | ToDataType::check_type_scale(to_scale); | 706 | | | 707 | 2 | auto from_max_int_digit_count = from_precision - from_scale; | 708 | 2 | auto to_max_int_digit_count = to_precision - to_scale; | 709 | | // may overflow. nullable result column. | 710 | 2 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 711 | | // only in non-strict mode and may overflow, we set nullable | 712 | 2 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 713 | | | 714 | 2 | constexpr UInt32 to_max_digits = | 715 | 2 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 716 | 2 | bool multiply_may_overflow = false; | 717 | 2 | if (to_scale > from_scale) { | 718 | 2 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 719 | 2 | } | 720 | 2 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 721 | 2 | sizeof(typename ToFieldType::NativeType)), | 722 | 2 | FromFieldType, typename ToFieldType::NativeType>; | 723 | 2 | MaxNativeType scale_multiplier = | 724 | 2 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 725 | 2 | typename ToFieldType::NativeType max_result = | 726 | 2 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 727 | 2 | typename ToFieldType::NativeType min_result = -max_result; | 728 | | | 729 | 2 | ColumnUInt8::MutablePtr col_null_map_to; | 730 | 2 | NullMap::value_type* null_map_data = nullptr; | 731 | 2 | if (narrow_integral) { | 732 | 2 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 733 | 2 | null_map_data = col_null_map_to->get_data().data(); | 734 | 2 | } | 735 | | | 736 | 2 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 737 | 2 | const auto& vec_from = col_from->get_data(); | 738 | 2 | const auto* vec_from_data = vec_from.data(); | 739 | 2 | auto& vec_to = col_to->get_data(); | 740 | 2 | auto* vec_to_data = vec_to.data(); | 741 | | | 742 | 2 | CastParameters params; | 743 | 2 | params.is_strict = (CastMode == CastModeType::StrictMode); | 744 | 2 | size_t size = vec_from.size(); | 745 | | | 746 | 2 | RETURN_IF_ERROR(std::visit( | 747 | 2 | [&](auto multiply_may_overflow, auto narrow_integral) { | 748 | 2 | for (size_t i = 0; i < size; i++) { | 749 | 2 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 750 | 2 | typename ToDataType::FieldType, | 751 | 2 | multiply_may_overflow, narrow_integral>( | 752 | 2 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 753 | 2 | scale_multiplier, min_result, max_result, params)) { | 754 | 2 | if (set_nullable) { | 755 | 2 | null_map_data[i] = 1; | 756 | 2 | } else { | 757 | 2 | return params.status; | 758 | 2 | } | 759 | 2 | } | 760 | 2 | } | 761 | 2 | return Status::OK(); | 762 | 2 | }, | 763 | 2 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 764 | | | 765 | 1 | if (narrow_integral) { | 766 | 1 | block.get_by_position(result).column = | 767 | 1 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 768 | 1 | } else { | 769 | 0 | block.get_by_position(result).column = std::move(col_to); | 770 | 0 | } | 771 | 1 | return Status::OK(); | 772 | 2 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE2EEENS_15DataTypeDecimalILS3_28EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 686 | 5 | const NullMap::value_type* null_map = nullptr) const override { | 687 | 5 | using FromFieldType = typename FromDataType::FieldType; | 688 | 5 | using ToFieldType = typename ToDataType::FieldType; | 689 | 5 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 690 | 5 | const auto* col_from = | 691 | 5 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 692 | 5 | if (!col_from) { | 693 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 694 | 0 | named_from.column->get_name()); | 695 | 0 | } | 696 | | | 697 | 5 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 698 | 5 | constexpr UInt32 from_scale = 0; | 699 | | | 700 | 5 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 701 | 5 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 702 | 5 | UInt32 to_precision = to_decimal_type.get_precision(); | 703 | 5 | ToDataType::check_type_precision(to_precision); | 704 | 5 | UInt32 to_scale = to_decimal_type.get_scale(); | 705 | 5 | ToDataType::check_type_scale(to_scale); | 706 | | | 707 | 5 | auto from_max_int_digit_count = from_precision - from_scale; | 708 | 5 | auto to_max_int_digit_count = to_precision - to_scale; | 709 | | // may overflow. nullable result column. | 710 | 5 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 711 | | // only in non-strict mode and may overflow, we set nullable | 712 | 5 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 713 | | | 714 | 5 | constexpr UInt32 to_max_digits = | 715 | 5 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 716 | 5 | bool multiply_may_overflow = false; | 717 | 5 | if (to_scale > from_scale) { | 718 | 4 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 719 | 4 | } | 720 | 5 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 721 | 5 | sizeof(typename ToFieldType::NativeType)), | 722 | 5 | FromFieldType, typename ToFieldType::NativeType>; | 723 | 5 | MaxNativeType scale_multiplier = | 724 | 5 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 725 | 5 | typename ToFieldType::NativeType max_result = | 726 | 5 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 727 | 5 | typename ToFieldType::NativeType min_result = -max_result; | 728 | | | 729 | 5 | ColumnUInt8::MutablePtr col_null_map_to; | 730 | 5 | NullMap::value_type* null_map_data = nullptr; | 731 | 5 | if (narrow_integral) { | 732 | 1 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 733 | 1 | null_map_data = col_null_map_to->get_data().data(); | 734 | 1 | } | 735 | | | 736 | 5 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 737 | 5 | const auto& vec_from = col_from->get_data(); | 738 | 5 | const auto* vec_from_data = vec_from.data(); | 739 | 5 | auto& vec_to = col_to->get_data(); | 740 | 5 | auto* vec_to_data = vec_to.data(); | 741 | | | 742 | 5 | CastParameters params; | 743 | 5 | params.is_strict = (CastMode == CastModeType::StrictMode); | 744 | 5 | size_t size = vec_from.size(); | 745 | | | 746 | 5 | RETURN_IF_ERROR(std::visit( | 747 | 5 | [&](auto multiply_may_overflow, auto narrow_integral) { | 748 | 5 | for (size_t i = 0; i < size; i++) { | 749 | 5 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 750 | 5 | typename ToDataType::FieldType, | 751 | 5 | multiply_may_overflow, narrow_integral>( | 752 | 5 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 753 | 5 | scale_multiplier, min_result, max_result, params)) { | 754 | 5 | if (set_nullable) { | 755 | 5 | null_map_data[i] = 1; | 756 | 5 | } else { | 757 | 5 | return params.status; | 758 | 5 | } | 759 | 5 | } | 760 | 5 | } | 761 | 5 | return Status::OK(); | 762 | 5 | }, | 763 | 5 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 764 | | | 765 | 5 | if (narrow_integral) { | 766 | 1 | block.get_by_position(result).column = | 767 | 1 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 768 | 4 | } else { | 769 | 4 | block.get_by_position(result).column = std::move(col_to); | 770 | 4 | } | 771 | 5 | return Status::OK(); | 772 | 5 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE3EEENS_15DataTypeDecimalILS3_28EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 686 | 23 | const NullMap::value_type* null_map = nullptr) const override { | 687 | 23 | using FromFieldType = typename FromDataType::FieldType; | 688 | 23 | using ToFieldType = typename ToDataType::FieldType; | 689 | 23 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 690 | 23 | const auto* col_from = | 691 | 23 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 692 | 23 | if (!col_from) { | 693 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 694 | 0 | named_from.column->get_name()); | 695 | 0 | } | 696 | | | 697 | 23 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 698 | 23 | constexpr UInt32 from_scale = 0; | 699 | | | 700 | 23 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 701 | 23 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 702 | 23 | UInt32 to_precision = to_decimal_type.get_precision(); | 703 | 23 | ToDataType::check_type_precision(to_precision); | 704 | 23 | UInt32 to_scale = to_decimal_type.get_scale(); | 705 | 23 | ToDataType::check_type_scale(to_scale); | 706 | | | 707 | 23 | auto from_max_int_digit_count = from_precision - from_scale; | 708 | 23 | auto to_max_int_digit_count = to_precision - to_scale; | 709 | | // may overflow. nullable result column. | 710 | 23 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 711 | | // only in non-strict mode and may overflow, we set nullable | 712 | 23 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 713 | | | 714 | 23 | constexpr UInt32 to_max_digits = | 715 | 23 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 716 | 23 | bool multiply_may_overflow = false; | 717 | 23 | if (to_scale > from_scale) { | 718 | 16 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 719 | 16 | } | 720 | 23 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 721 | 23 | sizeof(typename ToFieldType::NativeType)), | 722 | 23 | FromFieldType, typename ToFieldType::NativeType>; | 723 | 23 | MaxNativeType scale_multiplier = | 724 | 23 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 725 | 23 | typename ToFieldType::NativeType max_result = | 726 | 23 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 727 | 23 | typename ToFieldType::NativeType min_result = -max_result; | 728 | | | 729 | 23 | ColumnUInt8::MutablePtr col_null_map_to; | 730 | 23 | NullMap::value_type* null_map_data = nullptr; | 731 | 23 | if (narrow_integral) { | 732 | 20 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 733 | 20 | null_map_data = col_null_map_to->get_data().data(); | 734 | 20 | } | 735 | | | 736 | 23 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 737 | 23 | const auto& vec_from = col_from->get_data(); | 738 | 23 | const auto* vec_from_data = vec_from.data(); | 739 | 23 | auto& vec_to = col_to->get_data(); | 740 | 23 | auto* vec_to_data = vec_to.data(); | 741 | | | 742 | 23 | CastParameters params; | 743 | 23 | params.is_strict = (CastMode == CastModeType::StrictMode); | 744 | 23 | size_t size = vec_from.size(); | 745 | | | 746 | 23 | RETURN_IF_ERROR(std::visit( | 747 | 23 | [&](auto multiply_may_overflow, auto narrow_integral) { | 748 | 23 | for (size_t i = 0; i < size; i++) { | 749 | 23 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 750 | 23 | typename ToDataType::FieldType, | 751 | 23 | multiply_may_overflow, narrow_integral>( | 752 | 23 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 753 | 23 | scale_multiplier, min_result, max_result, params)) { | 754 | 23 | if (set_nullable) { | 755 | 23 | null_map_data[i] = 1; | 756 | 23 | } else { | 757 | 23 | return params.status; | 758 | 23 | } | 759 | 23 | } | 760 | 23 | } | 761 | 23 | return Status::OK(); | 762 | 23 | }, | 763 | 23 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 764 | | | 765 | 7 | if (narrow_integral) { | 766 | 4 | block.get_by_position(result).column = | 767 | 4 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 768 | 4 | } else { | 769 | 3 | block.get_by_position(result).column = std::move(col_to); | 770 | 3 | } | 771 | 7 | return Status::OK(); | 772 | 23 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE3EEENS_15DataTypeDecimalILS3_28EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 686 | 11 | const NullMap::value_type* null_map = nullptr) const override { | 687 | 11 | using FromFieldType = typename FromDataType::FieldType; | 688 | 11 | using ToFieldType = typename ToDataType::FieldType; | 689 | 11 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 690 | 11 | const auto* col_from = | 691 | 11 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 692 | 11 | if (!col_from) { | 693 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 694 | 0 | named_from.column->get_name()); | 695 | 0 | } | 696 | | | 697 | 11 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 698 | 11 | constexpr UInt32 from_scale = 0; | 699 | | | 700 | 11 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 701 | 11 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 702 | 11 | UInt32 to_precision = to_decimal_type.get_precision(); | 703 | 11 | ToDataType::check_type_precision(to_precision); | 704 | 11 | UInt32 to_scale = to_decimal_type.get_scale(); | 705 | 11 | ToDataType::check_type_scale(to_scale); | 706 | | | 707 | 11 | auto from_max_int_digit_count = from_precision - from_scale; | 708 | 11 | auto to_max_int_digit_count = to_precision - to_scale; | 709 | | // may overflow. nullable result column. | 710 | 11 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 711 | | // only in non-strict mode and may overflow, we set nullable | 712 | 11 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 713 | | | 714 | 11 | constexpr UInt32 to_max_digits = | 715 | 11 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 716 | 11 | bool multiply_may_overflow = false; | 717 | 11 | if (to_scale > from_scale) { | 718 | 7 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 719 | 7 | } | 720 | 11 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 721 | 11 | sizeof(typename ToFieldType::NativeType)), | 722 | 11 | FromFieldType, typename ToFieldType::NativeType>; | 723 | 11 | MaxNativeType scale_multiplier = | 724 | 11 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 725 | 11 | typename ToFieldType::NativeType max_result = | 726 | 11 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 727 | 11 | typename ToFieldType::NativeType min_result = -max_result; | 728 | | | 729 | 11 | ColumnUInt8::MutablePtr col_null_map_to; | 730 | 11 | NullMap::value_type* null_map_data = nullptr; | 731 | 11 | if (narrow_integral) { | 732 | 8 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 733 | 8 | null_map_data = col_null_map_to->get_data().data(); | 734 | 8 | } | 735 | | | 736 | 11 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 737 | 11 | const auto& vec_from = col_from->get_data(); | 738 | 11 | const auto* vec_from_data = vec_from.data(); | 739 | 11 | auto& vec_to = col_to->get_data(); | 740 | 11 | auto* vec_to_data = vec_to.data(); | 741 | | | 742 | 11 | CastParameters params; | 743 | 11 | params.is_strict = (CastMode == CastModeType::StrictMode); | 744 | 11 | size_t size = vec_from.size(); | 745 | | | 746 | 11 | RETURN_IF_ERROR(std::visit( | 747 | 11 | [&](auto multiply_may_overflow, auto narrow_integral) { | 748 | 11 | for (size_t i = 0; i < size; i++) { | 749 | 11 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 750 | 11 | typename ToDataType::FieldType, | 751 | 11 | multiply_may_overflow, narrow_integral>( | 752 | 11 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 753 | 11 | scale_multiplier, min_result, max_result, params)) { | 754 | 11 | if (set_nullable) { | 755 | 11 | null_map_data[i] = 1; | 756 | 11 | } else { | 757 | 11 | return params.status; | 758 | 11 | } | 759 | 11 | } | 760 | 11 | } | 761 | 11 | return Status::OK(); | 762 | 11 | }, | 763 | 11 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 764 | | | 765 | 11 | if (narrow_integral) { | 766 | 8 | block.get_by_position(result).column = | 767 | 8 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 768 | 8 | } else { | 769 | 3 | block.get_by_position(result).column = std::move(col_to); | 770 | 3 | } | 771 | 11 | return Status::OK(); | 772 | 11 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE4EEENS_15DataTypeDecimalILS3_28EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 686 | 27 | const NullMap::value_type* null_map = nullptr) const override { | 687 | 27 | using FromFieldType = typename FromDataType::FieldType; | 688 | 27 | using ToFieldType = typename ToDataType::FieldType; | 689 | 27 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 690 | 27 | const auto* col_from = | 691 | 27 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 692 | 27 | if (!col_from) { | 693 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 694 | 0 | named_from.column->get_name()); | 695 | 0 | } | 696 | | | 697 | 27 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 698 | 27 | constexpr UInt32 from_scale = 0; | 699 | | | 700 | 27 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 701 | 27 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 702 | 27 | UInt32 to_precision = to_decimal_type.get_precision(); | 703 | 27 | ToDataType::check_type_precision(to_precision); | 704 | 27 | UInt32 to_scale = to_decimal_type.get_scale(); | 705 | 27 | ToDataType::check_type_scale(to_scale); | 706 | | | 707 | 27 | auto from_max_int_digit_count = from_precision - from_scale; | 708 | 27 | auto to_max_int_digit_count = to_precision - to_scale; | 709 | | // may overflow. nullable result column. | 710 | 27 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 711 | | // only in non-strict mode and may overflow, we set nullable | 712 | 27 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 713 | | | 714 | 27 | constexpr UInt32 to_max_digits = | 715 | 27 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 716 | 27 | bool multiply_may_overflow = false; | 717 | 27 | if (to_scale > from_scale) { | 718 | 16 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 719 | 16 | } | 720 | 27 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 721 | 27 | sizeof(typename ToFieldType::NativeType)), | 722 | 27 | FromFieldType, typename ToFieldType::NativeType>; | 723 | 27 | MaxNativeType scale_multiplier = | 724 | 27 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 725 | 27 | typename ToFieldType::NativeType max_result = | 726 | 27 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 727 | 27 | typename ToFieldType::NativeType min_result = -max_result; | 728 | | | 729 | 27 | ColumnUInt8::MutablePtr col_null_map_to; | 730 | 27 | NullMap::value_type* null_map_data = nullptr; | 731 | 27 | if (narrow_integral) { | 732 | 25 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 733 | 25 | null_map_data = col_null_map_to->get_data().data(); | 734 | 25 | } | 735 | | | 736 | 27 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 737 | 27 | const auto& vec_from = col_from->get_data(); | 738 | 27 | const auto* vec_from_data = vec_from.data(); | 739 | 27 | auto& vec_to = col_to->get_data(); | 740 | 27 | auto* vec_to_data = vec_to.data(); | 741 | | | 742 | 27 | CastParameters params; | 743 | 27 | params.is_strict = (CastMode == CastModeType::StrictMode); | 744 | 27 | size_t size = vec_from.size(); | 745 | | | 746 | 27 | RETURN_IF_ERROR(std::visit( | 747 | 27 | [&](auto multiply_may_overflow, auto narrow_integral) { | 748 | 27 | for (size_t i = 0; i < size; i++) { | 749 | 27 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 750 | 27 | typename ToDataType::FieldType, | 751 | 27 | multiply_may_overflow, narrow_integral>( | 752 | 27 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 753 | 27 | scale_multiplier, min_result, max_result, params)) { | 754 | 27 | if (set_nullable) { | 755 | 27 | null_map_data[i] = 1; | 756 | 27 | } else { | 757 | 27 | return params.status; | 758 | 27 | } | 759 | 27 | } | 760 | 27 | } | 761 | 27 | return Status::OK(); | 762 | 27 | }, | 763 | 27 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 764 | | | 765 | 7 | if (narrow_integral) { | 766 | 5 | block.get_by_position(result).column = | 767 | 5 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 768 | 5 | } else { | 769 | 2 | block.get_by_position(result).column = std::move(col_to); | 770 | 2 | } | 771 | 7 | return Status::OK(); | 772 | 27 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE4EEENS_15DataTypeDecimalILS3_28EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 686 | 12 | const NullMap::value_type* null_map = nullptr) const override { | 687 | 12 | using FromFieldType = typename FromDataType::FieldType; | 688 | 12 | using ToFieldType = typename ToDataType::FieldType; | 689 | 12 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 690 | 12 | const auto* col_from = | 691 | 12 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 692 | 12 | if (!col_from) { | 693 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 694 | 0 | named_from.column->get_name()); | 695 | 0 | } | 696 | | | 697 | 12 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 698 | 12 | constexpr UInt32 from_scale = 0; | 699 | | | 700 | 12 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 701 | 12 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 702 | 12 | UInt32 to_precision = to_decimal_type.get_precision(); | 703 | 12 | ToDataType::check_type_precision(to_precision); | 704 | 12 | UInt32 to_scale = to_decimal_type.get_scale(); | 705 | 12 | ToDataType::check_type_scale(to_scale); | 706 | | | 707 | 12 | auto from_max_int_digit_count = from_precision - from_scale; | 708 | 12 | auto to_max_int_digit_count = to_precision - to_scale; | 709 | | // may overflow. nullable result column. | 710 | 12 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 711 | | // only in non-strict mode and may overflow, we set nullable | 712 | 12 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 713 | | | 714 | 12 | constexpr UInt32 to_max_digits = | 715 | 12 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 716 | 12 | bool multiply_may_overflow = false; | 717 | 12 | if (to_scale > from_scale) { | 718 | 7 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 719 | 7 | } | 720 | 12 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 721 | 12 | sizeof(typename ToFieldType::NativeType)), | 722 | 12 | FromFieldType, typename ToFieldType::NativeType>; | 723 | 12 | MaxNativeType scale_multiplier = | 724 | 12 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 725 | 12 | typename ToFieldType::NativeType max_result = | 726 | 12 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 727 | 12 | typename ToFieldType::NativeType min_result = -max_result; | 728 | | | 729 | 12 | ColumnUInt8::MutablePtr col_null_map_to; | 730 | 12 | NullMap::value_type* null_map_data = nullptr; | 731 | 12 | if (narrow_integral) { | 732 | 10 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 733 | 10 | null_map_data = col_null_map_to->get_data().data(); | 734 | 10 | } | 735 | | | 736 | 12 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 737 | 12 | const auto& vec_from = col_from->get_data(); | 738 | 12 | const auto* vec_from_data = vec_from.data(); | 739 | 12 | auto& vec_to = col_to->get_data(); | 740 | 12 | auto* vec_to_data = vec_to.data(); | 741 | | | 742 | 12 | CastParameters params; | 743 | 12 | params.is_strict = (CastMode == CastModeType::StrictMode); | 744 | 12 | size_t size = vec_from.size(); | 745 | | | 746 | 12 | RETURN_IF_ERROR(std::visit( | 747 | 12 | [&](auto multiply_may_overflow, auto narrow_integral) { | 748 | 12 | for (size_t i = 0; i < size; i++) { | 749 | 12 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 750 | 12 | typename ToDataType::FieldType, | 751 | 12 | multiply_may_overflow, narrow_integral>( | 752 | 12 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 753 | 12 | scale_multiplier, min_result, max_result, params)) { | 754 | 12 | if (set_nullable) { | 755 | 12 | null_map_data[i] = 1; | 756 | 12 | } else { | 757 | 12 | return params.status; | 758 | 12 | } | 759 | 12 | } | 760 | 12 | } | 761 | 12 | return Status::OK(); | 762 | 12 | }, | 763 | 12 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 764 | | | 765 | 12 | if (narrow_integral) { | 766 | 10 | block.get_by_position(result).column = | 767 | 10 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 768 | 10 | } else { | 769 | 2 | block.get_by_position(result).column = std::move(col_to); | 770 | 2 | } | 771 | 12 | return Status::OK(); | 772 | 12 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE5EEENS_15DataTypeDecimalILS3_28EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 686 | 35 | const NullMap::value_type* null_map = nullptr) const override { | 687 | 35 | using FromFieldType = typename FromDataType::FieldType; | 688 | 35 | using ToFieldType = typename ToDataType::FieldType; | 689 | 35 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 690 | 35 | const auto* col_from = | 691 | 35 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 692 | 35 | if (!col_from) { | 693 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 694 | 0 | named_from.column->get_name()); | 695 | 0 | } | 696 | | | 697 | 35 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 698 | 35 | constexpr UInt32 from_scale = 0; | 699 | | | 700 | 35 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 701 | 35 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 702 | 35 | UInt32 to_precision = to_decimal_type.get_precision(); | 703 | 35 | ToDataType::check_type_precision(to_precision); | 704 | 35 | UInt32 to_scale = to_decimal_type.get_scale(); | 705 | 35 | ToDataType::check_type_scale(to_scale); | 706 | | | 707 | 35 | auto from_max_int_digit_count = from_precision - from_scale; | 708 | 35 | auto to_max_int_digit_count = to_precision - to_scale; | 709 | | // may overflow. nullable result column. | 710 | 35 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 711 | | // only in non-strict mode and may overflow, we set nullable | 712 | 35 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 713 | | | 714 | 35 | constexpr UInt32 to_max_digits = | 715 | 35 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 716 | 35 | bool multiply_may_overflow = false; | 717 | 35 | if (to_scale > from_scale) { | 718 | 20 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 719 | 20 | } | 720 | 35 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 721 | 35 | sizeof(typename ToFieldType::NativeType)), | 722 | 35 | FromFieldType, typename ToFieldType::NativeType>; | 723 | 35 | MaxNativeType scale_multiplier = | 724 | 35 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 725 | 35 | typename ToFieldType::NativeType max_result = | 726 | 35 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 727 | 35 | typename ToFieldType::NativeType min_result = -max_result; | 728 | | | 729 | 35 | ColumnUInt8::MutablePtr col_null_map_to; | 730 | 35 | NullMap::value_type* null_map_data = nullptr; | 731 | 35 | if (narrow_integral) { | 732 | 35 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 733 | 35 | null_map_data = col_null_map_to->get_data().data(); | 734 | 35 | } | 735 | | | 736 | 35 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 737 | 35 | const auto& vec_from = col_from->get_data(); | 738 | 35 | const auto* vec_from_data = vec_from.data(); | 739 | 35 | auto& vec_to = col_to->get_data(); | 740 | 35 | auto* vec_to_data = vec_to.data(); | 741 | | | 742 | 35 | CastParameters params; | 743 | 35 | params.is_strict = (CastMode == CastModeType::StrictMode); | 744 | 35 | size_t size = vec_from.size(); | 745 | | | 746 | 35 | RETURN_IF_ERROR(std::visit( | 747 | 35 | [&](auto multiply_may_overflow, auto narrow_integral) { | 748 | 35 | for (size_t i = 0; i < size; i++) { | 749 | 35 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 750 | 35 | typename ToDataType::FieldType, | 751 | 35 | multiply_may_overflow, narrow_integral>( | 752 | 35 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 753 | 35 | scale_multiplier, min_result, max_result, params)) { | 754 | 35 | if (set_nullable) { | 755 | 35 | null_map_data[i] = 1; | 756 | 35 | } else { | 757 | 35 | return params.status; | 758 | 35 | } | 759 | 35 | } | 760 | 35 | } | 761 | 35 | return Status::OK(); | 762 | 35 | }, | 763 | 35 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 764 | | | 765 | 7 | if (narrow_integral) { | 766 | 7 | block.get_by_position(result).column = | 767 | 7 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 768 | 7 | } else { | 769 | 0 | block.get_by_position(result).column = std::move(col_to); | 770 | 0 | } | 771 | 7 | return Status::OK(); | 772 | 35 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE5EEENS_15DataTypeDecimalILS3_28EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 686 | 14 | const NullMap::value_type* null_map = nullptr) const override { | 687 | 14 | using FromFieldType = typename FromDataType::FieldType; | 688 | 14 | using ToFieldType = typename ToDataType::FieldType; | 689 | 14 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 690 | 14 | const auto* col_from = | 691 | 14 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 692 | 14 | if (!col_from) { | 693 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 694 | 0 | named_from.column->get_name()); | 695 | 0 | } | 696 | | | 697 | 14 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 698 | 14 | constexpr UInt32 from_scale = 0; | 699 | | | 700 | 14 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 701 | 14 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 702 | 14 | UInt32 to_precision = to_decimal_type.get_precision(); | 703 | 14 | ToDataType::check_type_precision(to_precision); | 704 | 14 | UInt32 to_scale = to_decimal_type.get_scale(); | 705 | 14 | ToDataType::check_type_scale(to_scale); | 706 | | | 707 | 14 | auto from_max_int_digit_count = from_precision - from_scale; | 708 | 14 | auto to_max_int_digit_count = to_precision - to_scale; | 709 | | // may overflow. nullable result column. | 710 | 14 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 711 | | // only in non-strict mode and may overflow, we set nullable | 712 | 14 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 713 | | | 714 | 14 | constexpr UInt32 to_max_digits = | 715 | 14 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 716 | 14 | bool multiply_may_overflow = false; | 717 | 14 | if (to_scale > from_scale) { | 718 | 8 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 719 | 8 | } | 720 | 14 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 721 | 14 | sizeof(typename ToFieldType::NativeType)), | 722 | 14 | FromFieldType, typename ToFieldType::NativeType>; | 723 | 14 | MaxNativeType scale_multiplier = | 724 | 14 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 725 | 14 | typename ToFieldType::NativeType max_result = | 726 | 14 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 727 | 14 | typename ToFieldType::NativeType min_result = -max_result; | 728 | | | 729 | 14 | ColumnUInt8::MutablePtr col_null_map_to; | 730 | 14 | NullMap::value_type* null_map_data = nullptr; | 731 | 14 | if (narrow_integral) { | 732 | 14 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 733 | 14 | null_map_data = col_null_map_to->get_data().data(); | 734 | 14 | } | 735 | | | 736 | 14 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 737 | 14 | const auto& vec_from = col_from->get_data(); | 738 | 14 | const auto* vec_from_data = vec_from.data(); | 739 | 14 | auto& vec_to = col_to->get_data(); | 740 | 14 | auto* vec_to_data = vec_to.data(); | 741 | | | 742 | 14 | CastParameters params; | 743 | 14 | params.is_strict = (CastMode == CastModeType::StrictMode); | 744 | 14 | size_t size = vec_from.size(); | 745 | | | 746 | 14 | RETURN_IF_ERROR(std::visit( | 747 | 14 | [&](auto multiply_may_overflow, auto narrow_integral) { | 748 | 14 | for (size_t i = 0; i < size; i++) { | 749 | 14 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 750 | 14 | typename ToDataType::FieldType, | 751 | 14 | multiply_may_overflow, narrow_integral>( | 752 | 14 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 753 | 14 | scale_multiplier, min_result, max_result, params)) { | 754 | 14 | if (set_nullable) { | 755 | 14 | null_map_data[i] = 1; | 756 | 14 | } else { | 757 | 14 | return params.status; | 758 | 14 | } | 759 | 14 | } | 760 | 14 | } | 761 | 14 | return Status::OK(); | 762 | 14 | }, | 763 | 14 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 764 | | | 765 | 14 | if (narrow_integral) { | 766 | 14 | block.get_by_position(result).column = | 767 | 14 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 768 | 14 | } else { | 769 | 0 | block.get_by_position(result).column = std::move(col_to); | 770 | 0 | } | 771 | 14 | return Status::OK(); | 772 | 14 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE6EEENS_15DataTypeDecimalILS3_28EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 686 | 35 | const NullMap::value_type* null_map = nullptr) const override { | 687 | 35 | using FromFieldType = typename FromDataType::FieldType; | 688 | 35 | using ToFieldType = typename ToDataType::FieldType; | 689 | 35 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 690 | 35 | const auto* col_from = | 691 | 35 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 692 | 35 | if (!col_from) { | 693 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 694 | 0 | named_from.column->get_name()); | 695 | 0 | } | 696 | | | 697 | 35 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 698 | 35 | constexpr UInt32 from_scale = 0; | 699 | | | 700 | 35 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 701 | 35 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 702 | 35 | UInt32 to_precision = to_decimal_type.get_precision(); | 703 | 35 | ToDataType::check_type_precision(to_precision); | 704 | 35 | UInt32 to_scale = to_decimal_type.get_scale(); | 705 | 35 | ToDataType::check_type_scale(to_scale); | 706 | | | 707 | 35 | auto from_max_int_digit_count = from_precision - from_scale; | 708 | 35 | auto to_max_int_digit_count = to_precision - to_scale; | 709 | | // may overflow. nullable result column. | 710 | 35 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 711 | | // only in non-strict mode and may overflow, we set nullable | 712 | 35 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 713 | | | 714 | 35 | constexpr UInt32 to_max_digits = | 715 | 35 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 716 | 35 | bool multiply_may_overflow = false; | 717 | 35 | if (to_scale > from_scale) { | 718 | 20 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 719 | 20 | } | 720 | 35 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 721 | 35 | sizeof(typename ToFieldType::NativeType)), | 722 | 35 | FromFieldType, typename ToFieldType::NativeType>; | 723 | 35 | MaxNativeType scale_multiplier = | 724 | 35 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 725 | 35 | typename ToFieldType::NativeType max_result = | 726 | 35 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 727 | 35 | typename ToFieldType::NativeType min_result = -max_result; | 728 | | | 729 | 35 | ColumnUInt8::MutablePtr col_null_map_to; | 730 | 35 | NullMap::value_type* null_map_data = nullptr; | 731 | 35 | if (narrow_integral) { | 732 | 35 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 733 | 35 | null_map_data = col_null_map_to->get_data().data(); | 734 | 35 | } | 735 | | | 736 | 35 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 737 | 35 | const auto& vec_from = col_from->get_data(); | 738 | 35 | const auto* vec_from_data = vec_from.data(); | 739 | 35 | auto& vec_to = col_to->get_data(); | 740 | 35 | auto* vec_to_data = vec_to.data(); | 741 | | | 742 | 35 | CastParameters params; | 743 | 35 | params.is_strict = (CastMode == CastModeType::StrictMode); | 744 | 35 | size_t size = vec_from.size(); | 745 | | | 746 | 35 | RETURN_IF_ERROR(std::visit( | 747 | 35 | [&](auto multiply_may_overflow, auto narrow_integral) { | 748 | 35 | for (size_t i = 0; i < size; i++) { | 749 | 35 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 750 | 35 | typename ToDataType::FieldType, | 751 | 35 | multiply_may_overflow, narrow_integral>( | 752 | 35 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 753 | 35 | scale_multiplier, min_result, max_result, params)) { | 754 | 35 | if (set_nullable) { | 755 | 35 | null_map_data[i] = 1; | 756 | 35 | } else { | 757 | 35 | return params.status; | 758 | 35 | } | 759 | 35 | } | 760 | 35 | } | 761 | 35 | return Status::OK(); | 762 | 35 | }, | 763 | 35 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 764 | | | 765 | 7 | if (narrow_integral) { | 766 | 7 | block.get_by_position(result).column = | 767 | 7 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 768 | 7 | } else { | 769 | 0 | block.get_by_position(result).column = std::move(col_to); | 770 | 0 | } | 771 | 7 | return Status::OK(); | 772 | 35 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE6EEENS_15DataTypeDecimalILS3_28EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 686 | 14 | const NullMap::value_type* null_map = nullptr) const override { | 687 | 14 | using FromFieldType = typename FromDataType::FieldType; | 688 | 14 | using ToFieldType = typename ToDataType::FieldType; | 689 | 14 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 690 | 14 | const auto* col_from = | 691 | 14 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 692 | 14 | if (!col_from) { | 693 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 694 | 0 | named_from.column->get_name()); | 695 | 0 | } | 696 | | | 697 | 14 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 698 | 14 | constexpr UInt32 from_scale = 0; | 699 | | | 700 | 14 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 701 | 14 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 702 | 14 | UInt32 to_precision = to_decimal_type.get_precision(); | 703 | 14 | ToDataType::check_type_precision(to_precision); | 704 | 14 | UInt32 to_scale = to_decimal_type.get_scale(); | 705 | 14 | ToDataType::check_type_scale(to_scale); | 706 | | | 707 | 14 | auto from_max_int_digit_count = from_precision - from_scale; | 708 | 14 | auto to_max_int_digit_count = to_precision - to_scale; | 709 | | // may overflow. nullable result column. | 710 | 14 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 711 | | // only in non-strict mode and may overflow, we set nullable | 712 | 14 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 713 | | | 714 | 14 | constexpr UInt32 to_max_digits = | 715 | 14 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 716 | 14 | bool multiply_may_overflow = false; | 717 | 14 | if (to_scale > from_scale) { | 718 | 8 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 719 | 8 | } | 720 | 14 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 721 | 14 | sizeof(typename ToFieldType::NativeType)), | 722 | 14 | FromFieldType, typename ToFieldType::NativeType>; | 723 | 14 | MaxNativeType scale_multiplier = | 724 | 14 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 725 | 14 | typename ToFieldType::NativeType max_result = | 726 | 14 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 727 | 14 | typename ToFieldType::NativeType min_result = -max_result; | 728 | | | 729 | 14 | ColumnUInt8::MutablePtr col_null_map_to; | 730 | 14 | NullMap::value_type* null_map_data = nullptr; | 731 | 14 | if (narrow_integral) { | 732 | 14 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 733 | 14 | null_map_data = col_null_map_to->get_data().data(); | 734 | 14 | } | 735 | | | 736 | 14 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 737 | 14 | const auto& vec_from = col_from->get_data(); | 738 | 14 | const auto* vec_from_data = vec_from.data(); | 739 | 14 | auto& vec_to = col_to->get_data(); | 740 | 14 | auto* vec_to_data = vec_to.data(); | 741 | | | 742 | 14 | CastParameters params; | 743 | 14 | params.is_strict = (CastMode == CastModeType::StrictMode); | 744 | 14 | size_t size = vec_from.size(); | 745 | | | 746 | 14 | RETURN_IF_ERROR(std::visit( | 747 | 14 | [&](auto multiply_may_overflow, auto narrow_integral) { | 748 | 14 | for (size_t i = 0; i < size; i++) { | 749 | 14 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 750 | 14 | typename ToDataType::FieldType, | 751 | 14 | multiply_may_overflow, narrow_integral>( | 752 | 14 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 753 | 14 | scale_multiplier, min_result, max_result, params)) { | 754 | 14 | if (set_nullable) { | 755 | 14 | null_map_data[i] = 1; | 756 | 14 | } else { | 757 | 14 | return params.status; | 758 | 14 | } | 759 | 14 | } | 760 | 14 | } | 761 | 14 | return Status::OK(); | 762 | 14 | }, | 763 | 14 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 764 | | | 765 | 14 | if (narrow_integral) { | 766 | 14 | block.get_by_position(result).column = | 767 | 14 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 768 | 14 | } else { | 769 | 0 | block.get_by_position(result).column = std::move(col_to); | 770 | 0 | } | 771 | 14 | return Status::OK(); | 772 | 14 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE7EEENS_15DataTypeDecimalILS3_28EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 686 | 35 | const NullMap::value_type* null_map = nullptr) const override { | 687 | 35 | using FromFieldType = typename FromDataType::FieldType; | 688 | 35 | using ToFieldType = typename ToDataType::FieldType; | 689 | 35 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 690 | 35 | const auto* col_from = | 691 | 35 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 692 | 35 | if (!col_from) { | 693 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 694 | 0 | named_from.column->get_name()); | 695 | 0 | } | 696 | | | 697 | 35 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 698 | 35 | constexpr UInt32 from_scale = 0; | 699 | | | 700 | 35 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 701 | 35 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 702 | 35 | UInt32 to_precision = to_decimal_type.get_precision(); | 703 | 35 | ToDataType::check_type_precision(to_precision); | 704 | 35 | UInt32 to_scale = to_decimal_type.get_scale(); | 705 | 35 | ToDataType::check_type_scale(to_scale); | 706 | | | 707 | 35 | auto from_max_int_digit_count = from_precision - from_scale; | 708 | 35 | auto to_max_int_digit_count = to_precision - to_scale; | 709 | | // may overflow. nullable result column. | 710 | 35 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 711 | | // only in non-strict mode and may overflow, we set nullable | 712 | 35 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 713 | | | 714 | 35 | constexpr UInt32 to_max_digits = | 715 | 35 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 716 | 35 | bool multiply_may_overflow = false; | 717 | 35 | if (to_scale > from_scale) { | 718 | 20 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 719 | 20 | } | 720 | 35 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 721 | 35 | sizeof(typename ToFieldType::NativeType)), | 722 | 35 | FromFieldType, typename ToFieldType::NativeType>; | 723 | 35 | MaxNativeType scale_multiplier = | 724 | 35 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 725 | 35 | typename ToFieldType::NativeType max_result = | 726 | 35 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 727 | 35 | typename ToFieldType::NativeType min_result = -max_result; | 728 | | | 729 | 35 | ColumnUInt8::MutablePtr col_null_map_to; | 730 | 35 | NullMap::value_type* null_map_data = nullptr; | 731 | 35 | if (narrow_integral) { | 732 | 35 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 733 | 35 | null_map_data = col_null_map_to->get_data().data(); | 734 | 35 | } | 735 | | | 736 | 35 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 737 | 35 | const auto& vec_from = col_from->get_data(); | 738 | 35 | const auto* vec_from_data = vec_from.data(); | 739 | 35 | auto& vec_to = col_to->get_data(); | 740 | 35 | auto* vec_to_data = vec_to.data(); | 741 | | | 742 | 35 | CastParameters params; | 743 | 35 | params.is_strict = (CastMode == CastModeType::StrictMode); | 744 | 35 | size_t size = vec_from.size(); | 745 | | | 746 | 35 | RETURN_IF_ERROR(std::visit( | 747 | 35 | [&](auto multiply_may_overflow, auto narrow_integral) { | 748 | 35 | for (size_t i = 0; i < size; i++) { | 749 | 35 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 750 | 35 | typename ToDataType::FieldType, | 751 | 35 | multiply_may_overflow, narrow_integral>( | 752 | 35 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 753 | 35 | scale_multiplier, min_result, max_result, params)) { | 754 | 35 | if (set_nullable) { | 755 | 35 | null_map_data[i] = 1; | 756 | 35 | } else { | 757 | 35 | return params.status; | 758 | 35 | } | 759 | 35 | } | 760 | 35 | } | 761 | 35 | return Status::OK(); | 762 | 35 | }, | 763 | 35 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 764 | | | 765 | 7 | if (narrow_integral) { | 766 | 7 | block.get_by_position(result).column = | 767 | 7 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 768 | 7 | } else { | 769 | 0 | block.get_by_position(result).column = std::move(col_to); | 770 | 0 | } | 771 | 7 | return Status::OK(); | 772 | 35 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE7EEENS_15DataTypeDecimalILS3_28EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 686 | 14 | const NullMap::value_type* null_map = nullptr) const override { | 687 | 14 | using FromFieldType = typename FromDataType::FieldType; | 688 | 14 | using ToFieldType = typename ToDataType::FieldType; | 689 | 14 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 690 | 14 | const auto* col_from = | 691 | 14 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 692 | 14 | if (!col_from) { | 693 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 694 | 0 | named_from.column->get_name()); | 695 | 0 | } | 696 | | | 697 | 14 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 698 | 14 | constexpr UInt32 from_scale = 0; | 699 | | | 700 | 14 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 701 | 14 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 702 | 14 | UInt32 to_precision = to_decimal_type.get_precision(); | 703 | 14 | ToDataType::check_type_precision(to_precision); | 704 | 14 | UInt32 to_scale = to_decimal_type.get_scale(); | 705 | 14 | ToDataType::check_type_scale(to_scale); | 706 | | | 707 | 14 | auto from_max_int_digit_count = from_precision - from_scale; | 708 | 14 | auto to_max_int_digit_count = to_precision - to_scale; | 709 | | // may overflow. nullable result column. | 710 | 14 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 711 | | // only in non-strict mode and may overflow, we set nullable | 712 | 14 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 713 | | | 714 | 14 | constexpr UInt32 to_max_digits = | 715 | 14 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 716 | 14 | bool multiply_may_overflow = false; | 717 | 14 | if (to_scale > from_scale) { | 718 | 8 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 719 | 8 | } | 720 | 14 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 721 | 14 | sizeof(typename ToFieldType::NativeType)), | 722 | 14 | FromFieldType, typename ToFieldType::NativeType>; | 723 | 14 | MaxNativeType scale_multiplier = | 724 | 14 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 725 | 14 | typename ToFieldType::NativeType max_result = | 726 | 14 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 727 | 14 | typename ToFieldType::NativeType min_result = -max_result; | 728 | | | 729 | 14 | ColumnUInt8::MutablePtr col_null_map_to; | 730 | 14 | NullMap::value_type* null_map_data = nullptr; | 731 | 14 | if (narrow_integral) { | 732 | 14 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 733 | 14 | null_map_data = col_null_map_to->get_data().data(); | 734 | 14 | } | 735 | | | 736 | 14 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 737 | 14 | const auto& vec_from = col_from->get_data(); | 738 | 14 | const auto* vec_from_data = vec_from.data(); | 739 | 14 | auto& vec_to = col_to->get_data(); | 740 | 14 | auto* vec_to_data = vec_to.data(); | 741 | | | 742 | 14 | CastParameters params; | 743 | 14 | params.is_strict = (CastMode == CastModeType::StrictMode); | 744 | 14 | size_t size = vec_from.size(); | 745 | | | 746 | 14 | RETURN_IF_ERROR(std::visit( | 747 | 14 | [&](auto multiply_may_overflow, auto narrow_integral) { | 748 | 14 | for (size_t i = 0; i < size; i++) { | 749 | 14 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 750 | 14 | typename ToDataType::FieldType, | 751 | 14 | multiply_may_overflow, narrow_integral>( | 752 | 14 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 753 | 14 | scale_multiplier, min_result, max_result, params)) { | 754 | 14 | if (set_nullable) { | 755 | 14 | null_map_data[i] = 1; | 756 | 14 | } else { | 757 | 14 | return params.status; | 758 | 14 | } | 759 | 14 | } | 760 | 14 | } | 761 | 14 | return Status::OK(); | 762 | 14 | }, | 763 | 14 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 764 | | | 765 | 14 | if (narrow_integral) { | 766 | 14 | block.get_by_position(result).column = | 767 | 14 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 768 | 14 | } else { | 769 | 0 | block.get_by_position(result).column = std::move(col_to); | 770 | 0 | } | 771 | 14 | return Status::OK(); | 772 | 14 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE2EEENS_15DataTypeDecimalILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 686 | 2 | const NullMap::value_type* null_map = nullptr) const override { | 687 | 2 | using FromFieldType = typename FromDataType::FieldType; | 688 | 2 | using ToFieldType = typename ToDataType::FieldType; | 689 | 2 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 690 | 2 | const auto* col_from = | 691 | 2 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 692 | 2 | if (!col_from) { | 693 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 694 | 0 | named_from.column->get_name()); | 695 | 0 | } | 696 | | | 697 | 2 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 698 | 2 | constexpr UInt32 from_scale = 0; | 699 | | | 700 | 2 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 701 | 2 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 702 | 2 | UInt32 to_precision = to_decimal_type.get_precision(); | 703 | 2 | ToDataType::check_type_precision(to_precision); | 704 | 2 | UInt32 to_scale = to_decimal_type.get_scale(); | 705 | 2 | ToDataType::check_type_scale(to_scale); | 706 | | | 707 | 2 | auto from_max_int_digit_count = from_precision - from_scale; | 708 | 2 | auto to_max_int_digit_count = to_precision - to_scale; | 709 | | // may overflow. nullable result column. | 710 | 2 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 711 | | // only in non-strict mode and may overflow, we set nullable | 712 | 2 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 713 | | | 714 | 2 | constexpr UInt32 to_max_digits = | 715 | 2 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 716 | 2 | bool multiply_may_overflow = false; | 717 | 2 | if (to_scale > from_scale) { | 718 | 2 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 719 | 2 | } | 720 | 2 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 721 | 2 | sizeof(typename ToFieldType::NativeType)), | 722 | 2 | FromFieldType, typename ToFieldType::NativeType>; | 723 | 2 | MaxNativeType scale_multiplier = | 724 | 2 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 725 | 2 | typename ToFieldType::NativeType max_result = | 726 | 2 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 727 | 2 | typename ToFieldType::NativeType min_result = -max_result; | 728 | | | 729 | 2 | ColumnUInt8::MutablePtr col_null_map_to; | 730 | 2 | NullMap::value_type* null_map_data = nullptr; | 731 | 2 | if (narrow_integral) { | 732 | 2 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 733 | 2 | null_map_data = col_null_map_to->get_data().data(); | 734 | 2 | } | 735 | | | 736 | 2 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 737 | 2 | const auto& vec_from = col_from->get_data(); | 738 | 2 | const auto* vec_from_data = vec_from.data(); | 739 | 2 | auto& vec_to = col_to->get_data(); | 740 | 2 | auto* vec_to_data = vec_to.data(); | 741 | | | 742 | 2 | CastParameters params; | 743 | 2 | params.is_strict = (CastMode == CastModeType::StrictMode); | 744 | 2 | size_t size = vec_from.size(); | 745 | | | 746 | 2 | RETURN_IF_ERROR(std::visit( | 747 | 2 | [&](auto multiply_may_overflow, auto narrow_integral) { | 748 | 2 | for (size_t i = 0; i < size; i++) { | 749 | 2 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 750 | 2 | typename ToDataType::FieldType, | 751 | 2 | multiply_may_overflow, narrow_integral>( | 752 | 2 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 753 | 2 | scale_multiplier, min_result, max_result, params)) { | 754 | 2 | if (set_nullable) { | 755 | 2 | null_map_data[i] = 1; | 756 | 2 | } else { | 757 | 2 | return params.status; | 758 | 2 | } | 759 | 2 | } | 760 | 2 | } | 761 | 2 | return Status::OK(); | 762 | 2 | }, | 763 | 2 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 764 | | | 765 | 1 | if (narrow_integral) { | 766 | 1 | block.get_by_position(result).column = | 767 | 1 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 768 | 1 | } else { | 769 | 0 | block.get_by_position(result).column = std::move(col_to); | 770 | 0 | } | 771 | 1 | return Status::OK(); | 772 | 2 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE2EEENS_15DataTypeDecimalILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 686 | 5 | const NullMap::value_type* null_map = nullptr) const override { | 687 | 5 | using FromFieldType = typename FromDataType::FieldType; | 688 | 5 | using ToFieldType = typename ToDataType::FieldType; | 689 | 5 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 690 | 5 | const auto* col_from = | 691 | 5 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 692 | 5 | if (!col_from) { | 693 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 694 | 0 | named_from.column->get_name()); | 695 | 0 | } | 696 | | | 697 | 5 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 698 | 5 | constexpr UInt32 from_scale = 0; | 699 | | | 700 | 5 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 701 | 5 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 702 | 5 | UInt32 to_precision = to_decimal_type.get_precision(); | 703 | 5 | ToDataType::check_type_precision(to_precision); | 704 | 5 | UInt32 to_scale = to_decimal_type.get_scale(); | 705 | 5 | ToDataType::check_type_scale(to_scale); | 706 | | | 707 | 5 | auto from_max_int_digit_count = from_precision - from_scale; | 708 | 5 | auto to_max_int_digit_count = to_precision - to_scale; | 709 | | // may overflow. nullable result column. | 710 | 5 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 711 | | // only in non-strict mode and may overflow, we set nullable | 712 | 5 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 713 | | | 714 | 5 | constexpr UInt32 to_max_digits = | 715 | 5 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 716 | 5 | bool multiply_may_overflow = false; | 717 | 5 | if (to_scale > from_scale) { | 718 | 4 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 719 | 4 | } | 720 | 5 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 721 | 5 | sizeof(typename ToFieldType::NativeType)), | 722 | 5 | FromFieldType, typename ToFieldType::NativeType>; | 723 | 5 | MaxNativeType scale_multiplier = | 724 | 5 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 725 | 5 | typename ToFieldType::NativeType max_result = | 726 | 5 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 727 | 5 | typename ToFieldType::NativeType min_result = -max_result; | 728 | | | 729 | 5 | ColumnUInt8::MutablePtr col_null_map_to; | 730 | 5 | NullMap::value_type* null_map_data = nullptr; | 731 | 5 | if (narrow_integral) { | 732 | 1 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 733 | 1 | null_map_data = col_null_map_to->get_data().data(); | 734 | 1 | } | 735 | | | 736 | 5 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 737 | 5 | const auto& vec_from = col_from->get_data(); | 738 | 5 | const auto* vec_from_data = vec_from.data(); | 739 | 5 | auto& vec_to = col_to->get_data(); | 740 | 5 | auto* vec_to_data = vec_to.data(); | 741 | | | 742 | 5 | CastParameters params; | 743 | 5 | params.is_strict = (CastMode == CastModeType::StrictMode); | 744 | 5 | size_t size = vec_from.size(); | 745 | | | 746 | 5 | RETURN_IF_ERROR(std::visit( | 747 | 5 | [&](auto multiply_may_overflow, auto narrow_integral) { | 748 | 5 | for (size_t i = 0; i < size; i++) { | 749 | 5 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 750 | 5 | typename ToDataType::FieldType, | 751 | 5 | multiply_may_overflow, narrow_integral>( | 752 | 5 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 753 | 5 | scale_multiplier, min_result, max_result, params)) { | 754 | 5 | if (set_nullable) { | 755 | 5 | null_map_data[i] = 1; | 756 | 5 | } else { | 757 | 5 | return params.status; | 758 | 5 | } | 759 | 5 | } | 760 | 5 | } | 761 | 5 | return Status::OK(); | 762 | 5 | }, | 763 | 5 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 764 | | | 765 | 5 | if (narrow_integral) { | 766 | 1 | block.get_by_position(result).column = | 767 | 1 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 768 | 4 | } else { | 769 | 4 | block.get_by_position(result).column = std::move(col_to); | 770 | 4 | } | 771 | 5 | return Status::OK(); | 772 | 5 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE3EEENS_15DataTypeDecimalILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 686 | 19 | const NullMap::value_type* null_map = nullptr) const override { | 687 | 19 | using FromFieldType = typename FromDataType::FieldType; | 688 | 19 | using ToFieldType = typename ToDataType::FieldType; | 689 | 19 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 690 | 19 | const auto* col_from = | 691 | 19 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 692 | 19 | if (!col_from) { | 693 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 694 | 0 | named_from.column->get_name()); | 695 | 0 | } | 696 | | | 697 | 19 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 698 | 19 | constexpr UInt32 from_scale = 0; | 699 | | | 700 | 19 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 701 | 19 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 702 | 19 | UInt32 to_precision = to_decimal_type.get_precision(); | 703 | 19 | ToDataType::check_type_precision(to_precision); | 704 | 19 | UInt32 to_scale = to_decimal_type.get_scale(); | 705 | 19 | ToDataType::check_type_scale(to_scale); | 706 | | | 707 | 19 | auto from_max_int_digit_count = from_precision - from_scale; | 708 | 19 | auto to_max_int_digit_count = to_precision - to_scale; | 709 | | // may overflow. nullable result column. | 710 | 19 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 711 | | // only in non-strict mode and may overflow, we set nullable | 712 | 19 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 713 | | | 714 | 19 | constexpr UInt32 to_max_digits = | 715 | 19 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 716 | 19 | bool multiply_may_overflow = false; | 717 | 19 | if (to_scale > from_scale) { | 718 | 12 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 719 | 12 | } | 720 | 19 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 721 | 19 | sizeof(typename ToFieldType::NativeType)), | 722 | 19 | FromFieldType, typename ToFieldType::NativeType>; | 723 | 19 | MaxNativeType scale_multiplier = | 724 | 19 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 725 | 19 | typename ToFieldType::NativeType max_result = | 726 | 19 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 727 | 19 | typename ToFieldType::NativeType min_result = -max_result; | 728 | | | 729 | 19 | ColumnUInt8::MutablePtr col_null_map_to; | 730 | 19 | NullMap::value_type* null_map_data = nullptr; | 731 | 19 | if (narrow_integral) { | 732 | 15 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 733 | 15 | null_map_data = col_null_map_to->get_data().data(); | 734 | 15 | } | 735 | | | 736 | 19 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 737 | 19 | const auto& vec_from = col_from->get_data(); | 738 | 19 | const auto* vec_from_data = vec_from.data(); | 739 | 19 | auto& vec_to = col_to->get_data(); | 740 | 19 | auto* vec_to_data = vec_to.data(); | 741 | | | 742 | 19 | CastParameters params; | 743 | 19 | params.is_strict = (CastMode == CastModeType::StrictMode); | 744 | 19 | size_t size = vec_from.size(); | 745 | | | 746 | 19 | RETURN_IF_ERROR(std::visit( | 747 | 19 | [&](auto multiply_may_overflow, auto narrow_integral) { | 748 | 19 | for (size_t i = 0; i < size; i++) { | 749 | 19 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 750 | 19 | typename ToDataType::FieldType, | 751 | 19 | multiply_may_overflow, narrow_integral>( | 752 | 19 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 753 | 19 | scale_multiplier, min_result, max_result, params)) { | 754 | 19 | if (set_nullable) { | 755 | 19 | null_map_data[i] = 1; | 756 | 19 | } else { | 757 | 19 | return params.status; | 758 | 19 | } | 759 | 19 | } | 760 | 19 | } | 761 | 19 | return Status::OK(); | 762 | 19 | }, | 763 | 19 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 764 | | | 765 | 7 | if (narrow_integral) { | 766 | 3 | block.get_by_position(result).column = | 767 | 3 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 768 | 4 | } else { | 769 | 4 | block.get_by_position(result).column = std::move(col_to); | 770 | 4 | } | 771 | 7 | return Status::OK(); | 772 | 19 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE3EEENS_15DataTypeDecimalILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 686 | 10 | const NullMap::value_type* null_map = nullptr) const override { | 687 | 10 | using FromFieldType = typename FromDataType::FieldType; | 688 | 10 | using ToFieldType = typename ToDataType::FieldType; | 689 | 10 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 690 | 10 | const auto* col_from = | 691 | 10 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 692 | 10 | if (!col_from) { | 693 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 694 | 0 | named_from.column->get_name()); | 695 | 0 | } | 696 | | | 697 | 10 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 698 | 10 | constexpr UInt32 from_scale = 0; | 699 | | | 700 | 10 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 701 | 10 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 702 | 10 | UInt32 to_precision = to_decimal_type.get_precision(); | 703 | 10 | ToDataType::check_type_precision(to_precision); | 704 | 10 | UInt32 to_scale = to_decimal_type.get_scale(); | 705 | 10 | ToDataType::check_type_scale(to_scale); | 706 | | | 707 | 10 | auto from_max_int_digit_count = from_precision - from_scale; | 708 | 10 | auto to_max_int_digit_count = to_precision - to_scale; | 709 | | // may overflow. nullable result column. | 710 | 10 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 711 | | // only in non-strict mode and may overflow, we set nullable | 712 | 10 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 713 | | | 714 | 10 | constexpr UInt32 to_max_digits = | 715 | 10 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 716 | 10 | bool multiply_may_overflow = false; | 717 | 10 | if (to_scale > from_scale) { | 718 | 6 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 719 | 6 | } | 720 | 10 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 721 | 10 | sizeof(typename ToFieldType::NativeType)), | 722 | 10 | FromFieldType, typename ToFieldType::NativeType>; | 723 | 10 | MaxNativeType scale_multiplier = | 724 | 10 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 725 | 10 | typename ToFieldType::NativeType max_result = | 726 | 10 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 727 | 10 | typename ToFieldType::NativeType min_result = -max_result; | 728 | | | 729 | 10 | ColumnUInt8::MutablePtr col_null_map_to; | 730 | 10 | NullMap::value_type* null_map_data = nullptr; | 731 | 10 | if (narrow_integral) { | 732 | 6 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 733 | 6 | null_map_data = col_null_map_to->get_data().data(); | 734 | 6 | } | 735 | | | 736 | 10 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 737 | 10 | const auto& vec_from = col_from->get_data(); | 738 | 10 | const auto* vec_from_data = vec_from.data(); | 739 | 10 | auto& vec_to = col_to->get_data(); | 740 | 10 | auto* vec_to_data = vec_to.data(); | 741 | | | 742 | 10 | CastParameters params; | 743 | 10 | params.is_strict = (CastMode == CastModeType::StrictMode); | 744 | 10 | size_t size = vec_from.size(); | 745 | | | 746 | 10 | RETURN_IF_ERROR(std::visit( | 747 | 10 | [&](auto multiply_may_overflow, auto narrow_integral) { | 748 | 10 | for (size_t i = 0; i < size; i++) { | 749 | 10 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 750 | 10 | typename ToDataType::FieldType, | 751 | 10 | multiply_may_overflow, narrow_integral>( | 752 | 10 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 753 | 10 | scale_multiplier, min_result, max_result, params)) { | 754 | 10 | if (set_nullable) { | 755 | 10 | null_map_data[i] = 1; | 756 | 10 | } else { | 757 | 10 | return params.status; | 758 | 10 | } | 759 | 10 | } | 760 | 10 | } | 761 | 10 | return Status::OK(); | 762 | 10 | }, | 763 | 10 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 764 | | | 765 | 10 | if (narrow_integral) { | 766 | 6 | block.get_by_position(result).column = | 767 | 6 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 768 | 6 | } else { | 769 | 4 | block.get_by_position(result).column = std::move(col_to); | 770 | 4 | } | 771 | 10 | return Status::OK(); | 772 | 10 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE4EEENS_15DataTypeDecimalILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 686 | 19 | const NullMap::value_type* null_map = nullptr) const override { | 687 | 19 | using FromFieldType = typename FromDataType::FieldType; | 688 | 19 | using ToFieldType = typename ToDataType::FieldType; | 689 | 19 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 690 | 19 | const auto* col_from = | 691 | 19 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 692 | 19 | if (!col_from) { | 693 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 694 | 0 | named_from.column->get_name()); | 695 | 0 | } | 696 | | | 697 | 19 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 698 | 19 | constexpr UInt32 from_scale = 0; | 699 | | | 700 | 19 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 701 | 19 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 702 | 19 | UInt32 to_precision = to_decimal_type.get_precision(); | 703 | 19 | ToDataType::check_type_precision(to_precision); | 704 | 19 | UInt32 to_scale = to_decimal_type.get_scale(); | 705 | 19 | ToDataType::check_type_scale(to_scale); | 706 | | | 707 | 19 | auto from_max_int_digit_count = from_precision - from_scale; | 708 | 19 | auto to_max_int_digit_count = to_precision - to_scale; | 709 | | // may overflow. nullable result column. | 710 | 19 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 711 | | // only in non-strict mode and may overflow, we set nullable | 712 | 19 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 713 | | | 714 | 19 | constexpr UInt32 to_max_digits = | 715 | 19 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 716 | 19 | bool multiply_may_overflow = false; | 717 | 19 | if (to_scale > from_scale) { | 718 | 12 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 719 | 12 | } | 720 | 19 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 721 | 19 | sizeof(typename ToFieldType::NativeType)), | 722 | 19 | FromFieldType, typename ToFieldType::NativeType>; | 723 | 19 | MaxNativeType scale_multiplier = | 724 | 19 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 725 | 19 | typename ToFieldType::NativeType max_result = | 726 | 19 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 727 | 19 | typename ToFieldType::NativeType min_result = -max_result; | 728 | | | 729 | 19 | ColumnUInt8::MutablePtr col_null_map_to; | 730 | 19 | NullMap::value_type* null_map_data = nullptr; | 731 | 19 | if (narrow_integral) { | 732 | 15 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 733 | 15 | null_map_data = col_null_map_to->get_data().data(); | 734 | 15 | } | 735 | | | 736 | 19 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 737 | 19 | const auto& vec_from = col_from->get_data(); | 738 | 19 | const auto* vec_from_data = vec_from.data(); | 739 | 19 | auto& vec_to = col_to->get_data(); | 740 | 19 | auto* vec_to_data = vec_to.data(); | 741 | | | 742 | 19 | CastParameters params; | 743 | 19 | params.is_strict = (CastMode == CastModeType::StrictMode); | 744 | 19 | size_t size = vec_from.size(); | 745 | | | 746 | 19 | RETURN_IF_ERROR(std::visit( | 747 | 19 | [&](auto multiply_may_overflow, auto narrow_integral) { | 748 | 19 | for (size_t i = 0; i < size; i++) { | 749 | 19 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 750 | 19 | typename ToDataType::FieldType, | 751 | 19 | multiply_may_overflow, narrow_integral>( | 752 | 19 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 753 | 19 | scale_multiplier, min_result, max_result, params)) { | 754 | 19 | if (set_nullable) { | 755 | 19 | null_map_data[i] = 1; | 756 | 19 | } else { | 757 | 19 | return params.status; | 758 | 19 | } | 759 | 19 | } | 760 | 19 | } | 761 | 19 | return Status::OK(); | 762 | 19 | }, | 763 | 19 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 764 | | | 765 | 7 | if (narrow_integral) { | 766 | 3 | block.get_by_position(result).column = | 767 | 3 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 768 | 4 | } else { | 769 | 4 | block.get_by_position(result).column = std::move(col_to); | 770 | 4 | } | 771 | 7 | return Status::OK(); | 772 | 19 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE4EEENS_15DataTypeDecimalILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 686 | 10 | const NullMap::value_type* null_map = nullptr) const override { | 687 | 10 | using FromFieldType = typename FromDataType::FieldType; | 688 | 10 | using ToFieldType = typename ToDataType::FieldType; | 689 | 10 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 690 | 10 | const auto* col_from = | 691 | 10 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 692 | 10 | if (!col_from) { | 693 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 694 | 0 | named_from.column->get_name()); | 695 | 0 | } | 696 | | | 697 | 10 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 698 | 10 | constexpr UInt32 from_scale = 0; | 699 | | | 700 | 10 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 701 | 10 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 702 | 10 | UInt32 to_precision = to_decimal_type.get_precision(); | 703 | 10 | ToDataType::check_type_precision(to_precision); | 704 | 10 | UInt32 to_scale = to_decimal_type.get_scale(); | 705 | 10 | ToDataType::check_type_scale(to_scale); | 706 | | | 707 | 10 | auto from_max_int_digit_count = from_precision - from_scale; | 708 | 10 | auto to_max_int_digit_count = to_precision - to_scale; | 709 | | // may overflow. nullable result column. | 710 | 10 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 711 | | // only in non-strict mode and may overflow, we set nullable | 712 | 10 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 713 | | | 714 | 10 | constexpr UInt32 to_max_digits = | 715 | 10 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 716 | 10 | bool multiply_may_overflow = false; | 717 | 10 | if (to_scale > from_scale) { | 718 | 6 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 719 | 6 | } | 720 | 10 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 721 | 10 | sizeof(typename ToFieldType::NativeType)), | 722 | 10 | FromFieldType, typename ToFieldType::NativeType>; | 723 | 10 | MaxNativeType scale_multiplier = | 724 | 10 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 725 | 10 | typename ToFieldType::NativeType max_result = | 726 | 10 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 727 | 10 | typename ToFieldType::NativeType min_result = -max_result; | 728 | | | 729 | 10 | ColumnUInt8::MutablePtr col_null_map_to; | 730 | 10 | NullMap::value_type* null_map_data = nullptr; | 731 | 10 | if (narrow_integral) { | 732 | 6 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 733 | 6 | null_map_data = col_null_map_to->get_data().data(); | 734 | 6 | } | 735 | | | 736 | 10 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 737 | 10 | const auto& vec_from = col_from->get_data(); | 738 | 10 | const auto* vec_from_data = vec_from.data(); | 739 | 10 | auto& vec_to = col_to->get_data(); | 740 | 10 | auto* vec_to_data = vec_to.data(); | 741 | | | 742 | 10 | CastParameters params; | 743 | 10 | params.is_strict = (CastMode == CastModeType::StrictMode); | 744 | 10 | size_t size = vec_from.size(); | 745 | | | 746 | 10 | RETURN_IF_ERROR(std::visit( | 747 | 10 | [&](auto multiply_may_overflow, auto narrow_integral) { | 748 | 10 | for (size_t i = 0; i < size; i++) { | 749 | 10 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 750 | 10 | typename ToDataType::FieldType, | 751 | 10 | multiply_may_overflow, narrow_integral>( | 752 | 10 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 753 | 10 | scale_multiplier, min_result, max_result, params)) { | 754 | 10 | if (set_nullable) { | 755 | 10 | null_map_data[i] = 1; | 756 | 10 | } else { | 757 | 10 | return params.status; | 758 | 10 | } | 759 | 10 | } | 760 | 10 | } | 761 | 10 | return Status::OK(); | 762 | 10 | }, | 763 | 10 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 764 | | | 765 | 10 | if (narrow_integral) { | 766 | 6 | block.get_by_position(result).column = | 767 | 6 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 768 | 6 | } else { | 769 | 4 | block.get_by_position(result).column = std::move(col_to); | 770 | 4 | } | 771 | 10 | return Status::OK(); | 772 | 10 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE5EEENS_15DataTypeDecimalILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 686 | 31 | const NullMap::value_type* null_map = nullptr) const override { | 687 | 31 | using FromFieldType = typename FromDataType::FieldType; | 688 | 31 | using ToFieldType = typename ToDataType::FieldType; | 689 | 31 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 690 | 31 | const auto* col_from = | 691 | 31 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 692 | 31 | if (!col_from) { | 693 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 694 | 0 | named_from.column->get_name()); | 695 | 0 | } | 696 | | | 697 | 31 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 698 | 31 | constexpr UInt32 from_scale = 0; | 699 | | | 700 | 31 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 701 | 31 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 702 | 31 | UInt32 to_precision = to_decimal_type.get_precision(); | 703 | 31 | ToDataType::check_type_precision(to_precision); | 704 | 31 | UInt32 to_scale = to_decimal_type.get_scale(); | 705 | 31 | ToDataType::check_type_scale(to_scale); | 706 | | | 707 | 31 | auto from_max_int_digit_count = from_precision - from_scale; | 708 | 31 | auto to_max_int_digit_count = to_precision - to_scale; | 709 | | // may overflow. nullable result column. | 710 | 31 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 711 | | // only in non-strict mode and may overflow, we set nullable | 712 | 31 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 713 | | | 714 | 31 | constexpr UInt32 to_max_digits = | 715 | 31 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 716 | 31 | bool multiply_may_overflow = false; | 717 | 31 | if (to_scale > from_scale) { | 718 | 20 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 719 | 20 | } | 720 | 31 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 721 | 31 | sizeof(typename ToFieldType::NativeType)), | 722 | 31 | FromFieldType, typename ToFieldType::NativeType>; | 723 | 31 | MaxNativeType scale_multiplier = | 724 | 31 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 725 | 31 | typename ToFieldType::NativeType max_result = | 726 | 31 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 727 | 31 | typename ToFieldType::NativeType min_result = -max_result; | 728 | | | 729 | 31 | ColumnUInt8::MutablePtr col_null_map_to; | 730 | 31 | NullMap::value_type* null_map_data = nullptr; | 731 | 31 | if (narrow_integral) { | 732 | 30 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 733 | 30 | null_map_data = col_null_map_to->get_data().data(); | 734 | 30 | } | 735 | | | 736 | 31 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 737 | 31 | const auto& vec_from = col_from->get_data(); | 738 | 31 | const auto* vec_from_data = vec_from.data(); | 739 | 31 | auto& vec_to = col_to->get_data(); | 740 | 31 | auto* vec_to_data = vec_to.data(); | 741 | | | 742 | 31 | CastParameters params; | 743 | 31 | params.is_strict = (CastMode == CastModeType::StrictMode); | 744 | 31 | size_t size = vec_from.size(); | 745 | | | 746 | 31 | RETURN_IF_ERROR(std::visit( | 747 | 31 | [&](auto multiply_may_overflow, auto narrow_integral) { | 748 | 31 | for (size_t i = 0; i < size; i++) { | 749 | 31 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 750 | 31 | typename ToDataType::FieldType, | 751 | 31 | multiply_may_overflow, narrow_integral>( | 752 | 31 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 753 | 31 | scale_multiplier, min_result, max_result, params)) { | 754 | 31 | if (set_nullable) { | 755 | 31 | null_map_data[i] = 1; | 756 | 31 | } else { | 757 | 31 | return params.status; | 758 | 31 | } | 759 | 31 | } | 760 | 31 | } | 761 | 31 | return Status::OK(); | 762 | 31 | }, | 763 | 31 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 764 | | | 765 | 7 | if (narrow_integral) { | 766 | 6 | block.get_by_position(result).column = | 767 | 6 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 768 | 6 | } else { | 769 | 1 | block.get_by_position(result).column = std::move(col_to); | 770 | 1 | } | 771 | 7 | return Status::OK(); | 772 | 31 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE5EEENS_15DataTypeDecimalILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 686 | 13 | const NullMap::value_type* null_map = nullptr) const override { | 687 | 13 | using FromFieldType = typename FromDataType::FieldType; | 688 | 13 | using ToFieldType = typename ToDataType::FieldType; | 689 | 13 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 690 | 13 | const auto* col_from = | 691 | 13 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 692 | 13 | if (!col_from) { | 693 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 694 | 0 | named_from.column->get_name()); | 695 | 0 | } | 696 | | | 697 | 13 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 698 | 13 | constexpr UInt32 from_scale = 0; | 699 | | | 700 | 13 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 701 | 13 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 702 | 13 | UInt32 to_precision = to_decimal_type.get_precision(); | 703 | 13 | ToDataType::check_type_precision(to_precision); | 704 | 13 | UInt32 to_scale = to_decimal_type.get_scale(); | 705 | 13 | ToDataType::check_type_scale(to_scale); | 706 | | | 707 | 13 | auto from_max_int_digit_count = from_precision - from_scale; | 708 | 13 | auto to_max_int_digit_count = to_precision - to_scale; | 709 | | // may overflow. nullable result column. | 710 | 13 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 711 | | // only in non-strict mode and may overflow, we set nullable | 712 | 13 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 713 | | | 714 | 13 | constexpr UInt32 to_max_digits = | 715 | 13 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 716 | 13 | bool multiply_may_overflow = false; | 717 | 13 | if (to_scale > from_scale) { | 718 | 8 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 719 | 8 | } | 720 | 13 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 721 | 13 | sizeof(typename ToFieldType::NativeType)), | 722 | 13 | FromFieldType, typename ToFieldType::NativeType>; | 723 | 13 | MaxNativeType scale_multiplier = | 724 | 13 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 725 | 13 | typename ToFieldType::NativeType max_result = | 726 | 13 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 727 | 13 | typename ToFieldType::NativeType min_result = -max_result; | 728 | | | 729 | 13 | ColumnUInt8::MutablePtr col_null_map_to; | 730 | 13 | NullMap::value_type* null_map_data = nullptr; | 731 | 13 | if (narrow_integral) { | 732 | 12 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 733 | 12 | null_map_data = col_null_map_to->get_data().data(); | 734 | 12 | } | 735 | | | 736 | 13 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 737 | 13 | const auto& vec_from = col_from->get_data(); | 738 | 13 | const auto* vec_from_data = vec_from.data(); | 739 | 13 | auto& vec_to = col_to->get_data(); | 740 | 13 | auto* vec_to_data = vec_to.data(); | 741 | | | 742 | 13 | CastParameters params; | 743 | 13 | params.is_strict = (CastMode == CastModeType::StrictMode); | 744 | 13 | size_t size = vec_from.size(); | 745 | | | 746 | 13 | RETURN_IF_ERROR(std::visit( | 747 | 13 | [&](auto multiply_may_overflow, auto narrow_integral) { | 748 | 13 | for (size_t i = 0; i < size; i++) { | 749 | 13 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 750 | 13 | typename ToDataType::FieldType, | 751 | 13 | multiply_may_overflow, narrow_integral>( | 752 | 13 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 753 | 13 | scale_multiplier, min_result, max_result, params)) { | 754 | 13 | if (set_nullable) { | 755 | 13 | null_map_data[i] = 1; | 756 | 13 | } else { | 757 | 13 | return params.status; | 758 | 13 | } | 759 | 13 | } | 760 | 13 | } | 761 | 13 | return Status::OK(); | 762 | 13 | }, | 763 | 13 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 764 | | | 765 | 13 | if (narrow_integral) { | 766 | 12 | block.get_by_position(result).column = | 767 | 12 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 768 | 12 | } else { | 769 | 1 | block.get_by_position(result).column = std::move(col_to); | 770 | 1 | } | 771 | 13 | return Status::OK(); | 772 | 13 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE6EEENS_15DataTypeDecimalILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 686 | 35 | const NullMap::value_type* null_map = nullptr) const override { | 687 | 35 | using FromFieldType = typename FromDataType::FieldType; | 688 | 35 | using ToFieldType = typename ToDataType::FieldType; | 689 | 35 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 690 | 35 | const auto* col_from = | 691 | 35 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 692 | 35 | if (!col_from) { | 693 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 694 | 0 | named_from.column->get_name()); | 695 | 0 | } | 696 | | | 697 | 35 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 698 | 35 | constexpr UInt32 from_scale = 0; | 699 | | | 700 | 35 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 701 | 35 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 702 | 35 | UInt32 to_precision = to_decimal_type.get_precision(); | 703 | 35 | ToDataType::check_type_precision(to_precision); | 704 | 35 | UInt32 to_scale = to_decimal_type.get_scale(); | 705 | 35 | ToDataType::check_type_scale(to_scale); | 706 | | | 707 | 35 | auto from_max_int_digit_count = from_precision - from_scale; | 708 | 35 | auto to_max_int_digit_count = to_precision - to_scale; | 709 | | // may overflow. nullable result column. | 710 | 35 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 711 | | // only in non-strict mode and may overflow, we set nullable | 712 | 35 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 713 | | | 714 | 35 | constexpr UInt32 to_max_digits = | 715 | 35 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 716 | 35 | bool multiply_may_overflow = false; | 717 | 35 | if (to_scale > from_scale) { | 718 | 20 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 719 | 20 | } | 720 | 35 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 721 | 35 | sizeof(typename ToFieldType::NativeType)), | 722 | 35 | FromFieldType, typename ToFieldType::NativeType>; | 723 | 35 | MaxNativeType scale_multiplier = | 724 | 35 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 725 | 35 | typename ToFieldType::NativeType max_result = | 726 | 35 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 727 | 35 | typename ToFieldType::NativeType min_result = -max_result; | 728 | | | 729 | 35 | ColumnUInt8::MutablePtr col_null_map_to; | 730 | 35 | NullMap::value_type* null_map_data = nullptr; | 731 | 35 | if (narrow_integral) { | 732 | 35 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 733 | 35 | null_map_data = col_null_map_to->get_data().data(); | 734 | 35 | } | 735 | | | 736 | 35 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 737 | 35 | const auto& vec_from = col_from->get_data(); | 738 | 35 | const auto* vec_from_data = vec_from.data(); | 739 | 35 | auto& vec_to = col_to->get_data(); | 740 | 35 | auto* vec_to_data = vec_to.data(); | 741 | | | 742 | 35 | CastParameters params; | 743 | 35 | params.is_strict = (CastMode == CastModeType::StrictMode); | 744 | 35 | size_t size = vec_from.size(); | 745 | | | 746 | 35 | RETURN_IF_ERROR(std::visit( | 747 | 35 | [&](auto multiply_may_overflow, auto narrow_integral) { | 748 | 35 | for (size_t i = 0; i < size; i++) { | 749 | 35 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 750 | 35 | typename ToDataType::FieldType, | 751 | 35 | multiply_may_overflow, narrow_integral>( | 752 | 35 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 753 | 35 | scale_multiplier, min_result, max_result, params)) { | 754 | 35 | if (set_nullable) { | 755 | 35 | null_map_data[i] = 1; | 756 | 35 | } else { | 757 | 35 | return params.status; | 758 | 35 | } | 759 | 35 | } | 760 | 35 | } | 761 | 35 | return Status::OK(); | 762 | 35 | }, | 763 | 35 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 764 | | | 765 | 7 | if (narrow_integral) { | 766 | 7 | block.get_by_position(result).column = | 767 | 7 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 768 | 7 | } else { | 769 | 0 | block.get_by_position(result).column = std::move(col_to); | 770 | 0 | } | 771 | 7 | return Status::OK(); | 772 | 35 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE6EEENS_15DataTypeDecimalILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 686 | 14 | const NullMap::value_type* null_map = nullptr) const override { | 687 | 14 | using FromFieldType = typename FromDataType::FieldType; | 688 | 14 | using ToFieldType = typename ToDataType::FieldType; | 689 | 14 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 690 | 14 | const auto* col_from = | 691 | 14 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 692 | 14 | if (!col_from) { | 693 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 694 | 0 | named_from.column->get_name()); | 695 | 0 | } | 696 | | | 697 | 14 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 698 | 14 | constexpr UInt32 from_scale = 0; | 699 | | | 700 | 14 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 701 | 14 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 702 | 14 | UInt32 to_precision = to_decimal_type.get_precision(); | 703 | 14 | ToDataType::check_type_precision(to_precision); | 704 | 14 | UInt32 to_scale = to_decimal_type.get_scale(); | 705 | 14 | ToDataType::check_type_scale(to_scale); | 706 | | | 707 | 14 | auto from_max_int_digit_count = from_precision - from_scale; | 708 | 14 | auto to_max_int_digit_count = to_precision - to_scale; | 709 | | // may overflow. nullable result column. | 710 | 14 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 711 | | // only in non-strict mode and may overflow, we set nullable | 712 | 14 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 713 | | | 714 | 14 | constexpr UInt32 to_max_digits = | 715 | 14 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 716 | 14 | bool multiply_may_overflow = false; | 717 | 14 | if (to_scale > from_scale) { | 718 | 8 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 719 | 8 | } | 720 | 14 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 721 | 14 | sizeof(typename ToFieldType::NativeType)), | 722 | 14 | FromFieldType, typename ToFieldType::NativeType>; | 723 | 14 | MaxNativeType scale_multiplier = | 724 | 14 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 725 | 14 | typename ToFieldType::NativeType max_result = | 726 | 14 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 727 | 14 | typename ToFieldType::NativeType min_result = -max_result; | 728 | | | 729 | 14 | ColumnUInt8::MutablePtr col_null_map_to; | 730 | 14 | NullMap::value_type* null_map_data = nullptr; | 731 | 14 | if (narrow_integral) { | 732 | 14 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 733 | 14 | null_map_data = col_null_map_to->get_data().data(); | 734 | 14 | } | 735 | | | 736 | 14 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 737 | 14 | const auto& vec_from = col_from->get_data(); | 738 | 14 | const auto* vec_from_data = vec_from.data(); | 739 | 14 | auto& vec_to = col_to->get_data(); | 740 | 14 | auto* vec_to_data = vec_to.data(); | 741 | | | 742 | 14 | CastParameters params; | 743 | 14 | params.is_strict = (CastMode == CastModeType::StrictMode); | 744 | 14 | size_t size = vec_from.size(); | 745 | | | 746 | 14 | RETURN_IF_ERROR(std::visit( | 747 | 14 | [&](auto multiply_may_overflow, auto narrow_integral) { | 748 | 14 | for (size_t i = 0; i < size; i++) { | 749 | 14 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 750 | 14 | typename ToDataType::FieldType, | 751 | 14 | multiply_may_overflow, narrow_integral>( | 752 | 14 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 753 | 14 | scale_multiplier, min_result, max_result, params)) { | 754 | 14 | if (set_nullable) { | 755 | 14 | null_map_data[i] = 1; | 756 | 14 | } else { | 757 | 14 | return params.status; | 758 | 14 | } | 759 | 14 | } | 760 | 14 | } | 761 | 14 | return Status::OK(); | 762 | 14 | }, | 763 | 14 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 764 | | | 765 | 14 | if (narrow_integral) { | 766 | 14 | block.get_by_position(result).column = | 767 | 14 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 768 | 14 | } else { | 769 | 0 | block.get_by_position(result).column = std::move(col_to); | 770 | 0 | } | 771 | 14 | return Status::OK(); | 772 | 14 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE7EEENS_15DataTypeDecimalILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 686 | 35 | const NullMap::value_type* null_map = nullptr) const override { | 687 | 35 | using FromFieldType = typename FromDataType::FieldType; | 688 | 35 | using ToFieldType = typename ToDataType::FieldType; | 689 | 35 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 690 | 35 | const auto* col_from = | 691 | 35 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 692 | 35 | if (!col_from) { | 693 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 694 | 0 | named_from.column->get_name()); | 695 | 0 | } | 696 | | | 697 | 35 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 698 | 35 | constexpr UInt32 from_scale = 0; | 699 | | | 700 | 35 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 701 | 35 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 702 | 35 | UInt32 to_precision = to_decimal_type.get_precision(); | 703 | 35 | ToDataType::check_type_precision(to_precision); | 704 | 35 | UInt32 to_scale = to_decimal_type.get_scale(); | 705 | 35 | ToDataType::check_type_scale(to_scale); | 706 | | | 707 | 35 | auto from_max_int_digit_count = from_precision - from_scale; | 708 | 35 | auto to_max_int_digit_count = to_precision - to_scale; | 709 | | // may overflow. nullable result column. | 710 | 35 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 711 | | // only in non-strict mode and may overflow, we set nullable | 712 | 35 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 713 | | | 714 | 35 | constexpr UInt32 to_max_digits = | 715 | 35 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 716 | 35 | bool multiply_may_overflow = false; | 717 | 35 | if (to_scale > from_scale) { | 718 | 20 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 719 | 20 | } | 720 | 35 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 721 | 35 | sizeof(typename ToFieldType::NativeType)), | 722 | 35 | FromFieldType, typename ToFieldType::NativeType>; | 723 | 35 | MaxNativeType scale_multiplier = | 724 | 35 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 725 | 35 | typename ToFieldType::NativeType max_result = | 726 | 35 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 727 | 35 | typename ToFieldType::NativeType min_result = -max_result; | 728 | | | 729 | 35 | ColumnUInt8::MutablePtr col_null_map_to; | 730 | 35 | NullMap::value_type* null_map_data = nullptr; | 731 | 35 | if (narrow_integral) { | 732 | 35 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 733 | 35 | null_map_data = col_null_map_to->get_data().data(); | 734 | 35 | } | 735 | | | 736 | 35 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 737 | 35 | const auto& vec_from = col_from->get_data(); | 738 | 35 | const auto* vec_from_data = vec_from.data(); | 739 | 35 | auto& vec_to = col_to->get_data(); | 740 | 35 | auto* vec_to_data = vec_to.data(); | 741 | | | 742 | 35 | CastParameters params; | 743 | 35 | params.is_strict = (CastMode == CastModeType::StrictMode); | 744 | 35 | size_t size = vec_from.size(); | 745 | | | 746 | 35 | RETURN_IF_ERROR(std::visit( | 747 | 35 | [&](auto multiply_may_overflow, auto narrow_integral) { | 748 | 35 | for (size_t i = 0; i < size; i++) { | 749 | 35 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 750 | 35 | typename ToDataType::FieldType, | 751 | 35 | multiply_may_overflow, narrow_integral>( | 752 | 35 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 753 | 35 | scale_multiplier, min_result, max_result, params)) { | 754 | 35 | if (set_nullable) { | 755 | 35 | null_map_data[i] = 1; | 756 | 35 | } else { | 757 | 35 | return params.status; | 758 | 35 | } | 759 | 35 | } | 760 | 35 | } | 761 | 35 | return Status::OK(); | 762 | 35 | }, | 763 | 35 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 764 | | | 765 | 7 | if (narrow_integral) { | 766 | 7 | block.get_by_position(result).column = | 767 | 7 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 768 | 7 | } else { | 769 | 0 | block.get_by_position(result).column = std::move(col_to); | 770 | 0 | } | 771 | 7 | return Status::OK(); | 772 | 35 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE7EEENS_15DataTypeDecimalILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 686 | 14 | const NullMap::value_type* null_map = nullptr) const override { | 687 | 14 | using FromFieldType = typename FromDataType::FieldType; | 688 | 14 | using ToFieldType = typename ToDataType::FieldType; | 689 | 14 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 690 | 14 | const auto* col_from = | 691 | 14 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 692 | 14 | if (!col_from) { | 693 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 694 | 0 | named_from.column->get_name()); | 695 | 0 | } | 696 | | | 697 | 14 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 698 | 14 | constexpr UInt32 from_scale = 0; | 699 | | | 700 | 14 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 701 | 14 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 702 | 14 | UInt32 to_precision = to_decimal_type.get_precision(); | 703 | 14 | ToDataType::check_type_precision(to_precision); | 704 | 14 | UInt32 to_scale = to_decimal_type.get_scale(); | 705 | 14 | ToDataType::check_type_scale(to_scale); | 706 | | | 707 | 14 | auto from_max_int_digit_count = from_precision - from_scale; | 708 | 14 | auto to_max_int_digit_count = to_precision - to_scale; | 709 | | // may overflow. nullable result column. | 710 | 14 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 711 | | // only in non-strict mode and may overflow, we set nullable | 712 | 14 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 713 | | | 714 | 14 | constexpr UInt32 to_max_digits = | 715 | 14 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 716 | 14 | bool multiply_may_overflow = false; | 717 | 14 | if (to_scale > from_scale) { | 718 | 8 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 719 | 8 | } | 720 | 14 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 721 | 14 | sizeof(typename ToFieldType::NativeType)), | 722 | 14 | FromFieldType, typename ToFieldType::NativeType>; | 723 | 14 | MaxNativeType scale_multiplier = | 724 | 14 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 725 | 14 | typename ToFieldType::NativeType max_result = | 726 | 14 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 727 | 14 | typename ToFieldType::NativeType min_result = -max_result; | 728 | | | 729 | 14 | ColumnUInt8::MutablePtr col_null_map_to; | 730 | 14 | NullMap::value_type* null_map_data = nullptr; | 731 | 14 | if (narrow_integral) { | 732 | 14 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 733 | 14 | null_map_data = col_null_map_to->get_data().data(); | 734 | 14 | } | 735 | | | 736 | 14 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 737 | 14 | const auto& vec_from = col_from->get_data(); | 738 | 14 | const auto* vec_from_data = vec_from.data(); | 739 | 14 | auto& vec_to = col_to->get_data(); | 740 | 14 | auto* vec_to_data = vec_to.data(); | 741 | | | 742 | 14 | CastParameters params; | 743 | 14 | params.is_strict = (CastMode == CastModeType::StrictMode); | 744 | 14 | size_t size = vec_from.size(); | 745 | | | 746 | 14 | RETURN_IF_ERROR(std::visit( | 747 | 14 | [&](auto multiply_may_overflow, auto narrow_integral) { | 748 | 14 | for (size_t i = 0; i < size; i++) { | 749 | 14 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 750 | 14 | typename ToDataType::FieldType, | 751 | 14 | multiply_may_overflow, narrow_integral>( | 752 | 14 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 753 | 14 | scale_multiplier, min_result, max_result, params)) { | 754 | 14 | if (set_nullable) { | 755 | 14 | null_map_data[i] = 1; | 756 | 14 | } else { | 757 | 14 | return params.status; | 758 | 14 | } | 759 | 14 | } | 760 | 14 | } | 761 | 14 | return Status::OK(); | 762 | 14 | }, | 763 | 14 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 764 | | | 765 | 14 | if (narrow_integral) { | 766 | 14 | block.get_by_position(result).column = | 767 | 14 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 768 | 14 | } else { | 769 | 0 | block.get_by_position(result).column = std::move(col_to); | 770 | 0 | } | 771 | 14 | return Status::OK(); | 772 | 14 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE2EEENS_15DataTypeDecimalILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 686 | 2 | const NullMap::value_type* null_map = nullptr) const override { | 687 | 2 | using FromFieldType = typename FromDataType::FieldType; | 688 | 2 | using ToFieldType = typename ToDataType::FieldType; | 689 | 2 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 690 | 2 | const auto* col_from = | 691 | 2 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 692 | 2 | if (!col_from) { | 693 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 694 | 0 | named_from.column->get_name()); | 695 | 0 | } | 696 | | | 697 | 2 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 698 | 2 | constexpr UInt32 from_scale = 0; | 699 | | | 700 | 2 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 701 | 2 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 702 | 2 | UInt32 to_precision = to_decimal_type.get_precision(); | 703 | 2 | ToDataType::check_type_precision(to_precision); | 704 | 2 | UInt32 to_scale = to_decimal_type.get_scale(); | 705 | 2 | ToDataType::check_type_scale(to_scale); | 706 | | | 707 | 2 | auto from_max_int_digit_count = from_precision - from_scale; | 708 | 2 | auto to_max_int_digit_count = to_precision - to_scale; | 709 | | // may overflow. nullable result column. | 710 | 2 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 711 | | // only in non-strict mode and may overflow, we set nullable | 712 | 2 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 713 | | | 714 | 2 | constexpr UInt32 to_max_digits = | 715 | 2 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 716 | 2 | bool multiply_may_overflow = false; | 717 | 2 | if (to_scale > from_scale) { | 718 | 2 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 719 | 2 | } | 720 | 2 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 721 | 2 | sizeof(typename ToFieldType::NativeType)), | 722 | 2 | FromFieldType, typename ToFieldType::NativeType>; | 723 | 2 | MaxNativeType scale_multiplier = | 724 | 2 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 725 | 2 | typename ToFieldType::NativeType max_result = | 726 | 2 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 727 | 2 | typename ToFieldType::NativeType min_result = -max_result; | 728 | | | 729 | 2 | ColumnUInt8::MutablePtr col_null_map_to; | 730 | 2 | NullMap::value_type* null_map_data = nullptr; | 731 | 2 | if (narrow_integral) { | 732 | 2 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 733 | 2 | null_map_data = col_null_map_to->get_data().data(); | 734 | 2 | } | 735 | | | 736 | 2 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 737 | 2 | const auto& vec_from = col_from->get_data(); | 738 | 2 | const auto* vec_from_data = vec_from.data(); | 739 | 2 | auto& vec_to = col_to->get_data(); | 740 | 2 | auto* vec_to_data = vec_to.data(); | 741 | | | 742 | 2 | CastParameters params; | 743 | 2 | params.is_strict = (CastMode == CastModeType::StrictMode); | 744 | 2 | size_t size = vec_from.size(); | 745 | | | 746 | 2 | RETURN_IF_ERROR(std::visit( | 747 | 2 | [&](auto multiply_may_overflow, auto narrow_integral) { | 748 | 2 | for (size_t i = 0; i < size; i++) { | 749 | 2 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 750 | 2 | typename ToDataType::FieldType, | 751 | 2 | multiply_may_overflow, narrow_integral>( | 752 | 2 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 753 | 2 | scale_multiplier, min_result, max_result, params)) { | 754 | 2 | if (set_nullable) { | 755 | 2 | null_map_data[i] = 1; | 756 | 2 | } else { | 757 | 2 | return params.status; | 758 | 2 | } | 759 | 2 | } | 760 | 2 | } | 761 | 2 | return Status::OK(); | 762 | 2 | }, | 763 | 2 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 764 | | | 765 | 1 | if (narrow_integral) { | 766 | 1 | block.get_by_position(result).column = | 767 | 1 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 768 | 1 | } else { | 769 | 0 | block.get_by_position(result).column = std::move(col_to); | 770 | 0 | } | 771 | 1 | return Status::OK(); | 772 | 2 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE2EEENS_15DataTypeDecimalILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 686 | 5 | const NullMap::value_type* null_map = nullptr) const override { | 687 | 5 | using FromFieldType = typename FromDataType::FieldType; | 688 | 5 | using ToFieldType = typename ToDataType::FieldType; | 689 | 5 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 690 | 5 | const auto* col_from = | 691 | 5 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 692 | 5 | if (!col_from) { | 693 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 694 | 0 | named_from.column->get_name()); | 695 | 0 | } | 696 | | | 697 | 5 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 698 | 5 | constexpr UInt32 from_scale = 0; | 699 | | | 700 | 5 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 701 | 5 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 702 | 5 | UInt32 to_precision = to_decimal_type.get_precision(); | 703 | 5 | ToDataType::check_type_precision(to_precision); | 704 | 5 | UInt32 to_scale = to_decimal_type.get_scale(); | 705 | 5 | ToDataType::check_type_scale(to_scale); | 706 | | | 707 | 5 | auto from_max_int_digit_count = from_precision - from_scale; | 708 | 5 | auto to_max_int_digit_count = to_precision - to_scale; | 709 | | // may overflow. nullable result column. | 710 | 5 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 711 | | // only in non-strict mode and may overflow, we set nullable | 712 | 5 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 713 | | | 714 | 5 | constexpr UInt32 to_max_digits = | 715 | 5 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 716 | 5 | bool multiply_may_overflow = false; | 717 | 5 | if (to_scale > from_scale) { | 718 | 4 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 719 | 4 | } | 720 | 5 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 721 | 5 | sizeof(typename ToFieldType::NativeType)), | 722 | 5 | FromFieldType, typename ToFieldType::NativeType>; | 723 | 5 | MaxNativeType scale_multiplier = | 724 | 5 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 725 | 5 | typename ToFieldType::NativeType max_result = | 726 | 5 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 727 | 5 | typename ToFieldType::NativeType min_result = -max_result; | 728 | | | 729 | 5 | ColumnUInt8::MutablePtr col_null_map_to; | 730 | 5 | NullMap::value_type* null_map_data = nullptr; | 731 | 5 | if (narrow_integral) { | 732 | 1 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 733 | 1 | null_map_data = col_null_map_to->get_data().data(); | 734 | 1 | } | 735 | | | 736 | 5 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 737 | 5 | const auto& vec_from = col_from->get_data(); | 738 | 5 | const auto* vec_from_data = vec_from.data(); | 739 | 5 | auto& vec_to = col_to->get_data(); | 740 | 5 | auto* vec_to_data = vec_to.data(); | 741 | | | 742 | 5 | CastParameters params; | 743 | 5 | params.is_strict = (CastMode == CastModeType::StrictMode); | 744 | 5 | size_t size = vec_from.size(); | 745 | | | 746 | 5 | RETURN_IF_ERROR(std::visit( | 747 | 5 | [&](auto multiply_may_overflow, auto narrow_integral) { | 748 | 5 | for (size_t i = 0; i < size; i++) { | 749 | 5 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 750 | 5 | typename ToDataType::FieldType, | 751 | 5 | multiply_may_overflow, narrow_integral>( | 752 | 5 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 753 | 5 | scale_multiplier, min_result, max_result, params)) { | 754 | 5 | if (set_nullable) { | 755 | 5 | null_map_data[i] = 1; | 756 | 5 | } else { | 757 | 5 | return params.status; | 758 | 5 | } | 759 | 5 | } | 760 | 5 | } | 761 | 5 | return Status::OK(); | 762 | 5 | }, | 763 | 5 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 764 | | | 765 | 5 | if (narrow_integral) { | 766 | 1 | block.get_by_position(result).column = | 767 | 1 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 768 | 4 | } else { | 769 | 4 | block.get_by_position(result).column = std::move(col_to); | 770 | 4 | } | 771 | 5 | return Status::OK(); | 772 | 5 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE3EEENS_15DataTypeDecimalILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 686 | 19 | const NullMap::value_type* null_map = nullptr) const override { | 687 | 19 | using FromFieldType = typename FromDataType::FieldType; | 688 | 19 | using ToFieldType = typename ToDataType::FieldType; | 689 | 19 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 690 | 19 | const auto* col_from = | 691 | 19 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 692 | 19 | if (!col_from) { | 693 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 694 | 0 | named_from.column->get_name()); | 695 | 0 | } | 696 | | | 697 | 19 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 698 | 19 | constexpr UInt32 from_scale = 0; | 699 | | | 700 | 19 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 701 | 19 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 702 | 19 | UInt32 to_precision = to_decimal_type.get_precision(); | 703 | 19 | ToDataType::check_type_precision(to_precision); | 704 | 19 | UInt32 to_scale = to_decimal_type.get_scale(); | 705 | 19 | ToDataType::check_type_scale(to_scale); | 706 | | | 707 | 19 | auto from_max_int_digit_count = from_precision - from_scale; | 708 | 19 | auto to_max_int_digit_count = to_precision - to_scale; | 709 | | // may overflow. nullable result column. | 710 | 19 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 711 | | // only in non-strict mode and may overflow, we set nullable | 712 | 19 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 713 | | | 714 | 19 | constexpr UInt32 to_max_digits = | 715 | 19 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 716 | 19 | bool multiply_may_overflow = false; | 717 | 19 | if (to_scale > from_scale) { | 718 | 12 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 719 | 12 | } | 720 | 19 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 721 | 19 | sizeof(typename ToFieldType::NativeType)), | 722 | 19 | FromFieldType, typename ToFieldType::NativeType>; | 723 | 19 | MaxNativeType scale_multiplier = | 724 | 19 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 725 | 19 | typename ToFieldType::NativeType max_result = | 726 | 19 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 727 | 19 | typename ToFieldType::NativeType min_result = -max_result; | 728 | | | 729 | 19 | ColumnUInt8::MutablePtr col_null_map_to; | 730 | 19 | NullMap::value_type* null_map_data = nullptr; | 731 | 19 | if (narrow_integral) { | 732 | 15 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 733 | 15 | null_map_data = col_null_map_to->get_data().data(); | 734 | 15 | } | 735 | | | 736 | 19 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 737 | 19 | const auto& vec_from = col_from->get_data(); | 738 | 19 | const auto* vec_from_data = vec_from.data(); | 739 | 19 | auto& vec_to = col_to->get_data(); | 740 | 19 | auto* vec_to_data = vec_to.data(); | 741 | | | 742 | 19 | CastParameters params; | 743 | 19 | params.is_strict = (CastMode == CastModeType::StrictMode); | 744 | 19 | size_t size = vec_from.size(); | 745 | | | 746 | 19 | RETURN_IF_ERROR(std::visit( | 747 | 19 | [&](auto multiply_may_overflow, auto narrow_integral) { | 748 | 19 | for (size_t i = 0; i < size; i++) { | 749 | 19 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 750 | 19 | typename ToDataType::FieldType, | 751 | 19 | multiply_may_overflow, narrow_integral>( | 752 | 19 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 753 | 19 | scale_multiplier, min_result, max_result, params)) { | 754 | 19 | if (set_nullable) { | 755 | 19 | null_map_data[i] = 1; | 756 | 19 | } else { | 757 | 19 | return params.status; | 758 | 19 | } | 759 | 19 | } | 760 | 19 | } | 761 | 19 | return Status::OK(); | 762 | 19 | }, | 763 | 19 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 764 | | | 765 | 7 | if (narrow_integral) { | 766 | 3 | block.get_by_position(result).column = | 767 | 3 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 768 | 4 | } else { | 769 | 4 | block.get_by_position(result).column = std::move(col_to); | 770 | 4 | } | 771 | 7 | return Status::OK(); | 772 | 19 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE3EEENS_15DataTypeDecimalILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 686 | 10 | const NullMap::value_type* null_map = nullptr) const override { | 687 | 10 | using FromFieldType = typename FromDataType::FieldType; | 688 | 10 | using ToFieldType = typename ToDataType::FieldType; | 689 | 10 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 690 | 10 | const auto* col_from = | 691 | 10 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 692 | 10 | if (!col_from) { | 693 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 694 | 0 | named_from.column->get_name()); | 695 | 0 | } | 696 | | | 697 | 10 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 698 | 10 | constexpr UInt32 from_scale = 0; | 699 | | | 700 | 10 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 701 | 10 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 702 | 10 | UInt32 to_precision = to_decimal_type.get_precision(); | 703 | 10 | ToDataType::check_type_precision(to_precision); | 704 | 10 | UInt32 to_scale = to_decimal_type.get_scale(); | 705 | 10 | ToDataType::check_type_scale(to_scale); | 706 | | | 707 | 10 | auto from_max_int_digit_count = from_precision - from_scale; | 708 | 10 | auto to_max_int_digit_count = to_precision - to_scale; | 709 | | // may overflow. nullable result column. | 710 | 10 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 711 | | // only in non-strict mode and may overflow, we set nullable | 712 | 10 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 713 | | | 714 | 10 | constexpr UInt32 to_max_digits = | 715 | 10 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 716 | 10 | bool multiply_may_overflow = false; | 717 | 10 | if (to_scale > from_scale) { | 718 | 6 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 719 | 6 | } | 720 | 10 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 721 | 10 | sizeof(typename ToFieldType::NativeType)), | 722 | 10 | FromFieldType, typename ToFieldType::NativeType>; | 723 | 10 | MaxNativeType scale_multiplier = | 724 | 10 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 725 | 10 | typename ToFieldType::NativeType max_result = | 726 | 10 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 727 | 10 | typename ToFieldType::NativeType min_result = -max_result; | 728 | | | 729 | 10 | ColumnUInt8::MutablePtr col_null_map_to; | 730 | 10 | NullMap::value_type* null_map_data = nullptr; | 731 | 10 | if (narrow_integral) { | 732 | 6 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 733 | 6 | null_map_data = col_null_map_to->get_data().data(); | 734 | 6 | } | 735 | | | 736 | 10 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 737 | 10 | const auto& vec_from = col_from->get_data(); | 738 | 10 | const auto* vec_from_data = vec_from.data(); | 739 | 10 | auto& vec_to = col_to->get_data(); | 740 | 10 | auto* vec_to_data = vec_to.data(); | 741 | | | 742 | 10 | CastParameters params; | 743 | 10 | params.is_strict = (CastMode == CastModeType::StrictMode); | 744 | 10 | size_t size = vec_from.size(); | 745 | | | 746 | 10 | RETURN_IF_ERROR(std::visit( | 747 | 10 | [&](auto multiply_may_overflow, auto narrow_integral) { | 748 | 10 | for (size_t i = 0; i < size; i++) { | 749 | 10 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 750 | 10 | typename ToDataType::FieldType, | 751 | 10 | multiply_may_overflow, narrow_integral>( | 752 | 10 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 753 | 10 | scale_multiplier, min_result, max_result, params)) { | 754 | 10 | if (set_nullable) { | 755 | 10 | null_map_data[i] = 1; | 756 | 10 | } else { | 757 | 10 | return params.status; | 758 | 10 | } | 759 | 10 | } | 760 | 10 | } | 761 | 10 | return Status::OK(); | 762 | 10 | }, | 763 | 10 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 764 | | | 765 | 10 | if (narrow_integral) { | 766 | 6 | block.get_by_position(result).column = | 767 | 6 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 768 | 6 | } else { | 769 | 4 | block.get_by_position(result).column = std::move(col_to); | 770 | 4 | } | 771 | 10 | return Status::OK(); | 772 | 10 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE4EEENS_15DataTypeDecimalILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 686 | 19 | const NullMap::value_type* null_map = nullptr) const override { | 687 | 19 | using FromFieldType = typename FromDataType::FieldType; | 688 | 19 | using ToFieldType = typename ToDataType::FieldType; | 689 | 19 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 690 | 19 | const auto* col_from = | 691 | 19 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 692 | 19 | if (!col_from) { | 693 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 694 | 0 | named_from.column->get_name()); | 695 | 0 | } | 696 | | | 697 | 19 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 698 | 19 | constexpr UInt32 from_scale = 0; | 699 | | | 700 | 19 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 701 | 19 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 702 | 19 | UInt32 to_precision = to_decimal_type.get_precision(); | 703 | 19 | ToDataType::check_type_precision(to_precision); | 704 | 19 | UInt32 to_scale = to_decimal_type.get_scale(); | 705 | 19 | ToDataType::check_type_scale(to_scale); | 706 | | | 707 | 19 | auto from_max_int_digit_count = from_precision - from_scale; | 708 | 19 | auto to_max_int_digit_count = to_precision - to_scale; | 709 | | // may overflow. nullable result column. | 710 | 19 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 711 | | // only in non-strict mode and may overflow, we set nullable | 712 | 19 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 713 | | | 714 | 19 | constexpr UInt32 to_max_digits = | 715 | 19 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 716 | 19 | bool multiply_may_overflow = false; | 717 | 19 | if (to_scale > from_scale) { | 718 | 12 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 719 | 12 | } | 720 | 19 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 721 | 19 | sizeof(typename ToFieldType::NativeType)), | 722 | 19 | FromFieldType, typename ToFieldType::NativeType>; | 723 | 19 | MaxNativeType scale_multiplier = | 724 | 19 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 725 | 19 | typename ToFieldType::NativeType max_result = | 726 | 19 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 727 | 19 | typename ToFieldType::NativeType min_result = -max_result; | 728 | | | 729 | 19 | ColumnUInt8::MutablePtr col_null_map_to; | 730 | 19 | NullMap::value_type* null_map_data = nullptr; | 731 | 19 | if (narrow_integral) { | 732 | 15 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 733 | 15 | null_map_data = col_null_map_to->get_data().data(); | 734 | 15 | } | 735 | | | 736 | 19 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 737 | 19 | const auto& vec_from = col_from->get_data(); | 738 | 19 | const auto* vec_from_data = vec_from.data(); | 739 | 19 | auto& vec_to = col_to->get_data(); | 740 | 19 | auto* vec_to_data = vec_to.data(); | 741 | | | 742 | 19 | CastParameters params; | 743 | 19 | params.is_strict = (CastMode == CastModeType::StrictMode); | 744 | 19 | size_t size = vec_from.size(); | 745 | | | 746 | 19 | RETURN_IF_ERROR(std::visit( | 747 | 19 | [&](auto multiply_may_overflow, auto narrow_integral) { | 748 | 19 | for (size_t i = 0; i < size; i++) { | 749 | 19 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 750 | 19 | typename ToDataType::FieldType, | 751 | 19 | multiply_may_overflow, narrow_integral>( | 752 | 19 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 753 | 19 | scale_multiplier, min_result, max_result, params)) { | 754 | 19 | if (set_nullable) { | 755 | 19 | null_map_data[i] = 1; | 756 | 19 | } else { | 757 | 19 | return params.status; | 758 | 19 | } | 759 | 19 | } | 760 | 19 | } | 761 | 19 | return Status::OK(); | 762 | 19 | }, | 763 | 19 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 764 | | | 765 | 7 | if (narrow_integral) { | 766 | 3 | block.get_by_position(result).column = | 767 | 3 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 768 | 4 | } else { | 769 | 4 | block.get_by_position(result).column = std::move(col_to); | 770 | 4 | } | 771 | 7 | return Status::OK(); | 772 | 19 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE4EEENS_15DataTypeDecimalILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 686 | 10 | const NullMap::value_type* null_map = nullptr) const override { | 687 | 10 | using FromFieldType = typename FromDataType::FieldType; | 688 | 10 | using ToFieldType = typename ToDataType::FieldType; | 689 | 10 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 690 | 10 | const auto* col_from = | 691 | 10 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 692 | 10 | if (!col_from) { | 693 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 694 | 0 | named_from.column->get_name()); | 695 | 0 | } | 696 | | | 697 | 10 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 698 | 10 | constexpr UInt32 from_scale = 0; | 699 | | | 700 | 10 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 701 | 10 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 702 | 10 | UInt32 to_precision = to_decimal_type.get_precision(); | 703 | 10 | ToDataType::check_type_precision(to_precision); | 704 | 10 | UInt32 to_scale = to_decimal_type.get_scale(); | 705 | 10 | ToDataType::check_type_scale(to_scale); | 706 | | | 707 | 10 | auto from_max_int_digit_count = from_precision - from_scale; | 708 | 10 | auto to_max_int_digit_count = to_precision - to_scale; | 709 | | // may overflow. nullable result column. | 710 | 10 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 711 | | // only in non-strict mode and may overflow, we set nullable | 712 | 10 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 713 | | | 714 | 10 | constexpr UInt32 to_max_digits = | 715 | 10 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 716 | 10 | bool multiply_may_overflow = false; | 717 | 10 | if (to_scale > from_scale) { | 718 | 6 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 719 | 6 | } | 720 | 10 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 721 | 10 | sizeof(typename ToFieldType::NativeType)), | 722 | 10 | FromFieldType, typename ToFieldType::NativeType>; | 723 | 10 | MaxNativeType scale_multiplier = | 724 | 10 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 725 | 10 | typename ToFieldType::NativeType max_result = | 726 | 10 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 727 | 10 | typename ToFieldType::NativeType min_result = -max_result; | 728 | | | 729 | 10 | ColumnUInt8::MutablePtr col_null_map_to; | 730 | 10 | NullMap::value_type* null_map_data = nullptr; | 731 | 10 | if (narrow_integral) { | 732 | 6 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 733 | 6 | null_map_data = col_null_map_to->get_data().data(); | 734 | 6 | } | 735 | | | 736 | 10 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 737 | 10 | const auto& vec_from = col_from->get_data(); | 738 | 10 | const auto* vec_from_data = vec_from.data(); | 739 | 10 | auto& vec_to = col_to->get_data(); | 740 | 10 | auto* vec_to_data = vec_to.data(); | 741 | | | 742 | 10 | CastParameters params; | 743 | 10 | params.is_strict = (CastMode == CastModeType::StrictMode); | 744 | 10 | size_t size = vec_from.size(); | 745 | | | 746 | 10 | RETURN_IF_ERROR(std::visit( | 747 | 10 | [&](auto multiply_may_overflow, auto narrow_integral) { | 748 | 10 | for (size_t i = 0; i < size; i++) { | 749 | 10 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 750 | 10 | typename ToDataType::FieldType, | 751 | 10 | multiply_may_overflow, narrow_integral>( | 752 | 10 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 753 | 10 | scale_multiplier, min_result, max_result, params)) { | 754 | 10 | if (set_nullable) { | 755 | 10 | null_map_data[i] = 1; | 756 | 10 | } else { | 757 | 10 | return params.status; | 758 | 10 | } | 759 | 10 | } | 760 | 10 | } | 761 | 10 | return Status::OK(); | 762 | 10 | }, | 763 | 10 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 764 | | | 765 | 10 | if (narrow_integral) { | 766 | 6 | block.get_by_position(result).column = | 767 | 6 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 768 | 6 | } else { | 769 | 4 | block.get_by_position(result).column = std::move(col_to); | 770 | 4 | } | 771 | 10 | return Status::OK(); | 772 | 10 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE5EEENS_15DataTypeDecimalILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 686 | 19 | const NullMap::value_type* null_map = nullptr) const override { | 687 | 19 | using FromFieldType = typename FromDataType::FieldType; | 688 | 19 | using ToFieldType = typename ToDataType::FieldType; | 689 | 19 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 690 | 19 | const auto* col_from = | 691 | 19 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 692 | 19 | if (!col_from) { | 693 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 694 | 0 | named_from.column->get_name()); | 695 | 0 | } | 696 | | | 697 | 19 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 698 | 19 | constexpr UInt32 from_scale = 0; | 699 | | | 700 | 19 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 701 | 19 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 702 | 19 | UInt32 to_precision = to_decimal_type.get_precision(); | 703 | 19 | ToDataType::check_type_precision(to_precision); | 704 | 19 | UInt32 to_scale = to_decimal_type.get_scale(); | 705 | 19 | ToDataType::check_type_scale(to_scale); | 706 | | | 707 | 19 | auto from_max_int_digit_count = from_precision - from_scale; | 708 | 19 | auto to_max_int_digit_count = to_precision - to_scale; | 709 | | // may overflow. nullable result column. | 710 | 19 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 711 | | // only in non-strict mode and may overflow, we set nullable | 712 | 19 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 713 | | | 714 | 19 | constexpr UInt32 to_max_digits = | 715 | 19 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 716 | 19 | bool multiply_may_overflow = false; | 717 | 19 | if (to_scale > from_scale) { | 718 | 12 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 719 | 12 | } | 720 | 19 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 721 | 19 | sizeof(typename ToFieldType::NativeType)), | 722 | 19 | FromFieldType, typename ToFieldType::NativeType>; | 723 | 19 | MaxNativeType scale_multiplier = | 724 | 19 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 725 | 19 | typename ToFieldType::NativeType max_result = | 726 | 19 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 727 | 19 | typename ToFieldType::NativeType min_result = -max_result; | 728 | | | 729 | 19 | ColumnUInt8::MutablePtr col_null_map_to; | 730 | 19 | NullMap::value_type* null_map_data = nullptr; | 731 | 19 | if (narrow_integral) { | 732 | 15 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 733 | 15 | null_map_data = col_null_map_to->get_data().data(); | 734 | 15 | } | 735 | | | 736 | 19 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 737 | 19 | const auto& vec_from = col_from->get_data(); | 738 | 19 | const auto* vec_from_data = vec_from.data(); | 739 | 19 | auto& vec_to = col_to->get_data(); | 740 | 19 | auto* vec_to_data = vec_to.data(); | 741 | | | 742 | 19 | CastParameters params; | 743 | 19 | params.is_strict = (CastMode == CastModeType::StrictMode); | 744 | 19 | size_t size = vec_from.size(); | 745 | | | 746 | 19 | RETURN_IF_ERROR(std::visit( | 747 | 19 | [&](auto multiply_may_overflow, auto narrow_integral) { | 748 | 19 | for (size_t i = 0; i < size; i++) { | 749 | 19 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 750 | 19 | typename ToDataType::FieldType, | 751 | 19 | multiply_may_overflow, narrow_integral>( | 752 | 19 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 753 | 19 | scale_multiplier, min_result, max_result, params)) { | 754 | 19 | if (set_nullable) { | 755 | 19 | null_map_data[i] = 1; | 756 | 19 | } else { | 757 | 19 | return params.status; | 758 | 19 | } | 759 | 19 | } | 760 | 19 | } | 761 | 19 | return Status::OK(); | 762 | 19 | }, | 763 | 19 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 764 | | | 765 | 7 | if (narrow_integral) { | 766 | 3 | block.get_by_position(result).column = | 767 | 3 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 768 | 4 | } else { | 769 | 4 | block.get_by_position(result).column = std::move(col_to); | 770 | 4 | } | 771 | 7 | return Status::OK(); | 772 | 19 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE5EEENS_15DataTypeDecimalILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 686 | 10 | const NullMap::value_type* null_map = nullptr) const override { | 687 | 10 | using FromFieldType = typename FromDataType::FieldType; | 688 | 10 | using ToFieldType = typename ToDataType::FieldType; | 689 | 10 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 690 | 10 | const auto* col_from = | 691 | 10 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 692 | 10 | if (!col_from) { | 693 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 694 | 0 | named_from.column->get_name()); | 695 | 0 | } | 696 | | | 697 | 10 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 698 | 10 | constexpr UInt32 from_scale = 0; | 699 | | | 700 | 10 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 701 | 10 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 702 | 10 | UInt32 to_precision = to_decimal_type.get_precision(); | 703 | 10 | ToDataType::check_type_precision(to_precision); | 704 | 10 | UInt32 to_scale = to_decimal_type.get_scale(); | 705 | 10 | ToDataType::check_type_scale(to_scale); | 706 | | | 707 | 10 | auto from_max_int_digit_count = from_precision - from_scale; | 708 | 10 | auto to_max_int_digit_count = to_precision - to_scale; | 709 | | // may overflow. nullable result column. | 710 | 10 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 711 | | // only in non-strict mode and may overflow, we set nullable | 712 | 10 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 713 | | | 714 | 10 | constexpr UInt32 to_max_digits = | 715 | 10 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 716 | 10 | bool multiply_may_overflow = false; | 717 | 10 | if (to_scale > from_scale) { | 718 | 6 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 719 | 6 | } | 720 | 10 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 721 | 10 | sizeof(typename ToFieldType::NativeType)), | 722 | 10 | FromFieldType, typename ToFieldType::NativeType>; | 723 | 10 | MaxNativeType scale_multiplier = | 724 | 10 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 725 | 10 | typename ToFieldType::NativeType max_result = | 726 | 10 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 727 | 10 | typename ToFieldType::NativeType min_result = -max_result; | 728 | | | 729 | 10 | ColumnUInt8::MutablePtr col_null_map_to; | 730 | 10 | NullMap::value_type* null_map_data = nullptr; | 731 | 10 | if (narrow_integral) { | 732 | 6 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 733 | 6 | null_map_data = col_null_map_to->get_data().data(); | 734 | 6 | } | 735 | | | 736 | 10 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 737 | 10 | const auto& vec_from = col_from->get_data(); | 738 | 10 | const auto* vec_from_data = vec_from.data(); | 739 | 10 | auto& vec_to = col_to->get_data(); | 740 | 10 | auto* vec_to_data = vec_to.data(); | 741 | | | 742 | 10 | CastParameters params; | 743 | 10 | params.is_strict = (CastMode == CastModeType::StrictMode); | 744 | 10 | size_t size = vec_from.size(); | 745 | | | 746 | 10 | RETURN_IF_ERROR(std::visit( | 747 | 10 | [&](auto multiply_may_overflow, auto narrow_integral) { | 748 | 10 | for (size_t i = 0; i < size; i++) { | 749 | 10 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 750 | 10 | typename ToDataType::FieldType, | 751 | 10 | multiply_may_overflow, narrow_integral>( | 752 | 10 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 753 | 10 | scale_multiplier, min_result, max_result, params)) { | 754 | 10 | if (set_nullable) { | 755 | 10 | null_map_data[i] = 1; | 756 | 10 | } else { | 757 | 10 | return params.status; | 758 | 10 | } | 759 | 10 | } | 760 | 10 | } | 761 | 10 | return Status::OK(); | 762 | 10 | }, | 763 | 10 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 764 | | | 765 | 10 | if (narrow_integral) { | 766 | 6 | block.get_by_position(result).column = | 767 | 6 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 768 | 6 | } else { | 769 | 4 | block.get_by_position(result).column = std::move(col_to); | 770 | 4 | } | 771 | 10 | return Status::OK(); | 772 | 10 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE6EEENS_15DataTypeDecimalILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 686 | 23 | const NullMap::value_type* null_map = nullptr) const override { | 687 | 23 | using FromFieldType = typename FromDataType::FieldType; | 688 | 23 | using ToFieldType = typename ToDataType::FieldType; | 689 | 23 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 690 | 23 | const auto* col_from = | 691 | 23 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 692 | 23 | if (!col_from) { | 693 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 694 | 0 | named_from.column->get_name()); | 695 | 0 | } | 696 | | | 697 | 23 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 698 | 23 | constexpr UInt32 from_scale = 0; | 699 | | | 700 | 23 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 701 | 23 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 702 | 23 | UInt32 to_precision = to_decimal_type.get_precision(); | 703 | 23 | ToDataType::check_type_precision(to_precision); | 704 | 23 | UInt32 to_scale = to_decimal_type.get_scale(); | 705 | 23 | ToDataType::check_type_scale(to_scale); | 706 | | | 707 | 23 | auto from_max_int_digit_count = from_precision - from_scale; | 708 | 23 | auto to_max_int_digit_count = to_precision - to_scale; | 709 | | // may overflow. nullable result column. | 710 | 23 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 711 | | // only in non-strict mode and may overflow, we set nullable | 712 | 23 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 713 | | | 714 | 23 | constexpr UInt32 to_max_digits = | 715 | 23 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 716 | 23 | bool multiply_may_overflow = false; | 717 | 23 | if (to_scale > from_scale) { | 718 | 16 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 719 | 16 | } | 720 | 23 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 721 | 23 | sizeof(typename ToFieldType::NativeType)), | 722 | 23 | FromFieldType, typename ToFieldType::NativeType>; | 723 | 23 | MaxNativeType scale_multiplier = | 724 | 23 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 725 | 23 | typename ToFieldType::NativeType max_result = | 726 | 23 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 727 | 23 | typename ToFieldType::NativeType min_result = -max_result; | 728 | | | 729 | 23 | ColumnUInt8::MutablePtr col_null_map_to; | 730 | 23 | NullMap::value_type* null_map_data = nullptr; | 731 | 23 | if (narrow_integral) { | 732 | 20 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 733 | 20 | null_map_data = col_null_map_to->get_data().data(); | 734 | 20 | } | 735 | | | 736 | 23 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 737 | 23 | const auto& vec_from = col_from->get_data(); | 738 | 23 | const auto* vec_from_data = vec_from.data(); | 739 | 23 | auto& vec_to = col_to->get_data(); | 740 | 23 | auto* vec_to_data = vec_to.data(); | 741 | | | 742 | 23 | CastParameters params; | 743 | 23 | params.is_strict = (CastMode == CastModeType::StrictMode); | 744 | 23 | size_t size = vec_from.size(); | 745 | | | 746 | 23 | RETURN_IF_ERROR(std::visit( | 747 | 23 | [&](auto multiply_may_overflow, auto narrow_integral) { | 748 | 23 | for (size_t i = 0; i < size; i++) { | 749 | 23 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 750 | 23 | typename ToDataType::FieldType, | 751 | 23 | multiply_may_overflow, narrow_integral>( | 752 | 23 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 753 | 23 | scale_multiplier, min_result, max_result, params)) { | 754 | 23 | if (set_nullable) { | 755 | 23 | null_map_data[i] = 1; | 756 | 23 | } else { | 757 | 23 | return params.status; | 758 | 23 | } | 759 | 23 | } | 760 | 23 | } | 761 | 23 | return Status::OK(); | 762 | 23 | }, | 763 | 23 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 764 | | | 765 | 7 | if (narrow_integral) { | 766 | 4 | block.get_by_position(result).column = | 767 | 4 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 768 | 4 | } else { | 769 | 3 | block.get_by_position(result).column = std::move(col_to); | 770 | 3 | } | 771 | 7 | return Status::OK(); | 772 | 23 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE6EEENS_15DataTypeDecimalILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 686 | 11 | const NullMap::value_type* null_map = nullptr) const override { | 687 | 11 | using FromFieldType = typename FromDataType::FieldType; | 688 | 11 | using ToFieldType = typename ToDataType::FieldType; | 689 | 11 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 690 | 11 | const auto* col_from = | 691 | 11 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 692 | 11 | if (!col_from) { | 693 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 694 | 0 | named_from.column->get_name()); | 695 | 0 | } | 696 | | | 697 | 11 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 698 | 11 | constexpr UInt32 from_scale = 0; | 699 | | | 700 | 11 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 701 | 11 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 702 | 11 | UInt32 to_precision = to_decimal_type.get_precision(); | 703 | 11 | ToDataType::check_type_precision(to_precision); | 704 | 11 | UInt32 to_scale = to_decimal_type.get_scale(); | 705 | 11 | ToDataType::check_type_scale(to_scale); | 706 | | | 707 | 11 | auto from_max_int_digit_count = from_precision - from_scale; | 708 | 11 | auto to_max_int_digit_count = to_precision - to_scale; | 709 | | // may overflow. nullable result column. | 710 | 11 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 711 | | // only in non-strict mode and may overflow, we set nullable | 712 | 11 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 713 | | | 714 | 11 | constexpr UInt32 to_max_digits = | 715 | 11 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 716 | 11 | bool multiply_may_overflow = false; | 717 | 11 | if (to_scale > from_scale) { | 718 | 7 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 719 | 7 | } | 720 | 11 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 721 | 11 | sizeof(typename ToFieldType::NativeType)), | 722 | 11 | FromFieldType, typename ToFieldType::NativeType>; | 723 | 11 | MaxNativeType scale_multiplier = | 724 | 11 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 725 | 11 | typename ToFieldType::NativeType max_result = | 726 | 11 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 727 | 11 | typename ToFieldType::NativeType min_result = -max_result; | 728 | | | 729 | 11 | ColumnUInt8::MutablePtr col_null_map_to; | 730 | 11 | NullMap::value_type* null_map_data = nullptr; | 731 | 11 | if (narrow_integral) { | 732 | 8 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 733 | 8 | null_map_data = col_null_map_to->get_data().data(); | 734 | 8 | } | 735 | | | 736 | 11 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 737 | 11 | const auto& vec_from = col_from->get_data(); | 738 | 11 | const auto* vec_from_data = vec_from.data(); | 739 | 11 | auto& vec_to = col_to->get_data(); | 740 | 11 | auto* vec_to_data = vec_to.data(); | 741 | | | 742 | 11 | CastParameters params; | 743 | 11 | params.is_strict = (CastMode == CastModeType::StrictMode); | 744 | 11 | size_t size = vec_from.size(); | 745 | | | 746 | 11 | RETURN_IF_ERROR(std::visit( | 747 | 11 | [&](auto multiply_may_overflow, auto narrow_integral) { | 748 | 11 | for (size_t i = 0; i < size; i++) { | 749 | 11 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 750 | 11 | typename ToDataType::FieldType, | 751 | 11 | multiply_may_overflow, narrow_integral>( | 752 | 11 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 753 | 11 | scale_multiplier, min_result, max_result, params)) { | 754 | 11 | if (set_nullable) { | 755 | 11 | null_map_data[i] = 1; | 756 | 11 | } else { | 757 | 11 | return params.status; | 758 | 11 | } | 759 | 11 | } | 760 | 11 | } | 761 | 11 | return Status::OK(); | 762 | 11 | }, | 763 | 11 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 764 | | | 765 | 11 | if (narrow_integral) { | 766 | 8 | block.get_by_position(result).column = | 767 | 8 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 768 | 8 | } else { | 769 | 3 | block.get_by_position(result).column = std::move(col_to); | 770 | 3 | } | 771 | 11 | return Status::OK(); | 772 | 11 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE7EEENS_15DataTypeDecimalILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 686 | 35 | const NullMap::value_type* null_map = nullptr) const override { | 687 | 35 | using FromFieldType = typename FromDataType::FieldType; | 688 | 35 | using ToFieldType = typename ToDataType::FieldType; | 689 | 35 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 690 | 35 | const auto* col_from = | 691 | 35 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 692 | 35 | if (!col_from) { | 693 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 694 | 0 | named_from.column->get_name()); | 695 | 0 | } | 696 | | | 697 | 35 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 698 | 35 | constexpr UInt32 from_scale = 0; | 699 | | | 700 | 35 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 701 | 35 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 702 | 35 | UInt32 to_precision = to_decimal_type.get_precision(); | 703 | 35 | ToDataType::check_type_precision(to_precision); | 704 | 35 | UInt32 to_scale = to_decimal_type.get_scale(); | 705 | 35 | ToDataType::check_type_scale(to_scale); | 706 | | | 707 | 35 | auto from_max_int_digit_count = from_precision - from_scale; | 708 | 35 | auto to_max_int_digit_count = to_precision - to_scale; | 709 | | // may overflow. nullable result column. | 710 | 35 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 711 | | // only in non-strict mode and may overflow, we set nullable | 712 | 35 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 713 | | | 714 | 35 | constexpr UInt32 to_max_digits = | 715 | 35 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 716 | 35 | bool multiply_may_overflow = false; | 717 | 35 | if (to_scale > from_scale) { | 718 | 20 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 719 | 20 | } | 720 | 35 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 721 | 35 | sizeof(typename ToFieldType::NativeType)), | 722 | 35 | FromFieldType, typename ToFieldType::NativeType>; | 723 | 35 | MaxNativeType scale_multiplier = | 724 | 35 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 725 | 35 | typename ToFieldType::NativeType max_result = | 726 | 35 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 727 | 35 | typename ToFieldType::NativeType min_result = -max_result; | 728 | | | 729 | 35 | ColumnUInt8::MutablePtr col_null_map_to; | 730 | 35 | NullMap::value_type* null_map_data = nullptr; | 731 | 35 | if (narrow_integral) { | 732 | 35 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 733 | 35 | null_map_data = col_null_map_to->get_data().data(); | 734 | 35 | } | 735 | | | 736 | 35 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 737 | 35 | const auto& vec_from = col_from->get_data(); | 738 | 35 | const auto* vec_from_data = vec_from.data(); | 739 | 35 | auto& vec_to = col_to->get_data(); | 740 | 35 | auto* vec_to_data = vec_to.data(); | 741 | | | 742 | 35 | CastParameters params; | 743 | 35 | params.is_strict = (CastMode == CastModeType::StrictMode); | 744 | 35 | size_t size = vec_from.size(); | 745 | | | 746 | 35 | RETURN_IF_ERROR(std::visit( | 747 | 35 | [&](auto multiply_may_overflow, auto narrow_integral) { | 748 | 35 | for (size_t i = 0; i < size; i++) { | 749 | 35 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 750 | 35 | typename ToDataType::FieldType, | 751 | 35 | multiply_may_overflow, narrow_integral>( | 752 | 35 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 753 | 35 | scale_multiplier, min_result, max_result, params)) { | 754 | 35 | if (set_nullable) { | 755 | 35 | null_map_data[i] = 1; | 756 | 35 | } else { | 757 | 35 | return params.status; | 758 | 35 | } | 759 | 35 | } | 760 | 35 | } | 761 | 35 | return Status::OK(); | 762 | 35 | }, | 763 | 35 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 764 | | | 765 | 7 | if (narrow_integral) { | 766 | 7 | block.get_by_position(result).column = | 767 | 7 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 768 | 7 | } else { | 769 | 0 | block.get_by_position(result).column = std::move(col_to); | 770 | 0 | } | 771 | 7 | return Status::OK(); | 772 | 35 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE7EEENS_15DataTypeDecimalILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 686 | 14 | const NullMap::value_type* null_map = nullptr) const override { | 687 | 14 | using FromFieldType = typename FromDataType::FieldType; | 688 | 14 | using ToFieldType = typename ToDataType::FieldType; | 689 | 14 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 690 | 14 | const auto* col_from = | 691 | 14 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 692 | 14 | if (!col_from) { | 693 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 694 | 0 | named_from.column->get_name()); | 695 | 0 | } | 696 | | | 697 | 14 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 698 | 14 | constexpr UInt32 from_scale = 0; | 699 | | | 700 | 14 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 701 | 14 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 702 | 14 | UInt32 to_precision = to_decimal_type.get_precision(); | 703 | 14 | ToDataType::check_type_precision(to_precision); | 704 | 14 | UInt32 to_scale = to_decimal_type.get_scale(); | 705 | 14 | ToDataType::check_type_scale(to_scale); | 706 | | | 707 | 14 | auto from_max_int_digit_count = from_precision - from_scale; | 708 | 14 | auto to_max_int_digit_count = to_precision - to_scale; | 709 | | // may overflow. nullable result column. | 710 | 14 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 711 | | // only in non-strict mode and may overflow, we set nullable | 712 | 14 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 713 | | | 714 | 14 | constexpr UInt32 to_max_digits = | 715 | 14 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 716 | 14 | bool multiply_may_overflow = false; | 717 | 14 | if (to_scale > from_scale) { | 718 | 8 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 719 | 8 | } | 720 | 14 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 721 | 14 | sizeof(typename ToFieldType::NativeType)), | 722 | 14 | FromFieldType, typename ToFieldType::NativeType>; | 723 | 14 | MaxNativeType scale_multiplier = | 724 | 14 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 725 | 14 | typename ToFieldType::NativeType max_result = | 726 | 14 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 727 | 14 | typename ToFieldType::NativeType min_result = -max_result; | 728 | | | 729 | 14 | ColumnUInt8::MutablePtr col_null_map_to; | 730 | 14 | NullMap::value_type* null_map_data = nullptr; | 731 | 14 | if (narrow_integral) { | 732 | 14 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 733 | 14 | null_map_data = col_null_map_to->get_data().data(); | 734 | 14 | } | 735 | | | 736 | 14 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 737 | 14 | const auto& vec_from = col_from->get_data(); | 738 | 14 | const auto* vec_from_data = vec_from.data(); | 739 | 14 | auto& vec_to = col_to->get_data(); | 740 | 14 | auto* vec_to_data = vec_to.data(); | 741 | | | 742 | 14 | CastParameters params; | 743 | 14 | params.is_strict = (CastMode == CastModeType::StrictMode); | 744 | 14 | size_t size = vec_from.size(); | 745 | | | 746 | 14 | RETURN_IF_ERROR(std::visit( | 747 | 14 | [&](auto multiply_may_overflow, auto narrow_integral) { | 748 | 14 | for (size_t i = 0; i < size; i++) { | 749 | 14 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 750 | 14 | typename ToDataType::FieldType, | 751 | 14 | multiply_may_overflow, narrow_integral>( | 752 | 14 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 753 | 14 | scale_multiplier, min_result, max_result, params)) { | 754 | 14 | if (set_nullable) { | 755 | 14 | null_map_data[i] = 1; | 756 | 14 | } else { | 757 | 14 | return params.status; | 758 | 14 | } | 759 | 14 | } | 760 | 14 | } | 761 | 14 | return Status::OK(); | 762 | 14 | }, | 763 | 14 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 764 | | | 765 | 14 | if (narrow_integral) { | 766 | 14 | block.get_by_position(result).column = | 767 | 14 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 768 | 14 | } else { | 769 | 0 | block.get_by_position(result).column = std::move(col_to); | 770 | 0 | } | 771 | 14 | return Status::OK(); | 772 | 14 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE2EEENS_15DataTypeDecimalILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 686 | 2 | const NullMap::value_type* null_map = nullptr) const override { | 687 | 2 | using FromFieldType = typename FromDataType::FieldType; | 688 | 2 | using ToFieldType = typename ToDataType::FieldType; | 689 | 2 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 690 | 2 | const auto* col_from = | 691 | 2 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 692 | 2 | if (!col_from) { | 693 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 694 | 0 | named_from.column->get_name()); | 695 | 0 | } | 696 | | | 697 | 2 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 698 | 2 | constexpr UInt32 from_scale = 0; | 699 | | | 700 | 2 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 701 | 2 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 702 | 2 | UInt32 to_precision = to_decimal_type.get_precision(); | 703 | 2 | ToDataType::check_type_precision(to_precision); | 704 | 2 | UInt32 to_scale = to_decimal_type.get_scale(); | 705 | 2 | ToDataType::check_type_scale(to_scale); | 706 | | | 707 | 2 | auto from_max_int_digit_count = from_precision - from_scale; | 708 | 2 | auto to_max_int_digit_count = to_precision - to_scale; | 709 | | // may overflow. nullable result column. | 710 | 2 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 711 | | // only in non-strict mode and may overflow, we set nullable | 712 | 2 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 713 | | | 714 | 2 | constexpr UInt32 to_max_digits = | 715 | 2 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 716 | 2 | bool multiply_may_overflow = false; | 717 | 2 | if (to_scale > from_scale) { | 718 | 2 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 719 | 2 | } | 720 | 2 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 721 | 2 | sizeof(typename ToFieldType::NativeType)), | 722 | 2 | FromFieldType, typename ToFieldType::NativeType>; | 723 | 2 | MaxNativeType scale_multiplier = | 724 | 2 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 725 | 2 | typename ToFieldType::NativeType max_result = | 726 | 2 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 727 | 2 | typename ToFieldType::NativeType min_result = -max_result; | 728 | | | 729 | 2 | ColumnUInt8::MutablePtr col_null_map_to; | 730 | 2 | NullMap::value_type* null_map_data = nullptr; | 731 | 2 | if (narrow_integral) { | 732 | 2 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 733 | 2 | null_map_data = col_null_map_to->get_data().data(); | 734 | 2 | } | 735 | | | 736 | 2 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 737 | 2 | const auto& vec_from = col_from->get_data(); | 738 | 2 | const auto* vec_from_data = vec_from.data(); | 739 | 2 | auto& vec_to = col_to->get_data(); | 740 | 2 | auto* vec_to_data = vec_to.data(); | 741 | | | 742 | 2 | CastParameters params; | 743 | 2 | params.is_strict = (CastMode == CastModeType::StrictMode); | 744 | 2 | size_t size = vec_from.size(); | 745 | | | 746 | 2 | RETURN_IF_ERROR(std::visit( | 747 | 2 | [&](auto multiply_may_overflow, auto narrow_integral) { | 748 | 2 | for (size_t i = 0; i < size; i++) { | 749 | 2 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 750 | 2 | typename ToDataType::FieldType, | 751 | 2 | multiply_may_overflow, narrow_integral>( | 752 | 2 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 753 | 2 | scale_multiplier, min_result, max_result, params)) { | 754 | 2 | if (set_nullable) { | 755 | 2 | null_map_data[i] = 1; | 756 | 2 | } else { | 757 | 2 | return params.status; | 758 | 2 | } | 759 | 2 | } | 760 | 2 | } | 761 | 2 | return Status::OK(); | 762 | 2 | }, | 763 | 2 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 764 | | | 765 | 1 | if (narrow_integral) { | 766 | 1 | block.get_by_position(result).column = | 767 | 1 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 768 | 1 | } else { | 769 | 0 | block.get_by_position(result).column = std::move(col_to); | 770 | 0 | } | 771 | 1 | return Status::OK(); | 772 | 2 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE2EEENS_15DataTypeDecimalILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 686 | 5 | const NullMap::value_type* null_map = nullptr) const override { | 687 | 5 | using FromFieldType = typename FromDataType::FieldType; | 688 | 5 | using ToFieldType = typename ToDataType::FieldType; | 689 | 5 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 690 | 5 | const auto* col_from = | 691 | 5 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 692 | 5 | if (!col_from) { | 693 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 694 | 0 | named_from.column->get_name()); | 695 | 0 | } | 696 | | | 697 | 5 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 698 | 5 | constexpr UInt32 from_scale = 0; | 699 | | | 700 | 5 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 701 | 5 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 702 | 5 | UInt32 to_precision = to_decimal_type.get_precision(); | 703 | 5 | ToDataType::check_type_precision(to_precision); | 704 | 5 | UInt32 to_scale = to_decimal_type.get_scale(); | 705 | 5 | ToDataType::check_type_scale(to_scale); | 706 | | | 707 | 5 | auto from_max_int_digit_count = from_precision - from_scale; | 708 | 5 | auto to_max_int_digit_count = to_precision - to_scale; | 709 | | // may overflow. nullable result column. | 710 | 5 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 711 | | // only in non-strict mode and may overflow, we set nullable | 712 | 5 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 713 | | | 714 | 5 | constexpr UInt32 to_max_digits = | 715 | 5 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 716 | 5 | bool multiply_may_overflow = false; | 717 | 5 | if (to_scale > from_scale) { | 718 | 4 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 719 | 4 | } | 720 | 5 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 721 | 5 | sizeof(typename ToFieldType::NativeType)), | 722 | 5 | FromFieldType, typename ToFieldType::NativeType>; | 723 | 5 | MaxNativeType scale_multiplier = | 724 | 5 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 725 | 5 | typename ToFieldType::NativeType max_result = | 726 | 5 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 727 | 5 | typename ToFieldType::NativeType min_result = -max_result; | 728 | | | 729 | 5 | ColumnUInt8::MutablePtr col_null_map_to; | 730 | 5 | NullMap::value_type* null_map_data = nullptr; | 731 | 5 | if (narrow_integral) { | 732 | 1 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 733 | 1 | null_map_data = col_null_map_to->get_data().data(); | 734 | 1 | } | 735 | | | 736 | 5 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 737 | 5 | const auto& vec_from = col_from->get_data(); | 738 | 5 | const auto* vec_from_data = vec_from.data(); | 739 | 5 | auto& vec_to = col_to->get_data(); | 740 | 5 | auto* vec_to_data = vec_to.data(); | 741 | | | 742 | 5 | CastParameters params; | 743 | 5 | params.is_strict = (CastMode == CastModeType::StrictMode); | 744 | 5 | size_t size = vec_from.size(); | 745 | | | 746 | 5 | RETURN_IF_ERROR(std::visit( | 747 | 5 | [&](auto multiply_may_overflow, auto narrow_integral) { | 748 | 5 | for (size_t i = 0; i < size; i++) { | 749 | 5 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 750 | 5 | typename ToDataType::FieldType, | 751 | 5 | multiply_may_overflow, narrow_integral>( | 752 | 5 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 753 | 5 | scale_multiplier, min_result, max_result, params)) { | 754 | 5 | if (set_nullable) { | 755 | 5 | null_map_data[i] = 1; | 756 | 5 | } else { | 757 | 5 | return params.status; | 758 | 5 | } | 759 | 5 | } | 760 | 5 | } | 761 | 5 | return Status::OK(); | 762 | 5 | }, | 763 | 5 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 764 | | | 765 | 5 | if (narrow_integral) { | 766 | 1 | block.get_by_position(result).column = | 767 | 1 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 768 | 4 | } else { | 769 | 4 | block.get_by_position(result).column = std::move(col_to); | 770 | 4 | } | 771 | 5 | return Status::OK(); | 772 | 5 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE3EEENS_15DataTypeDecimalILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 686 | 19 | const NullMap::value_type* null_map = nullptr) const override { | 687 | 19 | using FromFieldType = typename FromDataType::FieldType; | 688 | 19 | using ToFieldType = typename ToDataType::FieldType; | 689 | 19 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 690 | 19 | const auto* col_from = | 691 | 19 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 692 | 19 | if (!col_from) { | 693 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 694 | 0 | named_from.column->get_name()); | 695 | 0 | } | 696 | | | 697 | 19 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 698 | 19 | constexpr UInt32 from_scale = 0; | 699 | | | 700 | 19 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 701 | 19 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 702 | 19 | UInt32 to_precision = to_decimal_type.get_precision(); | 703 | 19 | ToDataType::check_type_precision(to_precision); | 704 | 19 | UInt32 to_scale = to_decimal_type.get_scale(); | 705 | 19 | ToDataType::check_type_scale(to_scale); | 706 | | | 707 | 19 | auto from_max_int_digit_count = from_precision - from_scale; | 708 | 19 | auto to_max_int_digit_count = to_precision - to_scale; | 709 | | // may overflow. nullable result column. | 710 | 19 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 711 | | // only in non-strict mode and may overflow, we set nullable | 712 | 19 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 713 | | | 714 | 19 | constexpr UInt32 to_max_digits = | 715 | 19 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 716 | 19 | bool multiply_may_overflow = false; | 717 | 19 | if (to_scale > from_scale) { | 718 | 12 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 719 | 12 | } | 720 | 19 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 721 | 19 | sizeof(typename ToFieldType::NativeType)), | 722 | 19 | FromFieldType, typename ToFieldType::NativeType>; | 723 | 19 | MaxNativeType scale_multiplier = | 724 | 19 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 725 | 19 | typename ToFieldType::NativeType max_result = | 726 | 19 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 727 | 19 | typename ToFieldType::NativeType min_result = -max_result; | 728 | | | 729 | 19 | ColumnUInt8::MutablePtr col_null_map_to; | 730 | 19 | NullMap::value_type* null_map_data = nullptr; | 731 | 19 | if (narrow_integral) { | 732 | 15 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 733 | 15 | null_map_data = col_null_map_to->get_data().data(); | 734 | 15 | } | 735 | | | 736 | 19 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 737 | 19 | const auto& vec_from = col_from->get_data(); | 738 | 19 | const auto* vec_from_data = vec_from.data(); | 739 | 19 | auto& vec_to = col_to->get_data(); | 740 | 19 | auto* vec_to_data = vec_to.data(); | 741 | | | 742 | 19 | CastParameters params; | 743 | 19 | params.is_strict = (CastMode == CastModeType::StrictMode); | 744 | 19 | size_t size = vec_from.size(); | 745 | | | 746 | 19 | RETURN_IF_ERROR(std::visit( | 747 | 19 | [&](auto multiply_may_overflow, auto narrow_integral) { | 748 | 19 | for (size_t i = 0; i < size; i++) { | 749 | 19 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 750 | 19 | typename ToDataType::FieldType, | 751 | 19 | multiply_may_overflow, narrow_integral>( | 752 | 19 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 753 | 19 | scale_multiplier, min_result, max_result, params)) { | 754 | 19 | if (set_nullable) { | 755 | 19 | null_map_data[i] = 1; | 756 | 19 | } else { | 757 | 19 | return params.status; | 758 | 19 | } | 759 | 19 | } | 760 | 19 | } | 761 | 19 | return Status::OK(); | 762 | 19 | }, | 763 | 19 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 764 | | | 765 | 7 | if (narrow_integral) { | 766 | 3 | block.get_by_position(result).column = | 767 | 3 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 768 | 4 | } else { | 769 | 4 | block.get_by_position(result).column = std::move(col_to); | 770 | 4 | } | 771 | 7 | return Status::OK(); | 772 | 19 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE3EEENS_15DataTypeDecimalILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 686 | 10 | const NullMap::value_type* null_map = nullptr) const override { | 687 | 10 | using FromFieldType = typename FromDataType::FieldType; | 688 | 10 | using ToFieldType = typename ToDataType::FieldType; | 689 | 10 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 690 | 10 | const auto* col_from = | 691 | 10 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 692 | 10 | if (!col_from) { | 693 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 694 | 0 | named_from.column->get_name()); | 695 | 0 | } | 696 | | | 697 | 10 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 698 | 10 | constexpr UInt32 from_scale = 0; | 699 | | | 700 | 10 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 701 | 10 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 702 | 10 | UInt32 to_precision = to_decimal_type.get_precision(); | 703 | 10 | ToDataType::check_type_precision(to_precision); | 704 | 10 | UInt32 to_scale = to_decimal_type.get_scale(); | 705 | 10 | ToDataType::check_type_scale(to_scale); | 706 | | | 707 | 10 | auto from_max_int_digit_count = from_precision - from_scale; | 708 | 10 | auto to_max_int_digit_count = to_precision - to_scale; | 709 | | // may overflow. nullable result column. | 710 | 10 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 711 | | // only in non-strict mode and may overflow, we set nullable | 712 | 10 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 713 | | | 714 | 10 | constexpr UInt32 to_max_digits = | 715 | 10 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 716 | 10 | bool multiply_may_overflow = false; | 717 | 10 | if (to_scale > from_scale) { | 718 | 6 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 719 | 6 | } | 720 | 10 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 721 | 10 | sizeof(typename ToFieldType::NativeType)), | 722 | 10 | FromFieldType, typename ToFieldType::NativeType>; | 723 | 10 | MaxNativeType scale_multiplier = | 724 | 10 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 725 | 10 | typename ToFieldType::NativeType max_result = | 726 | 10 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 727 | 10 | typename ToFieldType::NativeType min_result = -max_result; | 728 | | | 729 | 10 | ColumnUInt8::MutablePtr col_null_map_to; | 730 | 10 | NullMap::value_type* null_map_data = nullptr; | 731 | 10 | if (narrow_integral) { | 732 | 6 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 733 | 6 | null_map_data = col_null_map_to->get_data().data(); | 734 | 6 | } | 735 | | | 736 | 10 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 737 | 10 | const auto& vec_from = col_from->get_data(); | 738 | 10 | const auto* vec_from_data = vec_from.data(); | 739 | 10 | auto& vec_to = col_to->get_data(); | 740 | 10 | auto* vec_to_data = vec_to.data(); | 741 | | | 742 | 10 | CastParameters params; | 743 | 10 | params.is_strict = (CastMode == CastModeType::StrictMode); | 744 | 10 | size_t size = vec_from.size(); | 745 | | | 746 | 10 | RETURN_IF_ERROR(std::visit( | 747 | 10 | [&](auto multiply_may_overflow, auto narrow_integral) { | 748 | 10 | for (size_t i = 0; i < size; i++) { | 749 | 10 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 750 | 10 | typename ToDataType::FieldType, | 751 | 10 | multiply_may_overflow, narrow_integral>( | 752 | 10 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 753 | 10 | scale_multiplier, min_result, max_result, params)) { | 754 | 10 | if (set_nullable) { | 755 | 10 | null_map_data[i] = 1; | 756 | 10 | } else { | 757 | 10 | return params.status; | 758 | 10 | } | 759 | 10 | } | 760 | 10 | } | 761 | 10 | return Status::OK(); | 762 | 10 | }, | 763 | 10 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 764 | | | 765 | 10 | if (narrow_integral) { | 766 | 6 | block.get_by_position(result).column = | 767 | 6 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 768 | 6 | } else { | 769 | 4 | block.get_by_position(result).column = std::move(col_to); | 770 | 4 | } | 771 | 10 | return Status::OK(); | 772 | 10 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE4EEENS_15DataTypeDecimalILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 686 | 19 | const NullMap::value_type* null_map = nullptr) const override { | 687 | 19 | using FromFieldType = typename FromDataType::FieldType; | 688 | 19 | using ToFieldType = typename ToDataType::FieldType; | 689 | 19 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 690 | 19 | const auto* col_from = | 691 | 19 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 692 | 19 | if (!col_from) { | 693 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 694 | 0 | named_from.column->get_name()); | 695 | 0 | } | 696 | | | 697 | 19 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 698 | 19 | constexpr UInt32 from_scale = 0; | 699 | | | 700 | 19 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 701 | 19 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 702 | 19 | UInt32 to_precision = to_decimal_type.get_precision(); | 703 | 19 | ToDataType::check_type_precision(to_precision); | 704 | 19 | UInt32 to_scale = to_decimal_type.get_scale(); | 705 | 19 | ToDataType::check_type_scale(to_scale); | 706 | | | 707 | 19 | auto from_max_int_digit_count = from_precision - from_scale; | 708 | 19 | auto to_max_int_digit_count = to_precision - to_scale; | 709 | | // may overflow. nullable result column. | 710 | 19 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 711 | | // only in non-strict mode and may overflow, we set nullable | 712 | 19 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 713 | | | 714 | 19 | constexpr UInt32 to_max_digits = | 715 | 19 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 716 | 19 | bool multiply_may_overflow = false; | 717 | 19 | if (to_scale > from_scale) { | 718 | 12 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 719 | 12 | } | 720 | 19 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 721 | 19 | sizeof(typename ToFieldType::NativeType)), | 722 | 19 | FromFieldType, typename ToFieldType::NativeType>; | 723 | 19 | MaxNativeType scale_multiplier = | 724 | 19 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 725 | 19 | typename ToFieldType::NativeType max_result = | 726 | 19 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 727 | 19 | typename ToFieldType::NativeType min_result = -max_result; | 728 | | | 729 | 19 | ColumnUInt8::MutablePtr col_null_map_to; | 730 | 19 | NullMap::value_type* null_map_data = nullptr; | 731 | 19 | if (narrow_integral) { | 732 | 15 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 733 | 15 | null_map_data = col_null_map_to->get_data().data(); | 734 | 15 | } | 735 | | | 736 | 19 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 737 | 19 | const auto& vec_from = col_from->get_data(); | 738 | 19 | const auto* vec_from_data = vec_from.data(); | 739 | 19 | auto& vec_to = col_to->get_data(); | 740 | 19 | auto* vec_to_data = vec_to.data(); | 741 | | | 742 | 19 | CastParameters params; | 743 | 19 | params.is_strict = (CastMode == CastModeType::StrictMode); | 744 | 19 | size_t size = vec_from.size(); | 745 | | | 746 | 19 | RETURN_IF_ERROR(std::visit( | 747 | 19 | [&](auto multiply_may_overflow, auto narrow_integral) { | 748 | 19 | for (size_t i = 0; i < size; i++) { | 749 | 19 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 750 | 19 | typename ToDataType::FieldType, | 751 | 19 | multiply_may_overflow, narrow_integral>( | 752 | 19 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 753 | 19 | scale_multiplier, min_result, max_result, params)) { | 754 | 19 | if (set_nullable) { | 755 | 19 | null_map_data[i] = 1; | 756 | 19 | } else { | 757 | 19 | return params.status; | 758 | 19 | } | 759 | 19 | } | 760 | 19 | } | 761 | 19 | return Status::OK(); | 762 | 19 | }, | 763 | 19 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 764 | | | 765 | 7 | if (narrow_integral) { | 766 | 3 | block.get_by_position(result).column = | 767 | 3 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 768 | 4 | } else { | 769 | 4 | block.get_by_position(result).column = std::move(col_to); | 770 | 4 | } | 771 | 7 | return Status::OK(); | 772 | 19 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE4EEENS_15DataTypeDecimalILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 686 | 10 | const NullMap::value_type* null_map = nullptr) const override { | 687 | 10 | using FromFieldType = typename FromDataType::FieldType; | 688 | 10 | using ToFieldType = typename ToDataType::FieldType; | 689 | 10 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 690 | 10 | const auto* col_from = | 691 | 10 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 692 | 10 | if (!col_from) { | 693 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 694 | 0 | named_from.column->get_name()); | 695 | 0 | } | 696 | | | 697 | 10 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 698 | 10 | constexpr UInt32 from_scale = 0; | 699 | | | 700 | 10 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 701 | 10 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 702 | 10 | UInt32 to_precision = to_decimal_type.get_precision(); | 703 | 10 | ToDataType::check_type_precision(to_precision); | 704 | 10 | UInt32 to_scale = to_decimal_type.get_scale(); | 705 | 10 | ToDataType::check_type_scale(to_scale); | 706 | | | 707 | 10 | auto from_max_int_digit_count = from_precision - from_scale; | 708 | 10 | auto to_max_int_digit_count = to_precision - to_scale; | 709 | | // may overflow. nullable result column. | 710 | 10 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 711 | | // only in non-strict mode and may overflow, we set nullable | 712 | 10 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 713 | | | 714 | 10 | constexpr UInt32 to_max_digits = | 715 | 10 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 716 | 10 | bool multiply_may_overflow = false; | 717 | 10 | if (to_scale > from_scale) { | 718 | 6 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 719 | 6 | } | 720 | 10 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 721 | 10 | sizeof(typename ToFieldType::NativeType)), | 722 | 10 | FromFieldType, typename ToFieldType::NativeType>; | 723 | 10 | MaxNativeType scale_multiplier = | 724 | 10 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 725 | 10 | typename ToFieldType::NativeType max_result = | 726 | 10 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 727 | 10 | typename ToFieldType::NativeType min_result = -max_result; | 728 | | | 729 | 10 | ColumnUInt8::MutablePtr col_null_map_to; | 730 | 10 | NullMap::value_type* null_map_data = nullptr; | 731 | 10 | if (narrow_integral) { | 732 | 6 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 733 | 6 | null_map_data = col_null_map_to->get_data().data(); | 734 | 6 | } | 735 | | | 736 | 10 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 737 | 10 | const auto& vec_from = col_from->get_data(); | 738 | 10 | const auto* vec_from_data = vec_from.data(); | 739 | 10 | auto& vec_to = col_to->get_data(); | 740 | 10 | auto* vec_to_data = vec_to.data(); | 741 | | | 742 | 10 | CastParameters params; | 743 | 10 | params.is_strict = (CastMode == CastModeType::StrictMode); | 744 | 10 | size_t size = vec_from.size(); | 745 | | | 746 | 10 | RETURN_IF_ERROR(std::visit( | 747 | 10 | [&](auto multiply_may_overflow, auto narrow_integral) { | 748 | 10 | for (size_t i = 0; i < size; i++) { | 749 | 10 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 750 | 10 | typename ToDataType::FieldType, | 751 | 10 | multiply_may_overflow, narrow_integral>( | 752 | 10 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 753 | 10 | scale_multiplier, min_result, max_result, params)) { | 754 | 10 | if (set_nullable) { | 755 | 10 | null_map_data[i] = 1; | 756 | 10 | } else { | 757 | 10 | return params.status; | 758 | 10 | } | 759 | 10 | } | 760 | 10 | } | 761 | 10 | return Status::OK(); | 762 | 10 | }, | 763 | 10 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 764 | | | 765 | 10 | if (narrow_integral) { | 766 | 6 | block.get_by_position(result).column = | 767 | 6 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 768 | 6 | } else { | 769 | 4 | block.get_by_position(result).column = std::move(col_to); | 770 | 4 | } | 771 | 10 | return Status::OK(); | 772 | 10 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE5EEENS_15DataTypeDecimalILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 686 | 19 | const NullMap::value_type* null_map = nullptr) const override { | 687 | 19 | using FromFieldType = typename FromDataType::FieldType; | 688 | 19 | using ToFieldType = typename ToDataType::FieldType; | 689 | 19 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 690 | 19 | const auto* col_from = | 691 | 19 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 692 | 19 | if (!col_from) { | 693 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 694 | 0 | named_from.column->get_name()); | 695 | 0 | } | 696 | | | 697 | 19 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 698 | 19 | constexpr UInt32 from_scale = 0; | 699 | | | 700 | 19 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 701 | 19 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 702 | 19 | UInt32 to_precision = to_decimal_type.get_precision(); | 703 | 19 | ToDataType::check_type_precision(to_precision); | 704 | 19 | UInt32 to_scale = to_decimal_type.get_scale(); | 705 | 19 | ToDataType::check_type_scale(to_scale); | 706 | | | 707 | 19 | auto from_max_int_digit_count = from_precision - from_scale; | 708 | 19 | auto to_max_int_digit_count = to_precision - to_scale; | 709 | | // may overflow. nullable result column. | 710 | 19 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 711 | | // only in non-strict mode and may overflow, we set nullable | 712 | 19 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 713 | | | 714 | 19 | constexpr UInt32 to_max_digits = | 715 | 19 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 716 | 19 | bool multiply_may_overflow = false; | 717 | 19 | if (to_scale > from_scale) { | 718 | 12 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 719 | 12 | } | 720 | 19 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 721 | 19 | sizeof(typename ToFieldType::NativeType)), | 722 | 19 | FromFieldType, typename ToFieldType::NativeType>; | 723 | 19 | MaxNativeType scale_multiplier = | 724 | 19 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 725 | 19 | typename ToFieldType::NativeType max_result = | 726 | 19 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 727 | 19 | typename ToFieldType::NativeType min_result = -max_result; | 728 | | | 729 | 19 | ColumnUInt8::MutablePtr col_null_map_to; | 730 | 19 | NullMap::value_type* null_map_data = nullptr; | 731 | 19 | if (narrow_integral) { | 732 | 15 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 733 | 15 | null_map_data = col_null_map_to->get_data().data(); | 734 | 15 | } | 735 | | | 736 | 19 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 737 | 19 | const auto& vec_from = col_from->get_data(); | 738 | 19 | const auto* vec_from_data = vec_from.data(); | 739 | 19 | auto& vec_to = col_to->get_data(); | 740 | 19 | auto* vec_to_data = vec_to.data(); | 741 | | | 742 | 19 | CastParameters params; | 743 | 19 | params.is_strict = (CastMode == CastModeType::StrictMode); | 744 | 19 | size_t size = vec_from.size(); | 745 | | | 746 | 19 | RETURN_IF_ERROR(std::visit( | 747 | 19 | [&](auto multiply_may_overflow, auto narrow_integral) { | 748 | 19 | for (size_t i = 0; i < size; i++) { | 749 | 19 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 750 | 19 | typename ToDataType::FieldType, | 751 | 19 | multiply_may_overflow, narrow_integral>( | 752 | 19 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 753 | 19 | scale_multiplier, min_result, max_result, params)) { | 754 | 19 | if (set_nullable) { | 755 | 19 | null_map_data[i] = 1; | 756 | 19 | } else { | 757 | 19 | return params.status; | 758 | 19 | } | 759 | 19 | } | 760 | 19 | } | 761 | 19 | return Status::OK(); | 762 | 19 | }, | 763 | 19 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 764 | | | 765 | 7 | if (narrow_integral) { | 766 | 3 | block.get_by_position(result).column = | 767 | 3 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 768 | 4 | } else { | 769 | 4 | block.get_by_position(result).column = std::move(col_to); | 770 | 4 | } | 771 | 7 | return Status::OK(); | 772 | 19 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE5EEENS_15DataTypeDecimalILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 686 | 10 | const NullMap::value_type* null_map = nullptr) const override { | 687 | 10 | using FromFieldType = typename FromDataType::FieldType; | 688 | 10 | using ToFieldType = typename ToDataType::FieldType; | 689 | 10 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 690 | 10 | const auto* col_from = | 691 | 10 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 692 | 10 | if (!col_from) { | 693 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 694 | 0 | named_from.column->get_name()); | 695 | 0 | } | 696 | | | 697 | 10 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 698 | 10 | constexpr UInt32 from_scale = 0; | 699 | | | 700 | 10 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 701 | 10 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 702 | 10 | UInt32 to_precision = to_decimal_type.get_precision(); | 703 | 10 | ToDataType::check_type_precision(to_precision); | 704 | 10 | UInt32 to_scale = to_decimal_type.get_scale(); | 705 | 10 | ToDataType::check_type_scale(to_scale); | 706 | | | 707 | 10 | auto from_max_int_digit_count = from_precision - from_scale; | 708 | 10 | auto to_max_int_digit_count = to_precision - to_scale; | 709 | | // may overflow. nullable result column. | 710 | 10 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 711 | | // only in non-strict mode and may overflow, we set nullable | 712 | 10 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 713 | | | 714 | 10 | constexpr UInt32 to_max_digits = | 715 | 10 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 716 | 10 | bool multiply_may_overflow = false; | 717 | 10 | if (to_scale > from_scale) { | 718 | 6 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 719 | 6 | } | 720 | 10 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 721 | 10 | sizeof(typename ToFieldType::NativeType)), | 722 | 10 | FromFieldType, typename ToFieldType::NativeType>; | 723 | 10 | MaxNativeType scale_multiplier = | 724 | 10 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 725 | 10 | typename ToFieldType::NativeType max_result = | 726 | 10 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 727 | 10 | typename ToFieldType::NativeType min_result = -max_result; | 728 | | | 729 | 10 | ColumnUInt8::MutablePtr col_null_map_to; | 730 | 10 | NullMap::value_type* null_map_data = nullptr; | 731 | 10 | if (narrow_integral) { | 732 | 6 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 733 | 6 | null_map_data = col_null_map_to->get_data().data(); | 734 | 6 | } | 735 | | | 736 | 10 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 737 | 10 | const auto& vec_from = col_from->get_data(); | 738 | 10 | const auto* vec_from_data = vec_from.data(); | 739 | 10 | auto& vec_to = col_to->get_data(); | 740 | 10 | auto* vec_to_data = vec_to.data(); | 741 | | | 742 | 10 | CastParameters params; | 743 | 10 | params.is_strict = (CastMode == CastModeType::StrictMode); | 744 | 10 | size_t size = vec_from.size(); | 745 | | | 746 | 10 | RETURN_IF_ERROR(std::visit( | 747 | 10 | [&](auto multiply_may_overflow, auto narrow_integral) { | 748 | 10 | for (size_t i = 0; i < size; i++) { | 749 | 10 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 750 | 10 | typename ToDataType::FieldType, | 751 | 10 | multiply_may_overflow, narrow_integral>( | 752 | 10 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 753 | 10 | scale_multiplier, min_result, max_result, params)) { | 754 | 10 | if (set_nullable) { | 755 | 10 | null_map_data[i] = 1; | 756 | 10 | } else { | 757 | 10 | return params.status; | 758 | 10 | } | 759 | 10 | } | 760 | 10 | } | 761 | 10 | return Status::OK(); | 762 | 10 | }, | 763 | 10 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 764 | | | 765 | 10 | if (narrow_integral) { | 766 | 6 | block.get_by_position(result).column = | 767 | 6 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 768 | 6 | } else { | 769 | 4 | block.get_by_position(result).column = std::move(col_to); | 770 | 4 | } | 771 | 10 | return Status::OK(); | 772 | 10 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE6EEENS_15DataTypeDecimalILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 686 | 19 | const NullMap::value_type* null_map = nullptr) const override { | 687 | 19 | using FromFieldType = typename FromDataType::FieldType; | 688 | 19 | using ToFieldType = typename ToDataType::FieldType; | 689 | 19 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 690 | 19 | const auto* col_from = | 691 | 19 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 692 | 19 | if (!col_from) { | 693 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 694 | 0 | named_from.column->get_name()); | 695 | 0 | } | 696 | | | 697 | 19 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 698 | 19 | constexpr UInt32 from_scale = 0; | 699 | | | 700 | 19 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 701 | 19 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 702 | 19 | UInt32 to_precision = to_decimal_type.get_precision(); | 703 | 19 | ToDataType::check_type_precision(to_precision); | 704 | 19 | UInt32 to_scale = to_decimal_type.get_scale(); | 705 | 19 | ToDataType::check_type_scale(to_scale); | 706 | | | 707 | 19 | auto from_max_int_digit_count = from_precision - from_scale; | 708 | 19 | auto to_max_int_digit_count = to_precision - to_scale; | 709 | | // may overflow. nullable result column. | 710 | 19 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 711 | | // only in non-strict mode and may overflow, we set nullable | 712 | 19 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 713 | | | 714 | 19 | constexpr UInt32 to_max_digits = | 715 | 19 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 716 | 19 | bool multiply_may_overflow = false; | 717 | 19 | if (to_scale > from_scale) { | 718 | 12 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 719 | 12 | } | 720 | 19 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 721 | 19 | sizeof(typename ToFieldType::NativeType)), | 722 | 19 | FromFieldType, typename ToFieldType::NativeType>; | 723 | 19 | MaxNativeType scale_multiplier = | 724 | 19 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 725 | 19 | typename ToFieldType::NativeType max_result = | 726 | 19 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 727 | 19 | typename ToFieldType::NativeType min_result = -max_result; | 728 | | | 729 | 19 | ColumnUInt8::MutablePtr col_null_map_to; | 730 | 19 | NullMap::value_type* null_map_data = nullptr; | 731 | 19 | if (narrow_integral) { | 732 | 15 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 733 | 15 | null_map_data = col_null_map_to->get_data().data(); | 734 | 15 | } | 735 | | | 736 | 19 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 737 | 19 | const auto& vec_from = col_from->get_data(); | 738 | 19 | const auto* vec_from_data = vec_from.data(); | 739 | 19 | auto& vec_to = col_to->get_data(); | 740 | 19 | auto* vec_to_data = vec_to.data(); | 741 | | | 742 | 19 | CastParameters params; | 743 | 19 | params.is_strict = (CastMode == CastModeType::StrictMode); | 744 | 19 | size_t size = vec_from.size(); | 745 | | | 746 | 19 | RETURN_IF_ERROR(std::visit( | 747 | 19 | [&](auto multiply_may_overflow, auto narrow_integral) { | 748 | 19 | for (size_t i = 0; i < size; i++) { | 749 | 19 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 750 | 19 | typename ToDataType::FieldType, | 751 | 19 | multiply_may_overflow, narrow_integral>( | 752 | 19 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 753 | 19 | scale_multiplier, min_result, max_result, params)) { | 754 | 19 | if (set_nullable) { | 755 | 19 | null_map_data[i] = 1; | 756 | 19 | } else { | 757 | 19 | return params.status; | 758 | 19 | } | 759 | 19 | } | 760 | 19 | } | 761 | 19 | return Status::OK(); | 762 | 19 | }, | 763 | 19 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 764 | | | 765 | 7 | if (narrow_integral) { | 766 | 3 | block.get_by_position(result).column = | 767 | 3 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 768 | 4 | } else { | 769 | 4 | block.get_by_position(result).column = std::move(col_to); | 770 | 4 | } | 771 | 7 | return Status::OK(); | 772 | 19 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE6EEENS_15DataTypeDecimalILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 686 | 10 | const NullMap::value_type* null_map = nullptr) const override { | 687 | 10 | using FromFieldType = typename FromDataType::FieldType; | 688 | 10 | using ToFieldType = typename ToDataType::FieldType; | 689 | 10 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 690 | 10 | const auto* col_from = | 691 | 10 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 692 | 10 | if (!col_from) { | 693 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 694 | 0 | named_from.column->get_name()); | 695 | 0 | } | 696 | | | 697 | 10 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 698 | 10 | constexpr UInt32 from_scale = 0; | 699 | | | 700 | 10 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 701 | 10 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 702 | 10 | UInt32 to_precision = to_decimal_type.get_precision(); | 703 | 10 | ToDataType::check_type_precision(to_precision); | 704 | 10 | UInt32 to_scale = to_decimal_type.get_scale(); | 705 | 10 | ToDataType::check_type_scale(to_scale); | 706 | | | 707 | 10 | auto from_max_int_digit_count = from_precision - from_scale; | 708 | 10 | auto to_max_int_digit_count = to_precision - to_scale; | 709 | | // may overflow. nullable result column. | 710 | 10 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 711 | | // only in non-strict mode and may overflow, we set nullable | 712 | 10 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 713 | | | 714 | 10 | constexpr UInt32 to_max_digits = | 715 | 10 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 716 | 10 | bool multiply_may_overflow = false; | 717 | 10 | if (to_scale > from_scale) { | 718 | 6 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 719 | 6 | } | 720 | 10 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 721 | 10 | sizeof(typename ToFieldType::NativeType)), | 722 | 10 | FromFieldType, typename ToFieldType::NativeType>; | 723 | 10 | MaxNativeType scale_multiplier = | 724 | 10 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 725 | 10 | typename ToFieldType::NativeType max_result = | 726 | 10 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 727 | 10 | typename ToFieldType::NativeType min_result = -max_result; | 728 | | | 729 | 10 | ColumnUInt8::MutablePtr col_null_map_to; | 730 | 10 | NullMap::value_type* null_map_data = nullptr; | 731 | 10 | if (narrow_integral) { | 732 | 6 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 733 | 6 | null_map_data = col_null_map_to->get_data().data(); | 734 | 6 | } | 735 | | | 736 | 10 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 737 | 10 | const auto& vec_from = col_from->get_data(); | 738 | 10 | const auto* vec_from_data = vec_from.data(); | 739 | 10 | auto& vec_to = col_to->get_data(); | 740 | 10 | auto* vec_to_data = vec_to.data(); | 741 | | | 742 | 10 | CastParameters params; | 743 | 10 | params.is_strict = (CastMode == CastModeType::StrictMode); | 744 | 10 | size_t size = vec_from.size(); | 745 | | | 746 | 10 | RETURN_IF_ERROR(std::visit( | 747 | 10 | [&](auto multiply_may_overflow, auto narrow_integral) { | 748 | 10 | for (size_t i = 0; i < size; i++) { | 749 | 10 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 750 | 10 | typename ToDataType::FieldType, | 751 | 10 | multiply_may_overflow, narrow_integral>( | 752 | 10 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 753 | 10 | scale_multiplier, min_result, max_result, params)) { | 754 | 10 | if (set_nullable) { | 755 | 10 | null_map_data[i] = 1; | 756 | 10 | } else { | 757 | 10 | return params.status; | 758 | 10 | } | 759 | 10 | } | 760 | 10 | } | 761 | 10 | return Status::OK(); | 762 | 10 | }, | 763 | 10 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 764 | | | 765 | 10 | if (narrow_integral) { | 766 | 6 | block.get_by_position(result).column = | 767 | 6 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 768 | 6 | } else { | 769 | 4 | block.get_by_position(result).column = std::move(col_to); | 770 | 4 | } | 771 | 10 | return Status::OK(); | 772 | 10 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE7EEENS_15DataTypeDecimalILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 686 | 31 | const NullMap::value_type* null_map = nullptr) const override { | 687 | 31 | using FromFieldType = typename FromDataType::FieldType; | 688 | 31 | using ToFieldType = typename ToDataType::FieldType; | 689 | 31 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 690 | 31 | const auto* col_from = | 691 | 31 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 692 | 31 | if (!col_from) { | 693 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 694 | 0 | named_from.column->get_name()); | 695 | 0 | } | 696 | | | 697 | 31 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 698 | 31 | constexpr UInt32 from_scale = 0; | 699 | | | 700 | 31 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 701 | 31 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 702 | 31 | UInt32 to_precision = to_decimal_type.get_precision(); | 703 | 31 | ToDataType::check_type_precision(to_precision); | 704 | 31 | UInt32 to_scale = to_decimal_type.get_scale(); | 705 | 31 | ToDataType::check_type_scale(to_scale); | 706 | | | 707 | 31 | auto from_max_int_digit_count = from_precision - from_scale; | 708 | 31 | auto to_max_int_digit_count = to_precision - to_scale; | 709 | | // may overflow. nullable result column. | 710 | 31 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 711 | | // only in non-strict mode and may overflow, we set nullable | 712 | 31 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 713 | | | 714 | 31 | constexpr UInt32 to_max_digits = | 715 | 31 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 716 | 31 | bool multiply_may_overflow = false; | 717 | 31 | if (to_scale > from_scale) { | 718 | 20 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 719 | 20 | } | 720 | 31 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 721 | 31 | sizeof(typename ToFieldType::NativeType)), | 722 | 31 | FromFieldType, typename ToFieldType::NativeType>; | 723 | 31 | MaxNativeType scale_multiplier = | 724 | 31 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 725 | 31 | typename ToFieldType::NativeType max_result = | 726 | 31 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 727 | 31 | typename ToFieldType::NativeType min_result = -max_result; | 728 | | | 729 | 31 | ColumnUInt8::MutablePtr col_null_map_to; | 730 | 31 | NullMap::value_type* null_map_data = nullptr; | 731 | 31 | if (narrow_integral) { | 732 | 30 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 733 | 30 | null_map_data = col_null_map_to->get_data().data(); | 734 | 30 | } | 735 | | | 736 | 31 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 737 | 31 | const auto& vec_from = col_from->get_data(); | 738 | 31 | const auto* vec_from_data = vec_from.data(); | 739 | 31 | auto& vec_to = col_to->get_data(); | 740 | 31 | auto* vec_to_data = vec_to.data(); | 741 | | | 742 | 31 | CastParameters params; | 743 | 31 | params.is_strict = (CastMode == CastModeType::StrictMode); | 744 | 31 | size_t size = vec_from.size(); | 745 | | | 746 | 31 | RETURN_IF_ERROR(std::visit( | 747 | 31 | [&](auto multiply_may_overflow, auto narrow_integral) { | 748 | 31 | for (size_t i = 0; i < size; i++) { | 749 | 31 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 750 | 31 | typename ToDataType::FieldType, | 751 | 31 | multiply_may_overflow, narrow_integral>( | 752 | 31 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 753 | 31 | scale_multiplier, min_result, max_result, params)) { | 754 | 31 | if (set_nullable) { | 755 | 31 | null_map_data[i] = 1; | 756 | 31 | } else { | 757 | 31 | return params.status; | 758 | 31 | } | 759 | 31 | } | 760 | 31 | } | 761 | 31 | return Status::OK(); | 762 | 31 | }, | 763 | 31 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 764 | | | 765 | 7 | if (narrow_integral) { | 766 | 6 | block.get_by_position(result).column = | 767 | 6 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 768 | 6 | } else { | 769 | 1 | block.get_by_position(result).column = std::move(col_to); | 770 | 1 | } | 771 | 7 | return Status::OK(); | 772 | 31 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE7EEENS_15DataTypeDecimalILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 686 | 13 | const NullMap::value_type* null_map = nullptr) const override { | 687 | 13 | using FromFieldType = typename FromDataType::FieldType; | 688 | 13 | using ToFieldType = typename ToDataType::FieldType; | 689 | 13 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 690 | 13 | const auto* col_from = | 691 | 13 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 692 | 13 | if (!col_from) { | 693 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 694 | 0 | named_from.column->get_name()); | 695 | 0 | } | 696 | | | 697 | 13 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 698 | 13 | constexpr UInt32 from_scale = 0; | 699 | | | 700 | 13 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 701 | 13 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 702 | 13 | UInt32 to_precision = to_decimal_type.get_precision(); | 703 | 13 | ToDataType::check_type_precision(to_precision); | 704 | 13 | UInt32 to_scale = to_decimal_type.get_scale(); | 705 | 13 | ToDataType::check_type_scale(to_scale); | 706 | | | 707 | 13 | auto from_max_int_digit_count = from_precision - from_scale; | 708 | 13 | auto to_max_int_digit_count = to_precision - to_scale; | 709 | | // may overflow. nullable result column. | 710 | 13 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count); | 711 | | // only in non-strict mode and may overflow, we set nullable | 712 | 13 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 713 | | | 714 | 13 | constexpr UInt32 to_max_digits = | 715 | 13 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 716 | 13 | bool multiply_may_overflow = false; | 717 | 13 | if (to_scale > from_scale) { | 718 | 8 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 719 | 8 | } | 720 | 13 | using MaxNativeType = std::conditional_t<(sizeof(FromFieldType) > | 721 | 13 | sizeof(typename ToFieldType::NativeType)), | 722 | 13 | FromFieldType, typename ToFieldType::NativeType>; | 723 | 13 | MaxNativeType scale_multiplier = | 724 | 13 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 725 | 13 | typename ToFieldType::NativeType max_result = | 726 | 13 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 727 | 13 | typename ToFieldType::NativeType min_result = -max_result; | 728 | | | 729 | 13 | ColumnUInt8::MutablePtr col_null_map_to; | 730 | 13 | NullMap::value_type* null_map_data = nullptr; | 731 | 13 | if (narrow_integral) { | 732 | 12 | col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 733 | 12 | null_map_data = col_null_map_to->get_data().data(); | 734 | 12 | } | 735 | | | 736 | 13 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 737 | 13 | const auto& vec_from = col_from->get_data(); | 738 | 13 | const auto* vec_from_data = vec_from.data(); | 739 | 13 | auto& vec_to = col_to->get_data(); | 740 | 13 | auto* vec_to_data = vec_to.data(); | 741 | | | 742 | 13 | CastParameters params; | 743 | 13 | params.is_strict = (CastMode == CastModeType::StrictMode); | 744 | 13 | size_t size = vec_from.size(); | 745 | | | 746 | 13 | RETURN_IF_ERROR(std::visit( | 747 | 13 | [&](auto multiply_may_overflow, auto narrow_integral) { | 748 | 13 | for (size_t i = 0; i < size; i++) { | 749 | 13 | if (!CastToDecimal::_from_int<typename FromDataType::FieldType, | 750 | 13 | typename ToDataType::FieldType, | 751 | 13 | multiply_may_overflow, narrow_integral>( | 752 | 13 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, | 753 | 13 | scale_multiplier, min_result, max_result, params)) { | 754 | 13 | if (set_nullable) { | 755 | 13 | null_map_data[i] = 1; | 756 | 13 | } else { | 757 | 13 | return params.status; | 758 | 13 | } | 759 | 13 | } | 760 | 13 | } | 761 | 13 | return Status::OK(); | 762 | 13 | }, | 763 | 13 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 764 | | | 765 | 13 | if (narrow_integral) { | 766 | 12 | block.get_by_position(result).column = | 767 | 12 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 768 | 12 | } else { | 769 | 1 | block.get_by_position(result).column = std::move(col_to); | 770 | 1 | } | 771 | 13 | return Status::OK(); | 772 | 13 | } |
|
773 | | }; |
774 | | |
775 | | // cast float and double to decimal. ALWAYS nullable result column. |
776 | | template <CastModeType CastMode, typename FromDataType, typename ToDataType> |
777 | | requires(IsDataTypeDecimal<ToDataType> && IsDataTypeFloat<FromDataType>) |
778 | | class CastToImpl<CastMode, FromDataType, ToDataType> : public CastToBase { |
779 | | public: |
780 | | Status execute_impl(FunctionContext* context, Block& block, const ColumnNumbers& arguments, |
781 | | uint32_t result, size_t input_rows_count, |
782 | 784 | const NullMap::value_type* null_map = nullptr) const override { |
783 | 784 | using FromFieldType = typename FromDataType::FieldType; |
784 | 784 | using ToFieldType = typename ToDataType::FieldType; |
785 | 784 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); |
786 | 784 | const auto* col_from = |
787 | 784 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); |
788 | 784 | if (!col_from) { |
789 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", |
790 | 0 | named_from.column->get_name()); |
791 | 0 | } |
792 | | |
793 | 784 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); |
794 | 784 | UInt32 from_scale = 0; |
795 | | |
796 | 784 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); |
797 | 784 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); |
798 | 784 | UInt32 to_precision = to_decimal_type.get_precision(); |
799 | 784 | ToDataType::check_type_precision(to_precision); |
800 | 784 | UInt32 to_scale = to_decimal_type.get_scale(); |
801 | 784 | ToDataType::check_type_scale(to_scale); |
802 | | |
803 | 784 | auto from_max_int_digit_count = from_precision - from_scale; |
804 | 784 | auto to_max_int_digit_count = to_precision - to_scale; |
805 | 784 | bool narrow_integral = |
806 | 784 | (to_max_int_digit_count < from_max_int_digit_count) || |
807 | 784 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); |
808 | | // only in non-strict mode and may overflow, we set nullable |
809 | 784 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; |
810 | | |
811 | 784 | ColumnUInt8::MutablePtr col_null_map_to = ColumnUInt8::create(input_rows_count, 0); |
812 | 784 | NullMap::value_type* null_map_data = col_null_map_to->get_data().data(); |
813 | | |
814 | 784 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); |
815 | 784 | const auto& vec_from = col_from->get_data(); |
816 | 784 | const auto* vec_from_data = vec_from.data(); |
817 | 784 | auto& vec_to = col_to->get_data(); |
818 | 784 | auto* vec_to_data = vec_to.data(); |
819 | | |
820 | 784 | CastParameters params; |
821 | 784 | params.is_strict = (CastMode == CastModeType::StrictMode); |
822 | 784 | size_t size = vec_from.size(); |
823 | | |
824 | 784 | typename ToFieldType::NativeType scale_multiplier = |
825 | 784 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); |
826 | 784 | typename ToFieldType::NativeType max_result = |
827 | 784 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); |
828 | 784 | typename ToFieldType::NativeType min_result = -max_result; |
829 | 3.99k | for (size_t i = 0; i < size; i++) { |
830 | 3.35k | if (!CastToDecimal::_from_float<typename FromDataType::FieldType, |
831 | 3.35k | typename ToDataType::FieldType>( |
832 | 3.35k | vec_from_data[i], vec_to_data[i], to_precision, to_scale, scale_multiplier, |
833 | 3.35k | min_result, max_result, params)) { |
834 | 288 | if (set_nullable) { |
835 | 144 | null_map_data[i] = 1; |
836 | 144 | } else { |
837 | 144 | return params.status; |
838 | 144 | } |
839 | 288 | } |
840 | 3.35k | } |
841 | | |
842 | 640 | block.get_by_position(result).column = |
843 | 640 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); |
844 | 640 | return Status::OK(); |
845 | 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 | 782 | 18 | const NullMap::value_type* null_map = nullptr) const override { | 783 | 18 | using FromFieldType = typename FromDataType::FieldType; | 784 | 18 | using ToFieldType = typename ToDataType::FieldType; | 785 | 18 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 786 | 18 | const auto* col_from = | 787 | 18 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 788 | 18 | if (!col_from) { | 789 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 790 | 0 | named_from.column->get_name()); | 791 | 0 | } | 792 | | | 793 | 18 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 794 | 18 | UInt32 from_scale = 0; | 795 | | | 796 | 18 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 797 | 18 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 798 | 18 | UInt32 to_precision = to_decimal_type.get_precision(); | 799 | 18 | ToDataType::check_type_precision(to_precision); | 800 | 18 | UInt32 to_scale = to_decimal_type.get_scale(); | 801 | 18 | ToDataType::check_type_scale(to_scale); | 802 | | | 803 | 18 | auto from_max_int_digit_count = from_precision - from_scale; | 804 | 18 | auto to_max_int_digit_count = to_precision - to_scale; | 805 | 18 | bool narrow_integral = | 806 | 18 | (to_max_int_digit_count < from_max_int_digit_count) || | 807 | 18 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 808 | | // only in non-strict mode and may overflow, we set nullable | 809 | 18 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 810 | | | 811 | 18 | ColumnUInt8::MutablePtr col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 812 | 18 | NullMap::value_type* null_map_data = col_null_map_to->get_data().data(); | 813 | | | 814 | 18 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 815 | 18 | const auto& vec_from = col_from->get_data(); | 816 | 18 | const auto* vec_from_data = vec_from.data(); | 817 | 18 | auto& vec_to = col_to->get_data(); | 818 | 18 | auto* vec_to_data = vec_to.data(); | 819 | | | 820 | 18 | CastParameters params; | 821 | 18 | params.is_strict = (CastMode == CastModeType::StrictMode); | 822 | 18 | size_t size = vec_from.size(); | 823 | | | 824 | 18 | typename ToFieldType::NativeType scale_multiplier = | 825 | 18 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 826 | 18 | typename ToFieldType::NativeType max_result = | 827 | 18 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 828 | 18 | typename ToFieldType::NativeType min_result = -max_result; | 829 | 18 | for (size_t i = 0; i < size; i++) { | 830 | 18 | if (!CastToDecimal::_from_float<typename FromDataType::FieldType, | 831 | 18 | typename ToDataType::FieldType>( | 832 | 18 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, scale_multiplier, | 833 | 18 | min_result, max_result, params)) { | 834 | 18 | if (set_nullable) { | 835 | 0 | null_map_data[i] = 1; | 836 | 18 | } else { | 837 | 18 | return params.status; | 838 | 18 | } | 839 | 18 | } | 840 | 18 | } | 841 | | | 842 | 0 | block.get_by_position(result).column = | 843 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 844 | 0 | return Status::OK(); | 845 | 18 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE8EEENS_15DataTypeDecimalILS3_28EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 782 | 81 | const NullMap::value_type* null_map = nullptr) const override { | 783 | 81 | using FromFieldType = typename FromDataType::FieldType; | 784 | 81 | using ToFieldType = typename ToDataType::FieldType; | 785 | 81 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 786 | 81 | const auto* col_from = | 787 | 81 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 788 | 81 | if (!col_from) { | 789 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 790 | 0 | named_from.column->get_name()); | 791 | 0 | } | 792 | | | 793 | 81 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 794 | 81 | UInt32 from_scale = 0; | 795 | | | 796 | 81 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 797 | 81 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 798 | 81 | UInt32 to_precision = to_decimal_type.get_precision(); | 799 | 81 | ToDataType::check_type_precision(to_precision); | 800 | 81 | UInt32 to_scale = to_decimal_type.get_scale(); | 801 | 81 | ToDataType::check_type_scale(to_scale); | 802 | | | 803 | 81 | auto from_max_int_digit_count = from_precision - from_scale; | 804 | 81 | auto to_max_int_digit_count = to_precision - to_scale; | 805 | 81 | bool narrow_integral = | 806 | 81 | (to_max_int_digit_count < from_max_int_digit_count) || | 807 | 81 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 808 | | // only in non-strict mode and may overflow, we set nullable | 809 | 81 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 810 | | | 811 | 81 | ColumnUInt8::MutablePtr col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 812 | 81 | NullMap::value_type* null_map_data = col_null_map_to->get_data().data(); | 813 | | | 814 | 81 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 815 | 81 | const auto& vec_from = col_from->get_data(); | 816 | 81 | const auto* vec_from_data = vec_from.data(); | 817 | 81 | auto& vec_to = col_to->get_data(); | 818 | 81 | auto* vec_to_data = vec_to.data(); | 819 | | | 820 | 81 | CastParameters params; | 821 | 81 | params.is_strict = (CastMode == CastModeType::StrictMode); | 822 | 81 | size_t size = vec_from.size(); | 823 | | | 824 | 81 | typename ToFieldType::NativeType scale_multiplier = | 825 | 81 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 826 | 81 | typename ToFieldType::NativeType max_result = | 827 | 81 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 828 | 81 | typename ToFieldType::NativeType min_result = -max_result; | 829 | 491 | for (size_t i = 0; i < size; i++) { | 830 | 410 | if (!CastToDecimal::_from_float<typename FromDataType::FieldType, | 831 | 410 | typename ToDataType::FieldType>( | 832 | 410 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, scale_multiplier, | 833 | 410 | min_result, max_result, params)) { | 834 | 18 | if (set_nullable) { | 835 | 18 | null_map_data[i] = 1; | 836 | 18 | } else { | 837 | 0 | return params.status; | 838 | 0 | } | 839 | 18 | } | 840 | 410 | } | 841 | | | 842 | 81 | block.get_by_position(result).column = | 843 | 81 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 844 | 81 | return Status::OK(); | 845 | 81 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE9EEENS_15DataTypeDecimalILS3_28EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 782 | 18 | const NullMap::value_type* null_map = nullptr) const override { | 783 | 18 | using FromFieldType = typename FromDataType::FieldType; | 784 | 18 | using ToFieldType = typename ToDataType::FieldType; | 785 | 18 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 786 | 18 | const auto* col_from = | 787 | 18 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 788 | 18 | if (!col_from) { | 789 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 790 | 0 | named_from.column->get_name()); | 791 | 0 | } | 792 | | | 793 | 18 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 794 | 18 | UInt32 from_scale = 0; | 795 | | | 796 | 18 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 797 | 18 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 798 | 18 | UInt32 to_precision = to_decimal_type.get_precision(); | 799 | 18 | ToDataType::check_type_precision(to_precision); | 800 | 18 | UInt32 to_scale = to_decimal_type.get_scale(); | 801 | 18 | ToDataType::check_type_scale(to_scale); | 802 | | | 803 | 18 | auto from_max_int_digit_count = from_precision - from_scale; | 804 | 18 | auto to_max_int_digit_count = to_precision - to_scale; | 805 | 18 | bool narrow_integral = | 806 | 18 | (to_max_int_digit_count < from_max_int_digit_count) || | 807 | 18 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 808 | | // only in non-strict mode and may overflow, we set nullable | 809 | 18 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 810 | | | 811 | 18 | ColumnUInt8::MutablePtr col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 812 | 18 | NullMap::value_type* null_map_data = col_null_map_to->get_data().data(); | 813 | | | 814 | 18 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 815 | 18 | const auto& vec_from = col_from->get_data(); | 816 | 18 | const auto* vec_from_data = vec_from.data(); | 817 | 18 | auto& vec_to = col_to->get_data(); | 818 | 18 | auto* vec_to_data = vec_to.data(); | 819 | | | 820 | 18 | CastParameters params; | 821 | 18 | params.is_strict = (CastMode == CastModeType::StrictMode); | 822 | 18 | size_t size = vec_from.size(); | 823 | | | 824 | 18 | typename ToFieldType::NativeType scale_multiplier = | 825 | 18 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 826 | 18 | typename ToFieldType::NativeType max_result = | 827 | 18 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 828 | 18 | typename ToFieldType::NativeType min_result = -max_result; | 829 | 18 | for (size_t i = 0; i < size; i++) { | 830 | 18 | if (!CastToDecimal::_from_float<typename FromDataType::FieldType, | 831 | 18 | typename ToDataType::FieldType>( | 832 | 18 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, scale_multiplier, | 833 | 18 | min_result, max_result, params)) { | 834 | 18 | if (set_nullable) { | 835 | 0 | null_map_data[i] = 1; | 836 | 18 | } else { | 837 | 18 | return params.status; | 838 | 18 | } | 839 | 18 | } | 840 | 18 | } | 841 | | | 842 | 0 | block.get_by_position(result).column = | 843 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 844 | 0 | return Status::OK(); | 845 | 18 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE9EEENS_15DataTypeDecimalILS3_28EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 782 | 85 | const NullMap::value_type* null_map = nullptr) const override { | 783 | 85 | using FromFieldType = typename FromDataType::FieldType; | 784 | 85 | using ToFieldType = typename ToDataType::FieldType; | 785 | 85 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 786 | 85 | const auto* col_from = | 787 | 85 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 788 | 85 | if (!col_from) { | 789 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 790 | 0 | named_from.column->get_name()); | 791 | 0 | } | 792 | | | 793 | 85 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 794 | 85 | UInt32 from_scale = 0; | 795 | | | 796 | 85 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 797 | 85 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 798 | 85 | UInt32 to_precision = to_decimal_type.get_precision(); | 799 | 85 | ToDataType::check_type_precision(to_precision); | 800 | 85 | UInt32 to_scale = to_decimal_type.get_scale(); | 801 | 85 | ToDataType::check_type_scale(to_scale); | 802 | | | 803 | 85 | auto from_max_int_digit_count = from_precision - from_scale; | 804 | 85 | auto to_max_int_digit_count = to_precision - to_scale; | 805 | 85 | bool narrow_integral = | 806 | 85 | (to_max_int_digit_count < from_max_int_digit_count) || | 807 | 85 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 808 | | // only in non-strict mode and may overflow, we set nullable | 809 | 85 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 810 | | | 811 | 85 | ColumnUInt8::MutablePtr col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 812 | 85 | NullMap::value_type* null_map_data = col_null_map_to->get_data().data(); | 813 | | | 814 | 85 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 815 | 85 | const auto& vec_from = col_from->get_data(); | 816 | 85 | const auto* vec_from_data = vec_from.data(); | 817 | 85 | auto& vec_to = col_to->get_data(); | 818 | 85 | auto* vec_to_data = vec_to.data(); | 819 | | | 820 | 85 | CastParameters params; | 821 | 85 | params.is_strict = (CastMode == CastModeType::StrictMode); | 822 | 85 | size_t size = vec_from.size(); | 823 | | | 824 | 85 | typename ToFieldType::NativeType scale_multiplier = | 825 | 85 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 826 | 85 | typename ToFieldType::NativeType max_result = | 827 | 85 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 828 | 85 | typename ToFieldType::NativeType min_result = -max_result; | 829 | 507 | for (size_t i = 0; i < size; i++) { | 830 | 422 | if (!CastToDecimal::_from_float<typename FromDataType::FieldType, | 831 | 422 | typename ToDataType::FieldType>( | 832 | 422 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, scale_multiplier, | 833 | 422 | min_result, max_result, params)) { | 834 | 18 | if (set_nullable) { | 835 | 18 | null_map_data[i] = 1; | 836 | 18 | } else { | 837 | 0 | return params.status; | 838 | 0 | } | 839 | 18 | } | 840 | 422 | } | 841 | | | 842 | 85 | block.get_by_position(result).column = | 843 | 85 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 844 | 85 | return Status::OK(); | 845 | 85 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE8EEENS_15DataTypeDecimalILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 782 | 18 | const NullMap::value_type* null_map = nullptr) const override { | 783 | 18 | using FromFieldType = typename FromDataType::FieldType; | 784 | 18 | using ToFieldType = typename ToDataType::FieldType; | 785 | 18 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 786 | 18 | const auto* col_from = | 787 | 18 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 788 | 18 | if (!col_from) { | 789 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 790 | 0 | named_from.column->get_name()); | 791 | 0 | } | 792 | | | 793 | 18 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 794 | 18 | UInt32 from_scale = 0; | 795 | | | 796 | 18 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 797 | 18 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 798 | 18 | UInt32 to_precision = to_decimal_type.get_precision(); | 799 | 18 | ToDataType::check_type_precision(to_precision); | 800 | 18 | UInt32 to_scale = to_decimal_type.get_scale(); | 801 | 18 | ToDataType::check_type_scale(to_scale); | 802 | | | 803 | 18 | auto from_max_int_digit_count = from_precision - from_scale; | 804 | 18 | auto to_max_int_digit_count = to_precision - to_scale; | 805 | 18 | bool narrow_integral = | 806 | 18 | (to_max_int_digit_count < from_max_int_digit_count) || | 807 | 18 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 808 | | // only in non-strict mode and may overflow, we set nullable | 809 | 18 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 810 | | | 811 | 18 | ColumnUInt8::MutablePtr col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 812 | 18 | NullMap::value_type* null_map_data = col_null_map_to->get_data().data(); | 813 | | | 814 | 18 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 815 | 18 | const auto& vec_from = col_from->get_data(); | 816 | 18 | const auto* vec_from_data = vec_from.data(); | 817 | 18 | auto& vec_to = col_to->get_data(); | 818 | 18 | auto* vec_to_data = vec_to.data(); | 819 | | | 820 | 18 | CastParameters params; | 821 | 18 | params.is_strict = (CastMode == CastModeType::StrictMode); | 822 | 18 | size_t size = vec_from.size(); | 823 | | | 824 | 18 | typename ToFieldType::NativeType scale_multiplier = | 825 | 18 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 826 | 18 | typename ToFieldType::NativeType max_result = | 827 | 18 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 828 | 18 | typename ToFieldType::NativeType min_result = -max_result; | 829 | 18 | for (size_t i = 0; i < size; i++) { | 830 | 18 | if (!CastToDecimal::_from_float<typename FromDataType::FieldType, | 831 | 18 | typename ToDataType::FieldType>( | 832 | 18 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, scale_multiplier, | 833 | 18 | min_result, max_result, params)) { | 834 | 18 | if (set_nullable) { | 835 | 0 | null_map_data[i] = 1; | 836 | 18 | } else { | 837 | 18 | return params.status; | 838 | 18 | } | 839 | 18 | } | 840 | 18 | } | 841 | | | 842 | 0 | block.get_by_position(result).column = | 843 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 844 | 0 | return Status::OK(); | 845 | 18 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE8EEENS_15DataTypeDecimalILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 782 | 81 | const NullMap::value_type* null_map = nullptr) const override { | 783 | 81 | using FromFieldType = typename FromDataType::FieldType; | 784 | 81 | using ToFieldType = typename ToDataType::FieldType; | 785 | 81 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 786 | 81 | const auto* col_from = | 787 | 81 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 788 | 81 | if (!col_from) { | 789 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 790 | 0 | named_from.column->get_name()); | 791 | 0 | } | 792 | | | 793 | 81 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 794 | 81 | UInt32 from_scale = 0; | 795 | | | 796 | 81 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 797 | 81 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 798 | 81 | UInt32 to_precision = to_decimal_type.get_precision(); | 799 | 81 | ToDataType::check_type_precision(to_precision); | 800 | 81 | UInt32 to_scale = to_decimal_type.get_scale(); | 801 | 81 | ToDataType::check_type_scale(to_scale); | 802 | | | 803 | 81 | auto from_max_int_digit_count = from_precision - from_scale; | 804 | 81 | auto to_max_int_digit_count = to_precision - to_scale; | 805 | 81 | bool narrow_integral = | 806 | 81 | (to_max_int_digit_count < from_max_int_digit_count) || | 807 | 81 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 808 | | // only in non-strict mode and may overflow, we set nullable | 809 | 81 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 810 | | | 811 | 81 | ColumnUInt8::MutablePtr col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 812 | 81 | NullMap::value_type* null_map_data = col_null_map_to->get_data().data(); | 813 | | | 814 | 81 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 815 | 81 | const auto& vec_from = col_from->get_data(); | 816 | 81 | const auto* vec_from_data = vec_from.data(); | 817 | 81 | auto& vec_to = col_to->get_data(); | 818 | 81 | auto* vec_to_data = vec_to.data(); | 819 | | | 820 | 81 | CastParameters params; | 821 | 81 | params.is_strict = (CastMode == CastModeType::StrictMode); | 822 | 81 | size_t size = vec_from.size(); | 823 | | | 824 | 81 | typename ToFieldType::NativeType scale_multiplier = | 825 | 81 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 826 | 81 | typename ToFieldType::NativeType max_result = | 827 | 81 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 828 | 81 | typename ToFieldType::NativeType min_result = -max_result; | 829 | 443 | for (size_t i = 0; i < size; i++) { | 830 | 362 | if (!CastToDecimal::_from_float<typename FromDataType::FieldType, | 831 | 362 | typename ToDataType::FieldType>( | 832 | 362 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, scale_multiplier, | 833 | 362 | min_result, max_result, params)) { | 834 | 18 | if (set_nullable) { | 835 | 18 | null_map_data[i] = 1; | 836 | 18 | } else { | 837 | 0 | return params.status; | 838 | 0 | } | 839 | 18 | } | 840 | 362 | } | 841 | | | 842 | 81 | block.get_by_position(result).column = | 843 | 81 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 844 | 81 | return Status::OK(); | 845 | 81 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE9EEENS_15DataTypeDecimalILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 782 | 18 | const NullMap::value_type* null_map = nullptr) const override { | 783 | 18 | using FromFieldType = typename FromDataType::FieldType; | 784 | 18 | using ToFieldType = typename ToDataType::FieldType; | 785 | 18 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 786 | 18 | const auto* col_from = | 787 | 18 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 788 | 18 | if (!col_from) { | 789 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 790 | 0 | named_from.column->get_name()); | 791 | 0 | } | 792 | | | 793 | 18 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 794 | 18 | UInt32 from_scale = 0; | 795 | | | 796 | 18 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 797 | 18 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 798 | 18 | UInt32 to_precision = to_decimal_type.get_precision(); | 799 | 18 | ToDataType::check_type_precision(to_precision); | 800 | 18 | UInt32 to_scale = to_decimal_type.get_scale(); | 801 | 18 | ToDataType::check_type_scale(to_scale); | 802 | | | 803 | 18 | auto from_max_int_digit_count = from_precision - from_scale; | 804 | 18 | auto to_max_int_digit_count = to_precision - to_scale; | 805 | 18 | bool narrow_integral = | 806 | 18 | (to_max_int_digit_count < from_max_int_digit_count) || | 807 | 18 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 808 | | // only in non-strict mode and may overflow, we set nullable | 809 | 18 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 810 | | | 811 | 18 | ColumnUInt8::MutablePtr col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 812 | 18 | NullMap::value_type* null_map_data = col_null_map_to->get_data().data(); | 813 | | | 814 | 18 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 815 | 18 | const auto& vec_from = col_from->get_data(); | 816 | 18 | const auto* vec_from_data = vec_from.data(); | 817 | 18 | auto& vec_to = col_to->get_data(); | 818 | 18 | auto* vec_to_data = vec_to.data(); | 819 | | | 820 | 18 | CastParameters params; | 821 | 18 | params.is_strict = (CastMode == CastModeType::StrictMode); | 822 | 18 | size_t size = vec_from.size(); | 823 | | | 824 | 18 | typename ToFieldType::NativeType scale_multiplier = | 825 | 18 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 826 | 18 | typename ToFieldType::NativeType max_result = | 827 | 18 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 828 | 18 | typename ToFieldType::NativeType min_result = -max_result; | 829 | 18 | for (size_t i = 0; i < size; i++) { | 830 | 18 | if (!CastToDecimal::_from_float<typename FromDataType::FieldType, | 831 | 18 | typename ToDataType::FieldType>( | 832 | 18 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, scale_multiplier, | 833 | 18 | min_result, max_result, params)) { | 834 | 18 | if (set_nullable) { | 835 | 0 | null_map_data[i] = 1; | 836 | 18 | } else { | 837 | 18 | return params.status; | 838 | 18 | } | 839 | 18 | } | 840 | 18 | } | 841 | | | 842 | 0 | block.get_by_position(result).column = | 843 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 844 | 0 | return Status::OK(); | 845 | 18 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE9EEENS_15DataTypeDecimalILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 782 | 81 | const NullMap::value_type* null_map = nullptr) const override { | 783 | 81 | using FromFieldType = typename FromDataType::FieldType; | 784 | 81 | using ToFieldType = typename ToDataType::FieldType; | 785 | 81 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 786 | 81 | const auto* col_from = | 787 | 81 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 788 | 81 | if (!col_from) { | 789 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 790 | 0 | named_from.column->get_name()); | 791 | 0 | } | 792 | | | 793 | 81 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 794 | 81 | UInt32 from_scale = 0; | 795 | | | 796 | 81 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 797 | 81 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 798 | 81 | UInt32 to_precision = to_decimal_type.get_precision(); | 799 | 81 | ToDataType::check_type_precision(to_precision); | 800 | 81 | UInt32 to_scale = to_decimal_type.get_scale(); | 801 | 81 | ToDataType::check_type_scale(to_scale); | 802 | | | 803 | 81 | auto from_max_int_digit_count = from_precision - from_scale; | 804 | 81 | auto to_max_int_digit_count = to_precision - to_scale; | 805 | 81 | bool narrow_integral = | 806 | 81 | (to_max_int_digit_count < from_max_int_digit_count) || | 807 | 81 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 808 | | // only in non-strict mode and may overflow, we set nullable | 809 | 81 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 810 | | | 811 | 81 | ColumnUInt8::MutablePtr col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 812 | 81 | NullMap::value_type* null_map_data = col_null_map_to->get_data().data(); | 813 | | | 814 | 81 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 815 | 81 | const auto& vec_from = col_from->get_data(); | 816 | 81 | const auto* vec_from_data = vec_from.data(); | 817 | 81 | auto& vec_to = col_to->get_data(); | 818 | 81 | auto* vec_to_data = vec_to.data(); | 819 | | | 820 | 81 | CastParameters params; | 821 | 81 | params.is_strict = (CastMode == CastModeType::StrictMode); | 822 | 81 | size_t size = vec_from.size(); | 823 | | | 824 | 81 | typename ToFieldType::NativeType scale_multiplier = | 825 | 81 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 826 | 81 | typename ToFieldType::NativeType max_result = | 827 | 81 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 828 | 81 | typename ToFieldType::NativeType min_result = -max_result; | 829 | 491 | for (size_t i = 0; i < size; i++) { | 830 | 410 | if (!CastToDecimal::_from_float<typename FromDataType::FieldType, | 831 | 410 | typename ToDataType::FieldType>( | 832 | 410 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, scale_multiplier, | 833 | 410 | min_result, max_result, params)) { | 834 | 18 | if (set_nullable) { | 835 | 18 | null_map_data[i] = 1; | 836 | 18 | } else { | 837 | 0 | return params.status; | 838 | 0 | } | 839 | 18 | } | 840 | 410 | } | 841 | | | 842 | 81 | block.get_by_position(result).column = | 843 | 81 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 844 | 81 | return Status::OK(); | 845 | 81 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE8EEENS_15DataTypeDecimalILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 782 | 18 | const NullMap::value_type* null_map = nullptr) const override { | 783 | 18 | using FromFieldType = typename FromDataType::FieldType; | 784 | 18 | using ToFieldType = typename ToDataType::FieldType; | 785 | 18 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 786 | 18 | const auto* col_from = | 787 | 18 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 788 | 18 | if (!col_from) { | 789 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 790 | 0 | named_from.column->get_name()); | 791 | 0 | } | 792 | | | 793 | 18 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 794 | 18 | UInt32 from_scale = 0; | 795 | | | 796 | 18 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 797 | 18 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 798 | 18 | UInt32 to_precision = to_decimal_type.get_precision(); | 799 | 18 | ToDataType::check_type_precision(to_precision); | 800 | 18 | UInt32 to_scale = to_decimal_type.get_scale(); | 801 | 18 | ToDataType::check_type_scale(to_scale); | 802 | | | 803 | 18 | auto from_max_int_digit_count = from_precision - from_scale; | 804 | 18 | auto to_max_int_digit_count = to_precision - to_scale; | 805 | 18 | bool narrow_integral = | 806 | 18 | (to_max_int_digit_count < from_max_int_digit_count) || | 807 | 18 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 808 | | // only in non-strict mode and may overflow, we set nullable | 809 | 18 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 810 | | | 811 | 18 | ColumnUInt8::MutablePtr col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 812 | 18 | NullMap::value_type* null_map_data = col_null_map_to->get_data().data(); | 813 | | | 814 | 18 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 815 | 18 | const auto& vec_from = col_from->get_data(); | 816 | 18 | const auto* vec_from_data = vec_from.data(); | 817 | 18 | auto& vec_to = col_to->get_data(); | 818 | 18 | auto* vec_to_data = vec_to.data(); | 819 | | | 820 | 18 | CastParameters params; | 821 | 18 | params.is_strict = (CastMode == CastModeType::StrictMode); | 822 | 18 | size_t size = vec_from.size(); | 823 | | | 824 | 18 | typename ToFieldType::NativeType scale_multiplier = | 825 | 18 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 826 | 18 | typename ToFieldType::NativeType max_result = | 827 | 18 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 828 | 18 | typename ToFieldType::NativeType min_result = -max_result; | 829 | 18 | for (size_t i = 0; i < size; i++) { | 830 | 18 | if (!CastToDecimal::_from_float<typename FromDataType::FieldType, | 831 | 18 | typename ToDataType::FieldType>( | 832 | 18 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, scale_multiplier, | 833 | 18 | min_result, max_result, params)) { | 834 | 18 | if (set_nullable) { | 835 | 0 | null_map_data[i] = 1; | 836 | 18 | } else { | 837 | 18 | return params.status; | 838 | 18 | } | 839 | 18 | } | 840 | 18 | } | 841 | | | 842 | 0 | block.get_by_position(result).column = | 843 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 844 | 0 | return Status::OK(); | 845 | 18 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE8EEENS_15DataTypeDecimalILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 782 | 89 | const NullMap::value_type* null_map = nullptr) const override { | 783 | 89 | using FromFieldType = typename FromDataType::FieldType; | 784 | 89 | using ToFieldType = typename ToDataType::FieldType; | 785 | 89 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 786 | 89 | const auto* col_from = | 787 | 89 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 788 | 89 | if (!col_from) { | 789 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 790 | 0 | named_from.column->get_name()); | 791 | 0 | } | 792 | | | 793 | 89 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 794 | 89 | UInt32 from_scale = 0; | 795 | | | 796 | 89 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 797 | 89 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 798 | 89 | UInt32 to_precision = to_decimal_type.get_precision(); | 799 | 89 | ToDataType::check_type_precision(to_precision); | 800 | 89 | UInt32 to_scale = to_decimal_type.get_scale(); | 801 | 89 | ToDataType::check_type_scale(to_scale); | 802 | | | 803 | 89 | auto from_max_int_digit_count = from_precision - from_scale; | 804 | 89 | auto to_max_int_digit_count = to_precision - to_scale; | 805 | 89 | bool narrow_integral = | 806 | 89 | (to_max_int_digit_count < from_max_int_digit_count) || | 807 | 89 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 808 | | // only in non-strict mode and may overflow, we set nullable | 809 | 89 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 810 | | | 811 | 89 | ColumnUInt8::MutablePtr col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 812 | 89 | NullMap::value_type* null_map_data = col_null_map_to->get_data().data(); | 813 | | | 814 | 89 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 815 | 89 | const auto& vec_from = col_from->get_data(); | 816 | 89 | const auto* vec_from_data = vec_from.data(); | 817 | 89 | auto& vec_to = col_to->get_data(); | 818 | 89 | auto* vec_to_data = vec_to.data(); | 819 | | | 820 | 89 | CastParameters params; | 821 | 89 | params.is_strict = (CastMode == CastModeType::StrictMode); | 822 | 89 | size_t size = vec_from.size(); | 823 | | | 824 | 89 | typename ToFieldType::NativeType scale_multiplier = | 825 | 89 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 826 | 89 | typename ToFieldType::NativeType max_result = | 827 | 89 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 828 | 89 | typename ToFieldType::NativeType min_result = -max_result; | 829 | 515 | for (size_t i = 0; i < size; i++) { | 830 | 426 | if (!CastToDecimal::_from_float<typename FromDataType::FieldType, | 831 | 426 | typename ToDataType::FieldType>( | 832 | 426 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, scale_multiplier, | 833 | 426 | min_result, max_result, params)) { | 834 | 18 | if (set_nullable) { | 835 | 18 | null_map_data[i] = 1; | 836 | 18 | } else { | 837 | 0 | return params.status; | 838 | 0 | } | 839 | 18 | } | 840 | 426 | } | 841 | | | 842 | 89 | block.get_by_position(result).column = | 843 | 89 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 844 | 89 | return Status::OK(); | 845 | 89 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE9EEENS_15DataTypeDecimalILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 782 | 18 | const NullMap::value_type* null_map = nullptr) const override { | 783 | 18 | using FromFieldType = typename FromDataType::FieldType; | 784 | 18 | using ToFieldType = typename ToDataType::FieldType; | 785 | 18 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 786 | 18 | const auto* col_from = | 787 | 18 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 788 | 18 | if (!col_from) { | 789 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 790 | 0 | named_from.column->get_name()); | 791 | 0 | } | 792 | | | 793 | 18 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 794 | 18 | UInt32 from_scale = 0; | 795 | | | 796 | 18 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 797 | 18 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 798 | 18 | UInt32 to_precision = to_decimal_type.get_precision(); | 799 | 18 | ToDataType::check_type_precision(to_precision); | 800 | 18 | UInt32 to_scale = to_decimal_type.get_scale(); | 801 | 18 | ToDataType::check_type_scale(to_scale); | 802 | | | 803 | 18 | auto from_max_int_digit_count = from_precision - from_scale; | 804 | 18 | auto to_max_int_digit_count = to_precision - to_scale; | 805 | 18 | bool narrow_integral = | 806 | 18 | (to_max_int_digit_count < from_max_int_digit_count) || | 807 | 18 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 808 | | // only in non-strict mode and may overflow, we set nullable | 809 | 18 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 810 | | | 811 | 18 | ColumnUInt8::MutablePtr col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 812 | 18 | NullMap::value_type* null_map_data = col_null_map_to->get_data().data(); | 813 | | | 814 | 18 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 815 | 18 | const auto& vec_from = col_from->get_data(); | 816 | 18 | const auto* vec_from_data = vec_from.data(); | 817 | 18 | auto& vec_to = col_to->get_data(); | 818 | 18 | auto* vec_to_data = vec_to.data(); | 819 | | | 820 | 18 | CastParameters params; | 821 | 18 | params.is_strict = (CastMode == CastModeType::StrictMode); | 822 | 18 | size_t size = vec_from.size(); | 823 | | | 824 | 18 | typename ToFieldType::NativeType scale_multiplier = | 825 | 18 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 826 | 18 | typename ToFieldType::NativeType max_result = | 827 | 18 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 828 | 18 | typename ToFieldType::NativeType min_result = -max_result; | 829 | 18 | for (size_t i = 0; i < size; i++) { | 830 | 18 | if (!CastToDecimal::_from_float<typename FromDataType::FieldType, | 831 | 18 | typename ToDataType::FieldType>( | 832 | 18 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, scale_multiplier, | 833 | 18 | min_result, max_result, params)) { | 834 | 18 | if (set_nullable) { | 835 | 0 | null_map_data[i] = 1; | 836 | 18 | } else { | 837 | 18 | return params.status; | 838 | 18 | } | 839 | 18 | } | 840 | 18 | } | 841 | | | 842 | 0 | block.get_by_position(result).column = | 843 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 844 | 0 | return Status::OK(); | 845 | 18 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE9EEENS_15DataTypeDecimalILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 782 | 73 | const NullMap::value_type* null_map = nullptr) const override { | 783 | 73 | using FromFieldType = typename FromDataType::FieldType; | 784 | 73 | using ToFieldType = typename ToDataType::FieldType; | 785 | 73 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 786 | 73 | const auto* col_from = | 787 | 73 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 788 | 73 | if (!col_from) { | 789 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 790 | 0 | named_from.column->get_name()); | 791 | 0 | } | 792 | | | 793 | 73 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 794 | 73 | UInt32 from_scale = 0; | 795 | | | 796 | 73 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 797 | 73 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 798 | 73 | UInt32 to_precision = to_decimal_type.get_precision(); | 799 | 73 | ToDataType::check_type_precision(to_precision); | 800 | 73 | UInt32 to_scale = to_decimal_type.get_scale(); | 801 | 73 | ToDataType::check_type_scale(to_scale); | 802 | | | 803 | 73 | auto from_max_int_digit_count = from_precision - from_scale; | 804 | 73 | auto to_max_int_digit_count = to_precision - to_scale; | 805 | 73 | bool narrow_integral = | 806 | 73 | (to_max_int_digit_count < from_max_int_digit_count) || | 807 | 73 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 808 | | // only in non-strict mode and may overflow, we set nullable | 809 | 73 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 810 | | | 811 | 73 | ColumnUInt8::MutablePtr col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 812 | 73 | NullMap::value_type* null_map_data = col_null_map_to->get_data().data(); | 813 | | | 814 | 73 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 815 | 73 | const auto& vec_from = col_from->get_data(); | 816 | 73 | const auto* vec_from_data = vec_from.data(); | 817 | 73 | auto& vec_to = col_to->get_data(); | 818 | 73 | auto* vec_to_data = vec_to.data(); | 819 | | | 820 | 73 | CastParameters params; | 821 | 73 | params.is_strict = (CastMode == CastModeType::StrictMode); | 822 | 73 | size_t size = vec_from.size(); | 823 | | | 824 | 73 | typename ToFieldType::NativeType scale_multiplier = | 825 | 73 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 826 | 73 | typename ToFieldType::NativeType max_result = | 827 | 73 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 828 | 73 | typename ToFieldType::NativeType min_result = -max_result; | 829 | 427 | for (size_t i = 0; i < size; i++) { | 830 | 354 | if (!CastToDecimal::_from_float<typename FromDataType::FieldType, | 831 | 354 | typename ToDataType::FieldType>( | 832 | 354 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, scale_multiplier, | 833 | 354 | min_result, max_result, params)) { | 834 | 18 | if (set_nullable) { | 835 | 18 | null_map_data[i] = 1; | 836 | 18 | } else { | 837 | 0 | return params.status; | 838 | 0 | } | 839 | 18 | } | 840 | 354 | } | 841 | | | 842 | 73 | block.get_by_position(result).column = | 843 | 73 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 844 | 73 | return Status::OK(); | 845 | 73 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE8EEENS_15DataTypeDecimalILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 782 | 18 | const NullMap::value_type* null_map = nullptr) const override { | 783 | 18 | using FromFieldType = typename FromDataType::FieldType; | 784 | 18 | using ToFieldType = typename ToDataType::FieldType; | 785 | 18 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 786 | 18 | const auto* col_from = | 787 | 18 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 788 | 18 | if (!col_from) { | 789 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 790 | 0 | named_from.column->get_name()); | 791 | 0 | } | 792 | | | 793 | 18 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 794 | 18 | UInt32 from_scale = 0; | 795 | | | 796 | 18 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 797 | 18 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 798 | 18 | UInt32 to_precision = to_decimal_type.get_precision(); | 799 | 18 | ToDataType::check_type_precision(to_precision); | 800 | 18 | UInt32 to_scale = to_decimal_type.get_scale(); | 801 | 18 | ToDataType::check_type_scale(to_scale); | 802 | | | 803 | 18 | auto from_max_int_digit_count = from_precision - from_scale; | 804 | 18 | auto to_max_int_digit_count = to_precision - to_scale; | 805 | 18 | bool narrow_integral = | 806 | 18 | (to_max_int_digit_count < from_max_int_digit_count) || | 807 | 18 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 808 | | // only in non-strict mode and may overflow, we set nullable | 809 | 18 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 810 | | | 811 | 18 | ColumnUInt8::MutablePtr col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 812 | 18 | NullMap::value_type* null_map_data = col_null_map_to->get_data().data(); | 813 | | | 814 | 18 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 815 | 18 | const auto& vec_from = col_from->get_data(); | 816 | 18 | const auto* vec_from_data = vec_from.data(); | 817 | 18 | auto& vec_to = col_to->get_data(); | 818 | 18 | auto* vec_to_data = vec_to.data(); | 819 | | | 820 | 18 | CastParameters params; | 821 | 18 | params.is_strict = (CastMode == CastModeType::StrictMode); | 822 | 18 | size_t size = vec_from.size(); | 823 | | | 824 | 18 | typename ToFieldType::NativeType scale_multiplier = | 825 | 18 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 826 | 18 | typename ToFieldType::NativeType max_result = | 827 | 18 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 828 | 18 | typename ToFieldType::NativeType min_result = -max_result; | 829 | 18 | for (size_t i = 0; i < size; i++) { | 830 | 18 | if (!CastToDecimal::_from_float<typename FromDataType::FieldType, | 831 | 18 | typename ToDataType::FieldType>( | 832 | 18 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, scale_multiplier, | 833 | 18 | min_result, max_result, params)) { | 834 | 18 | if (set_nullable) { | 835 | 0 | null_map_data[i] = 1; | 836 | 18 | } else { | 837 | 18 | return params.status; | 838 | 18 | } | 839 | 18 | } | 840 | 18 | } | 841 | | | 842 | 0 | block.get_by_position(result).column = | 843 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 844 | 0 | return Status::OK(); | 845 | 18 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE8EEENS_15DataTypeDecimalILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 782 | 69 | const NullMap::value_type* null_map = nullptr) const override { | 783 | 69 | using FromFieldType = typename FromDataType::FieldType; | 784 | 69 | using ToFieldType = typename ToDataType::FieldType; | 785 | 69 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 786 | 69 | const auto* col_from = | 787 | 69 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 788 | 69 | if (!col_from) { | 789 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 790 | 0 | named_from.column->get_name()); | 791 | 0 | } | 792 | | | 793 | 69 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 794 | 69 | UInt32 from_scale = 0; | 795 | | | 796 | 69 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 797 | 69 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 798 | 69 | UInt32 to_precision = to_decimal_type.get_precision(); | 799 | 69 | ToDataType::check_type_precision(to_precision); | 800 | 69 | UInt32 to_scale = to_decimal_type.get_scale(); | 801 | 69 | ToDataType::check_type_scale(to_scale); | 802 | | | 803 | 69 | auto from_max_int_digit_count = from_precision - from_scale; | 804 | 69 | auto to_max_int_digit_count = to_precision - to_scale; | 805 | 69 | bool narrow_integral = | 806 | 69 | (to_max_int_digit_count < from_max_int_digit_count) || | 807 | 69 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 808 | | // only in non-strict mode and may overflow, we set nullable | 809 | 69 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 810 | | | 811 | 69 | ColumnUInt8::MutablePtr col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 812 | 69 | NullMap::value_type* null_map_data = col_null_map_to->get_data().data(); | 813 | | | 814 | 69 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 815 | 69 | const auto& vec_from = col_from->get_data(); | 816 | 69 | const auto* vec_from_data = vec_from.data(); | 817 | 69 | auto& vec_to = col_to->get_data(); | 818 | 69 | auto* vec_to_data = vec_to.data(); | 819 | | | 820 | 69 | CastParameters params; | 821 | 69 | params.is_strict = (CastMode == CastModeType::StrictMode); | 822 | 69 | size_t size = vec_from.size(); | 823 | | | 824 | 69 | typename ToFieldType::NativeType scale_multiplier = | 825 | 69 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 826 | 69 | typename ToFieldType::NativeType max_result = | 827 | 69 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 828 | 69 | typename ToFieldType::NativeType min_result = -max_result; | 829 | 475 | for (size_t i = 0; i < size; i++) { | 830 | 406 | if (!CastToDecimal::_from_float<typename FromDataType::FieldType, | 831 | 406 | typename ToDataType::FieldType>( | 832 | 406 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, scale_multiplier, | 833 | 406 | min_result, max_result, params)) { | 834 | 18 | if (set_nullable) { | 835 | 18 | null_map_data[i] = 1; | 836 | 18 | } else { | 837 | 0 | return params.status; | 838 | 0 | } | 839 | 18 | } | 840 | 406 | } | 841 | | | 842 | 69 | block.get_by_position(result).column = | 843 | 69 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 844 | 69 | return Status::OK(); | 845 | 69 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_14DataTypeNumberILNS_13PrimitiveTypeE9EEENS_15DataTypeDecimalILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 782 | 18 | const NullMap::value_type* null_map = nullptr) const override { | 783 | 18 | using FromFieldType = typename FromDataType::FieldType; | 784 | 18 | using ToFieldType = typename ToDataType::FieldType; | 785 | 18 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 786 | 18 | const auto* col_from = | 787 | 18 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 788 | 18 | if (!col_from) { | 789 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 790 | 0 | named_from.column->get_name()); | 791 | 0 | } | 792 | | | 793 | 18 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 794 | 18 | UInt32 from_scale = 0; | 795 | | | 796 | 18 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 797 | 18 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 798 | 18 | UInt32 to_precision = to_decimal_type.get_precision(); | 799 | 18 | ToDataType::check_type_precision(to_precision); | 800 | 18 | UInt32 to_scale = to_decimal_type.get_scale(); | 801 | 18 | ToDataType::check_type_scale(to_scale); | 802 | | | 803 | 18 | auto from_max_int_digit_count = from_precision - from_scale; | 804 | 18 | auto to_max_int_digit_count = to_precision - to_scale; | 805 | 18 | bool narrow_integral = | 806 | 18 | (to_max_int_digit_count < from_max_int_digit_count) || | 807 | 18 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 808 | | // only in non-strict mode and may overflow, we set nullable | 809 | 18 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 810 | | | 811 | 18 | ColumnUInt8::MutablePtr col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 812 | 18 | NullMap::value_type* null_map_data = col_null_map_to->get_data().data(); | 813 | | | 814 | 18 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 815 | 18 | const auto& vec_from = col_from->get_data(); | 816 | 18 | const auto* vec_from_data = vec_from.data(); | 817 | 18 | auto& vec_to = col_to->get_data(); | 818 | 18 | auto* vec_to_data = vec_to.data(); | 819 | | | 820 | 18 | CastParameters params; | 821 | 18 | params.is_strict = (CastMode == CastModeType::StrictMode); | 822 | 18 | size_t size = vec_from.size(); | 823 | | | 824 | 18 | typename ToFieldType::NativeType scale_multiplier = | 825 | 18 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 826 | 18 | typename ToFieldType::NativeType max_result = | 827 | 18 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 828 | 18 | typename ToFieldType::NativeType min_result = -max_result; | 829 | 18 | for (size_t i = 0; i < size; i++) { | 830 | 18 | if (!CastToDecimal::_from_float<typename FromDataType::FieldType, | 831 | 18 | typename ToDataType::FieldType>( | 832 | 18 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, scale_multiplier, | 833 | 18 | min_result, max_result, params)) { | 834 | 18 | if (set_nullable) { | 835 | 0 | null_map_data[i] = 1; | 836 | 18 | } else { | 837 | 18 | return params.status; | 838 | 18 | } | 839 | 18 | } | 840 | 18 | } | 841 | | | 842 | 0 | block.get_by_position(result).column = | 843 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 844 | 0 | return Status::OK(); | 845 | 18 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_14DataTypeNumberILNS_13PrimitiveTypeE9EEENS_15DataTypeDecimalILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 782 | 81 | const NullMap::value_type* null_map = nullptr) const override { | 783 | 81 | using FromFieldType = typename FromDataType::FieldType; | 784 | 81 | using ToFieldType = typename ToDataType::FieldType; | 785 | 81 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 786 | 81 | const auto* col_from = | 787 | 81 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 788 | 81 | if (!col_from) { | 789 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 790 | 0 | named_from.column->get_name()); | 791 | 0 | } | 792 | | | 793 | 81 | UInt32 from_precision = NumberTraits::max_ascii_len<FromFieldType>(); | 794 | 81 | UInt32 from_scale = 0; | 795 | | | 796 | 81 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 797 | 81 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 798 | 81 | UInt32 to_precision = to_decimal_type.get_precision(); | 799 | 81 | ToDataType::check_type_precision(to_precision); | 800 | 81 | UInt32 to_scale = to_decimal_type.get_scale(); | 801 | 81 | ToDataType::check_type_scale(to_scale); | 802 | | | 803 | 81 | auto from_max_int_digit_count = from_precision - from_scale; | 804 | 81 | auto to_max_int_digit_count = to_precision - to_scale; | 805 | 81 | bool narrow_integral = | 806 | 81 | (to_max_int_digit_count < from_max_int_digit_count) || | 807 | 81 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 808 | | // only in non-strict mode and may overflow, we set nullable | 809 | 81 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 810 | | | 811 | 81 | ColumnUInt8::MutablePtr col_null_map_to = ColumnUInt8::create(input_rows_count, 0); | 812 | 81 | NullMap::value_type* null_map_data = col_null_map_to->get_data().data(); | 813 | | | 814 | 81 | auto col_to = ToDataType::ColumnType::create(input_rows_count, to_scale); | 815 | 81 | const auto& vec_from = col_from->get_data(); | 816 | 81 | const auto* vec_from_data = vec_from.data(); | 817 | 81 | auto& vec_to = col_to->get_data(); | 818 | 81 | auto* vec_to_data = vec_to.data(); | 819 | | | 820 | 81 | CastParameters params; | 821 | 81 | params.is_strict = (CastMode == CastModeType::StrictMode); | 822 | 81 | size_t size = vec_from.size(); | 823 | | | 824 | 81 | typename ToFieldType::NativeType scale_multiplier = | 825 | 81 | DataTypeDecimal<ToFieldType::PType>::get_scale_multiplier(to_scale); | 826 | 81 | typename ToFieldType::NativeType max_result = | 827 | 81 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 828 | 81 | typename ToFieldType::NativeType min_result = -max_result; | 829 | 499 | for (size_t i = 0; i < size; i++) { | 830 | 418 | if (!CastToDecimal::_from_float<typename FromDataType::FieldType, | 831 | 418 | typename ToDataType::FieldType>( | 832 | 418 | vec_from_data[i], vec_to_data[i], to_precision, to_scale, scale_multiplier, | 833 | 418 | min_result, max_result, params)) { | 834 | 18 | if (set_nullable) { | 835 | 18 | null_map_data[i] = 1; | 836 | 18 | } else { | 837 | 0 | return params.status; | 838 | 0 | } | 839 | 18 | } | 840 | 418 | } | 841 | | | 842 | 81 | block.get_by_position(result).column = | 843 | 81 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 844 | 81 | return Status::OK(); | 845 | 81 | } |
|
846 | | }; |
847 | | |
848 | | // cast decimalv3 types to decimalv2 types |
849 | | template <CastModeType CastMode, typename FromDataType, typename ToDataType> |
850 | | requires(IsDataTypeDecimalV3<ToDataType> && IsDataTypeDecimalV2<ToDataType>) |
851 | | class CastToImpl<CastMode, FromDataType, ToDataType> : public CastToBase { |
852 | | public: |
853 | | Status execute_impl(FunctionContext* context, Block& block, const ColumnNumbers& arguments, |
854 | | uint32_t result, size_t input_rows_count, |
855 | | const NullMap::value_type* null_map = nullptr) const override { |
856 | | return Status::RuntimeError( |
857 | | "not support {} ", |
858 | | cast_mode_type_to_string(CastMode, block.get_by_position(arguments[0]).type, |
859 | | block.get_by_position(result).type)); |
860 | | } |
861 | | }; |
862 | | |
863 | | // cast decimalv2 types to decimalv3 types |
864 | | template <CastModeType CastMode, typename FromDataType, typename ToDataType> |
865 | | requires(IsDataTypeDecimalV2<FromDataType> && IsDataTypeDecimalV3<ToDataType>) |
866 | | class CastToImpl<CastMode, FromDataType, ToDataType> : public CastToBase { |
867 | | public: |
868 | | Status execute_impl(FunctionContext* context, Block& block, const ColumnNumbers& arguments, |
869 | | uint32_t result, size_t input_rows_count, |
870 | 608 | const NullMap::value_type* null_map = nullptr) const override { |
871 | 608 | using FromFieldType = typename FromDataType::FieldType; |
872 | 608 | using ToFieldType = typename ToDataType::FieldType; |
873 | 608 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); |
874 | 608 | const auto* col_from = |
875 | 608 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); |
876 | 608 | if (!col_from) { |
877 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", |
878 | 0 | named_from.column->get_name()); |
879 | 0 | } |
880 | | |
881 | 608 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); |
882 | 608 | UInt32 from_precision = from_decimal_type.get_precision(); |
883 | 608 | UInt32 from_scale = from_decimal_type.get_scale(); |
884 | 608 | UInt32 from_original_precision = from_decimal_type.get_original_precision(); |
885 | 608 | UInt32 from_original_scale = from_decimal_type.get_original_scale(); |
886 | | |
887 | 608 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); |
888 | 608 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); |
889 | 608 | UInt32 to_precision = to_decimal_type.get_precision(); |
890 | 608 | ToDataType::check_type_precision(to_precision); |
891 | 608 | UInt32 to_scale = to_decimal_type.get_scale(); |
892 | 608 | ToDataType::check_type_scale(to_scale); |
893 | | |
894 | 608 | auto from_max_int_digit_count = from_original_precision - from_original_scale; |
895 | 608 | auto to_max_int_digit_count = to_precision - to_scale; |
896 | 608 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count) || |
897 | 608 | (to_max_int_digit_count == from_max_int_digit_count && |
898 | 216 | to_scale < from_original_scale); |
899 | | // only in non-strict mode and may overflow, we set nullable |
900 | 608 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; |
901 | | |
902 | 608 | size_t size = col_from->size(); |
903 | 608 | ColumnUInt8::MutablePtr col_null_map_to; |
904 | 608 | NullMap::value_type* null_map_data = nullptr; |
905 | 608 | if (narrow_integral) { |
906 | 410 | col_null_map_to = ColumnUInt8::create(size, 0); |
907 | 410 | null_map_data = col_null_map_to->get_data().data(); |
908 | 410 | } |
909 | 608 | CastParameters params; |
910 | 608 | params.is_strict = (CastMode == CastModeType::StrictMode); |
911 | 608 | auto col_to = ToDataType::ColumnType::create(size, to_scale); |
912 | 608 | const auto& vec_from = col_from->get_data(); |
913 | 608 | const auto* vec_from_data = vec_from.data(); |
914 | 608 | auto& vec_to = col_to->get_data(); |
915 | 608 | auto* vec_to_data = vec_to.data(); |
916 | | |
917 | 608 | using MaxFieldType = |
918 | 608 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && |
919 | 608 | (std::is_same_v<ToFieldType, Decimal128V3> || |
920 | 608 | std::is_same_v<FromFieldType, Decimal128V3>), |
921 | 608 | Decimal128V3, |
922 | 608 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), |
923 | 608 | FromFieldType, ToFieldType>>; |
924 | 608 | using MaxNativeType = typename MaxFieldType::NativeType; |
925 | | |
926 | 608 | constexpr UInt32 to_max_digits = |
927 | 608 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); |
928 | 608 | bool multiply_may_overflow = false; |
929 | 608 | if (to_scale > from_scale) { |
930 | 186 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; |
931 | 186 | } |
932 | | |
933 | 608 | typename ToFieldType::NativeType max_result = |
934 | 608 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); |
935 | 608 | typename ToFieldType::NativeType min_result = -max_result; |
936 | | |
937 | 608 | MaxNativeType multiplier {}; |
938 | 608 | if (from_scale < to_scale) { |
939 | 186 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - |
940 | 186 | from_scale); |
941 | 422 | } else if (from_scale > to_scale) { |
942 | 388 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - |
943 | 388 | to_scale); |
944 | 388 | } |
945 | 608 | RETURN_IF_ERROR(std::visit( |
946 | 608 | [&](auto multiply_may_overflow, auto narrow_integral) { |
947 | 608 | for (size_t i = 0; i < size; i++) { |
948 | 608 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, |
949 | 608 | multiply_may_overflow, narrow_integral>( |
950 | 608 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], |
951 | 608 | to_precision, to_scale, min_result, max_result, multiplier, |
952 | 608 | params)) { |
953 | 608 | if (set_nullable) { |
954 | 608 | null_map_data[i] = 1; |
955 | 608 | } else { |
956 | 608 | return params.status; |
957 | 608 | } |
958 | 608 | } |
959 | 608 | } |
960 | 608 | return Status::OK(); |
961 | 608 | }, |
962 | 608 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); |
963 | 387 | if (narrow_integral) { |
964 | 189 | block.get_by_position(result).column = |
965 | 189 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); |
966 | 198 | } else { |
967 | 198 | block.get_by_position(result).column = std::move(col_to); |
968 | 198 | } |
969 | 387 | return Status::OK(); |
970 | 608 | } _ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEENS2_ILS3_28EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 870 | 87 | const NullMap::value_type* null_map = nullptr) const override { | 871 | 87 | using FromFieldType = typename FromDataType::FieldType; | 872 | 87 | using ToFieldType = typename ToDataType::FieldType; | 873 | 87 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 874 | 87 | const auto* col_from = | 875 | 87 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 876 | 87 | if (!col_from) { | 877 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 878 | 0 | named_from.column->get_name()); | 879 | 0 | } | 880 | | | 881 | 87 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 882 | 87 | UInt32 from_precision = from_decimal_type.get_precision(); | 883 | 87 | UInt32 from_scale = from_decimal_type.get_scale(); | 884 | 87 | UInt32 from_original_precision = from_decimal_type.get_original_precision(); | 885 | 87 | UInt32 from_original_scale = from_decimal_type.get_original_scale(); | 886 | | | 887 | 87 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 888 | 87 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 889 | 87 | UInt32 to_precision = to_decimal_type.get_precision(); | 890 | 87 | ToDataType::check_type_precision(to_precision); | 891 | 87 | UInt32 to_scale = to_decimal_type.get_scale(); | 892 | 87 | ToDataType::check_type_scale(to_scale); | 893 | | | 894 | 87 | auto from_max_int_digit_count = from_original_precision - from_original_scale; | 895 | 87 | auto to_max_int_digit_count = to_precision - to_scale; | 896 | 87 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count) || | 897 | 87 | (to_max_int_digit_count == from_max_int_digit_count && | 898 | 0 | to_scale < from_original_scale); | 899 | | // only in non-strict mode and may overflow, we set nullable | 900 | 87 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 901 | | | 902 | 87 | size_t size = col_from->size(); | 903 | 87 | ColumnUInt8::MutablePtr col_null_map_to; | 904 | 87 | NullMap::value_type* null_map_data = nullptr; | 905 | 87 | if (narrow_integral) { | 906 | 87 | col_null_map_to = ColumnUInt8::create(size, 0); | 907 | 87 | null_map_data = col_null_map_to->get_data().data(); | 908 | 87 | } | 909 | 87 | CastParameters params; | 910 | 87 | params.is_strict = (CastMode == CastModeType::StrictMode); | 911 | 87 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 912 | 87 | const auto& vec_from = col_from->get_data(); | 913 | 87 | const auto* vec_from_data = vec_from.data(); | 914 | 87 | auto& vec_to = col_to->get_data(); | 915 | 87 | auto* vec_to_data = vec_to.data(); | 916 | | | 917 | 87 | using MaxFieldType = | 918 | 87 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 919 | 87 | (std::is_same_v<ToFieldType, Decimal128V3> || | 920 | 87 | std::is_same_v<FromFieldType, Decimal128V3>), | 921 | 87 | Decimal128V3, | 922 | 87 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 923 | 87 | FromFieldType, ToFieldType>>; | 924 | 87 | using MaxNativeType = typename MaxFieldType::NativeType; | 925 | | | 926 | 87 | constexpr UInt32 to_max_digits = | 927 | 87 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 928 | 87 | bool multiply_may_overflow = false; | 929 | 87 | if (to_scale > from_scale) { | 930 | 0 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 931 | 0 | } | 932 | | | 933 | 87 | typename ToFieldType::NativeType max_result = | 934 | 87 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 935 | 87 | typename ToFieldType::NativeType min_result = -max_result; | 936 | | | 937 | 87 | MaxNativeType multiplier {}; | 938 | 87 | if (from_scale < to_scale) { | 939 | 0 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 940 | 0 | from_scale); | 941 | 87 | } else if (from_scale > to_scale) { | 942 | 78 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 943 | 78 | to_scale); | 944 | 78 | } | 945 | 87 | RETURN_IF_ERROR(std::visit( | 946 | 87 | [&](auto multiply_may_overflow, auto narrow_integral) { | 947 | 87 | for (size_t i = 0; i < size; i++) { | 948 | 87 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 949 | 87 | multiply_may_overflow, narrow_integral>( | 950 | 87 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 951 | 87 | to_precision, to_scale, min_result, max_result, multiplier, | 952 | 87 | params)) { | 953 | 87 | if (set_nullable) { | 954 | 87 | null_map_data[i] = 1; | 955 | 87 | } else { | 956 | 87 | return params.status; | 957 | 87 | } | 958 | 87 | } | 959 | 87 | } | 960 | 87 | return Status::OK(); | 961 | 87 | }, | 962 | 87 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 963 | 0 | if (narrow_integral) { | 964 | 0 | block.get_by_position(result).column = | 965 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 966 | 0 | } else { | 967 | 0 | block.get_by_position(result).column = std::move(col_to); | 968 | 0 | } | 969 | 0 | return Status::OK(); | 970 | 87 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEENS2_ILS3_28EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 870 | 74 | const NullMap::value_type* null_map = nullptr) const override { | 871 | 74 | using FromFieldType = typename FromDataType::FieldType; | 872 | 74 | using ToFieldType = typename ToDataType::FieldType; | 873 | 74 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 874 | 74 | const auto* col_from = | 875 | 74 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 876 | 74 | if (!col_from) { | 877 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 878 | 0 | named_from.column->get_name()); | 879 | 0 | } | 880 | | | 881 | 74 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 882 | 74 | UInt32 from_precision = from_decimal_type.get_precision(); | 883 | 74 | UInt32 from_scale = from_decimal_type.get_scale(); | 884 | 74 | UInt32 from_original_precision = from_decimal_type.get_original_precision(); | 885 | 74 | UInt32 from_original_scale = from_decimal_type.get_original_scale(); | 886 | | | 887 | 74 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 888 | 74 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 889 | 74 | UInt32 to_precision = to_decimal_type.get_precision(); | 890 | 74 | ToDataType::check_type_precision(to_precision); | 891 | 74 | UInt32 to_scale = to_decimal_type.get_scale(); | 892 | 74 | ToDataType::check_type_scale(to_scale); | 893 | | | 894 | 74 | auto from_max_int_digit_count = from_original_precision - from_original_scale; | 895 | 74 | auto to_max_int_digit_count = to_precision - to_scale; | 896 | 74 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count) || | 897 | 74 | (to_max_int_digit_count == from_max_int_digit_count && | 898 | 18 | to_scale < from_original_scale); | 899 | | // only in non-strict mode and may overflow, we set nullable | 900 | 74 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 901 | | | 902 | 74 | size_t size = col_from->size(); | 903 | 74 | ColumnUInt8::MutablePtr col_null_map_to; | 904 | 74 | NullMap::value_type* null_map_data = nullptr; | 905 | 74 | if (narrow_integral) { | 906 | 56 | col_null_map_to = ColumnUInt8::create(size, 0); | 907 | 56 | null_map_data = col_null_map_to->get_data().data(); | 908 | 56 | } | 909 | 74 | CastParameters params; | 910 | 74 | params.is_strict = (CastMode == CastModeType::StrictMode); | 911 | 74 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 912 | 74 | const auto& vec_from = col_from->get_data(); | 913 | 74 | const auto* vec_from_data = vec_from.data(); | 914 | 74 | auto& vec_to = col_to->get_data(); | 915 | 74 | auto* vec_to_data = vec_to.data(); | 916 | | | 917 | 74 | using MaxFieldType = | 918 | 74 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 919 | 74 | (std::is_same_v<ToFieldType, Decimal128V3> || | 920 | 74 | std::is_same_v<FromFieldType, Decimal128V3>), | 921 | 74 | Decimal128V3, | 922 | 74 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 923 | 74 | FromFieldType, ToFieldType>>; | 924 | 74 | using MaxNativeType = typename MaxFieldType::NativeType; | 925 | | | 926 | 74 | constexpr UInt32 to_max_digits = | 927 | 74 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 928 | 74 | bool multiply_may_overflow = false; | 929 | 74 | if (to_scale > from_scale) { | 930 | 0 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 931 | 0 | } | 932 | | | 933 | 74 | typename ToFieldType::NativeType max_result = | 934 | 74 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 935 | 74 | typename ToFieldType::NativeType min_result = -max_result; | 936 | | | 937 | 74 | MaxNativeType multiplier {}; | 938 | 74 | if (from_scale < to_scale) { | 939 | 0 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 940 | 0 | from_scale); | 941 | 74 | } else if (from_scale > to_scale) { | 942 | 67 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 943 | 67 | to_scale); | 944 | 67 | } | 945 | 74 | RETURN_IF_ERROR(std::visit( | 946 | 74 | [&](auto multiply_may_overflow, auto narrow_integral) { | 947 | 74 | for (size_t i = 0; i < size; i++) { | 948 | 74 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 949 | 74 | multiply_may_overflow, narrow_integral>( | 950 | 74 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 951 | 74 | to_precision, to_scale, min_result, max_result, multiplier, | 952 | 74 | params)) { | 953 | 74 | if (set_nullable) { | 954 | 74 | null_map_data[i] = 1; | 955 | 74 | } else { | 956 | 74 | return params.status; | 957 | 74 | } | 958 | 74 | } | 959 | 74 | } | 960 | 74 | return Status::OK(); | 961 | 74 | }, | 962 | 74 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 963 | 74 | if (narrow_integral) { | 964 | 56 | block.get_by_position(result).column = | 965 | 56 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 966 | 56 | } else { | 967 | 18 | block.get_by_position(result).column = std::move(col_to); | 968 | 18 | } | 969 | 74 | return Status::OK(); | 970 | 74 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEENS2_ILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 870 | 72 | const NullMap::value_type* null_map = nullptr) const override { | 871 | 72 | using FromFieldType = typename FromDataType::FieldType; | 872 | 72 | using ToFieldType = typename ToDataType::FieldType; | 873 | 72 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 874 | 72 | const auto* col_from = | 875 | 72 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 876 | 72 | if (!col_from) { | 877 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 878 | 0 | named_from.column->get_name()); | 879 | 0 | } | 880 | | | 881 | 72 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 882 | 72 | UInt32 from_precision = from_decimal_type.get_precision(); | 883 | 72 | UInt32 from_scale = from_decimal_type.get_scale(); | 884 | 72 | UInt32 from_original_precision = from_decimal_type.get_original_precision(); | 885 | 72 | UInt32 from_original_scale = from_decimal_type.get_original_scale(); | 886 | | | 887 | 72 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 888 | 72 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 889 | 72 | UInt32 to_precision = to_decimal_type.get_precision(); | 890 | 72 | ToDataType::check_type_precision(to_precision); | 891 | 72 | UInt32 to_scale = to_decimal_type.get_scale(); | 892 | 72 | ToDataType::check_type_scale(to_scale); | 893 | | | 894 | 72 | auto from_max_int_digit_count = from_original_precision - from_original_scale; | 895 | 72 | auto to_max_int_digit_count = to_precision - to_scale; | 896 | 72 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count) || | 897 | 72 | (to_max_int_digit_count == from_max_int_digit_count && | 898 | 2 | to_scale < from_original_scale); | 899 | | // only in non-strict mode and may overflow, we set nullable | 900 | 72 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 901 | | | 902 | 72 | size_t size = col_from->size(); | 903 | 72 | ColumnUInt8::MutablePtr col_null_map_to; | 904 | 72 | NullMap::value_type* null_map_data = nullptr; | 905 | 72 | if (narrow_integral) { | 906 | 72 | col_null_map_to = ColumnUInt8::create(size, 0); | 907 | 72 | null_map_data = col_null_map_to->get_data().data(); | 908 | 72 | } | 909 | 72 | CastParameters params; | 910 | 72 | params.is_strict = (CastMode == CastModeType::StrictMode); | 911 | 72 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 912 | 72 | const auto& vec_from = col_from->get_data(); | 913 | 72 | const auto* vec_from_data = vec_from.data(); | 914 | 72 | auto& vec_to = col_to->get_data(); | 915 | 72 | auto* vec_to_data = vec_to.data(); | 916 | | | 917 | 72 | using MaxFieldType = | 918 | 72 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 919 | 72 | (std::is_same_v<ToFieldType, Decimal128V3> || | 920 | 72 | std::is_same_v<FromFieldType, Decimal128V3>), | 921 | 72 | Decimal128V3, | 922 | 72 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 923 | 72 | FromFieldType, ToFieldType>>; | 924 | 72 | using MaxNativeType = typename MaxFieldType::NativeType; | 925 | | | 926 | 72 | constexpr UInt32 to_max_digits = | 927 | 72 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 928 | 72 | bool multiply_may_overflow = false; | 929 | 72 | if (to_scale > from_scale) { | 930 | 24 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 931 | 24 | } | 932 | | | 933 | 72 | typename ToFieldType::NativeType max_result = | 934 | 72 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 935 | 72 | typename ToFieldType::NativeType min_result = -max_result; | 936 | | | 937 | 72 | MaxNativeType multiplier {}; | 938 | 72 | if (from_scale < to_scale) { | 939 | 24 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 940 | 24 | from_scale); | 941 | 48 | } else if (from_scale > to_scale) { | 942 | 42 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 943 | 42 | to_scale); | 944 | 42 | } | 945 | 72 | RETURN_IF_ERROR(std::visit( | 946 | 72 | [&](auto multiply_may_overflow, auto narrow_integral) { | 947 | 72 | for (size_t i = 0; i < size; i++) { | 948 | 72 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 949 | 72 | multiply_may_overflow, narrow_integral>( | 950 | 72 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 951 | 72 | to_precision, to_scale, min_result, max_result, multiplier, | 952 | 72 | params)) { | 953 | 72 | if (set_nullable) { | 954 | 72 | null_map_data[i] = 1; | 955 | 72 | } else { | 956 | 72 | return params.status; | 957 | 72 | } | 958 | 72 | } | 959 | 72 | } | 960 | 72 | return Status::OK(); | 961 | 72 | }, | 962 | 72 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 963 | 0 | if (narrow_integral) { | 964 | 0 | block.get_by_position(result).column = | 965 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 966 | 0 | } else { | 967 | 0 | block.get_by_position(result).column = std::move(col_to); | 968 | 0 | } | 969 | 0 | return Status::OK(); | 970 | 72 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEENS2_ILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 870 | 108 | const NullMap::value_type* null_map = nullptr) const override { | 871 | 108 | using FromFieldType = typename FromDataType::FieldType; | 872 | 108 | using ToFieldType = typename ToDataType::FieldType; | 873 | 108 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 874 | 108 | const auto* col_from = | 875 | 108 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 876 | 108 | if (!col_from) { | 877 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 878 | 0 | named_from.column->get_name()); | 879 | 0 | } | 880 | | | 881 | 108 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 882 | 108 | UInt32 from_precision = from_decimal_type.get_precision(); | 883 | 108 | UInt32 from_scale = from_decimal_type.get_scale(); | 884 | 108 | UInt32 from_original_precision = from_decimal_type.get_original_precision(); | 885 | 108 | UInt32 from_original_scale = from_decimal_type.get_original_scale(); | 886 | | | 887 | 108 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 888 | 108 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 889 | 108 | UInt32 to_precision = to_decimal_type.get_precision(); | 890 | 108 | ToDataType::check_type_precision(to_precision); | 891 | 108 | UInt32 to_scale = to_decimal_type.get_scale(); | 892 | 108 | ToDataType::check_type_scale(to_scale); | 893 | | | 894 | 108 | auto from_max_int_digit_count = from_original_precision - from_original_scale; | 895 | 108 | auto to_max_int_digit_count = to_precision - to_scale; | 896 | 108 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count) || | 897 | 108 | (to_max_int_digit_count == from_max_int_digit_count && | 898 | 45 | to_scale < from_original_scale); | 899 | | // only in non-strict mode and may overflow, we set nullable | 900 | 108 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 901 | | | 902 | 108 | size_t size = col_from->size(); | 903 | 108 | ColumnUInt8::MutablePtr col_null_map_to; | 904 | 108 | NullMap::value_type* null_map_data = nullptr; | 905 | 108 | if (narrow_integral) { | 906 | 70 | col_null_map_to = ColumnUInt8::create(size, 0); | 907 | 70 | null_map_data = col_null_map_to->get_data().data(); | 908 | 70 | } | 909 | 108 | CastParameters params; | 910 | 108 | params.is_strict = (CastMode == CastModeType::StrictMode); | 911 | 108 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 912 | 108 | const auto& vec_from = col_from->get_data(); | 913 | 108 | const auto* vec_from_data = vec_from.data(); | 914 | 108 | auto& vec_to = col_to->get_data(); | 915 | 108 | auto* vec_to_data = vec_to.data(); | 916 | | | 917 | 108 | using MaxFieldType = | 918 | 108 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 919 | 108 | (std::is_same_v<ToFieldType, Decimal128V3> || | 920 | 108 | std::is_same_v<FromFieldType, Decimal128V3>), | 921 | 108 | Decimal128V3, | 922 | 108 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 923 | 108 | FromFieldType, ToFieldType>>; | 924 | 108 | using MaxNativeType = typename MaxFieldType::NativeType; | 925 | | | 926 | 108 | constexpr UInt32 to_max_digits = | 927 | 108 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 928 | 108 | bool multiply_may_overflow = false; | 929 | 108 | if (to_scale > from_scale) { | 930 | 26 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 931 | 26 | } | 932 | | | 933 | 108 | typename ToFieldType::NativeType max_result = | 934 | 108 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 935 | 108 | typename ToFieldType::NativeType min_result = -max_result; | 936 | | | 937 | 108 | MaxNativeType multiplier {}; | 938 | 108 | if (from_scale < to_scale) { | 939 | 26 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 940 | 26 | from_scale); | 941 | 82 | } else if (from_scale > to_scale) { | 942 | 70 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 943 | 70 | to_scale); | 944 | 70 | } | 945 | 108 | RETURN_IF_ERROR(std::visit( | 946 | 108 | [&](auto multiply_may_overflow, auto narrow_integral) { | 947 | 108 | for (size_t i = 0; i < size; i++) { | 948 | 108 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 949 | 108 | multiply_may_overflow, narrow_integral>( | 950 | 108 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 951 | 108 | to_precision, to_scale, min_result, max_result, multiplier, | 952 | 108 | params)) { | 953 | 108 | if (set_nullable) { | 954 | 108 | null_map_data[i] = 1; | 955 | 108 | } else { | 956 | 108 | return params.status; | 957 | 108 | } | 958 | 108 | } | 959 | 108 | } | 960 | 108 | return Status::OK(); | 961 | 108 | }, | 962 | 108 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 963 | 108 | if (narrow_integral) { | 964 | 70 | block.get_by_position(result).column = | 965 | 70 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 966 | 70 | } else { | 967 | 38 | block.get_by_position(result).column = std::move(col_to); | 968 | 38 | } | 969 | 108 | return Status::OK(); | 970 | 108 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEENS2_ILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 870 | 32 | const NullMap::value_type* null_map = nullptr) const override { | 871 | 32 | using FromFieldType = typename FromDataType::FieldType; | 872 | 32 | using ToFieldType = typename ToDataType::FieldType; | 873 | 32 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 874 | 32 | const auto* col_from = | 875 | 32 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 876 | 32 | if (!col_from) { | 877 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 878 | 0 | named_from.column->get_name()); | 879 | 0 | } | 880 | | | 881 | 32 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 882 | 32 | UInt32 from_precision = from_decimal_type.get_precision(); | 883 | 32 | UInt32 from_scale = from_decimal_type.get_scale(); | 884 | 32 | UInt32 from_original_precision = from_decimal_type.get_original_precision(); | 885 | 32 | UInt32 from_original_scale = from_decimal_type.get_original_scale(); | 886 | | | 887 | 32 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 888 | 32 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 889 | 32 | UInt32 to_precision = to_decimal_type.get_precision(); | 890 | 32 | ToDataType::check_type_precision(to_precision); | 891 | 32 | UInt32 to_scale = to_decimal_type.get_scale(); | 892 | 32 | ToDataType::check_type_scale(to_scale); | 893 | | | 894 | 32 | auto from_max_int_digit_count = from_original_precision - from_original_scale; | 895 | 32 | auto to_max_int_digit_count = to_precision - to_scale; | 896 | 32 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count) || | 897 | 32 | (to_max_int_digit_count == from_max_int_digit_count && | 898 | 2 | to_scale < from_original_scale); | 899 | | // only in non-strict mode and may overflow, we set nullable | 900 | 32 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 901 | | | 902 | 32 | size_t size = col_from->size(); | 903 | 32 | ColumnUInt8::MutablePtr col_null_map_to; | 904 | 32 | NullMap::value_type* null_map_data = nullptr; | 905 | 32 | if (narrow_integral) { | 906 | 32 | col_null_map_to = ColumnUInt8::create(size, 0); | 907 | 32 | null_map_data = col_null_map_to->get_data().data(); | 908 | 32 | } | 909 | 32 | CastParameters params; | 910 | 32 | params.is_strict = (CastMode == CastModeType::StrictMode); | 911 | 32 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 912 | 32 | const auto& vec_from = col_from->get_data(); | 913 | 32 | const auto* vec_from_data = vec_from.data(); | 914 | 32 | auto& vec_to = col_to->get_data(); | 915 | 32 | auto* vec_to_data = vec_to.data(); | 916 | | | 917 | 32 | using MaxFieldType = | 918 | 32 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 919 | 32 | (std::is_same_v<ToFieldType, Decimal128V3> || | 920 | 32 | std::is_same_v<FromFieldType, Decimal128V3>), | 921 | 32 | Decimal128V3, | 922 | 32 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 923 | 32 | FromFieldType, ToFieldType>>; | 924 | 32 | using MaxNativeType = typename MaxFieldType::NativeType; | 925 | | | 926 | 32 | constexpr UInt32 to_max_digits = | 927 | 32 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 928 | 32 | bool multiply_may_overflow = false; | 929 | 32 | if (to_scale > from_scale) { | 930 | 30 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 931 | 30 | } | 932 | | | 933 | 32 | typename ToFieldType::NativeType max_result = | 934 | 32 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 935 | 32 | typename ToFieldType::NativeType min_result = -max_result; | 936 | | | 937 | 32 | MaxNativeType multiplier {}; | 938 | 32 | if (from_scale < to_scale) { | 939 | 30 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 940 | 30 | from_scale); | 941 | 30 | } else if (from_scale > to_scale) { | 942 | 2 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 943 | 2 | to_scale); | 944 | 2 | } | 945 | 32 | RETURN_IF_ERROR(std::visit( | 946 | 32 | [&](auto multiply_may_overflow, auto narrow_integral) { | 947 | 32 | for (size_t i = 0; i < size; i++) { | 948 | 32 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 949 | 32 | multiply_may_overflow, narrow_integral>( | 950 | 32 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 951 | 32 | to_precision, to_scale, min_result, max_result, multiplier, | 952 | 32 | params)) { | 953 | 32 | if (set_nullable) { | 954 | 32 | null_map_data[i] = 1; | 955 | 32 | } else { | 956 | 32 | return params.status; | 957 | 32 | } | 958 | 32 | } | 959 | 32 | } | 960 | 32 | return Status::OK(); | 961 | 32 | }, | 962 | 32 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 963 | 0 | if (narrow_integral) { | 964 | 0 | block.get_by_position(result).column = | 965 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 966 | 0 | } else { | 967 | 0 | block.get_by_position(result).column = std::move(col_to); | 968 | 0 | } | 969 | 0 | return Status::OK(); | 970 | 32 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEENS2_ILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 870 | 103 | const NullMap::value_type* null_map = nullptr) const override { | 871 | 103 | using FromFieldType = typename FromDataType::FieldType; | 872 | 103 | using ToFieldType = typename ToDataType::FieldType; | 873 | 103 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 874 | 103 | const auto* col_from = | 875 | 103 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 876 | 103 | if (!col_from) { | 877 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 878 | 0 | named_from.column->get_name()); | 879 | 0 | } | 880 | | | 881 | 103 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 882 | 103 | UInt32 from_precision = from_decimal_type.get_precision(); | 883 | 103 | UInt32 from_scale = from_decimal_type.get_scale(); | 884 | 103 | UInt32 from_original_precision = from_decimal_type.get_original_precision(); | 885 | 103 | UInt32 from_original_scale = from_decimal_type.get_original_scale(); | 886 | | | 887 | 103 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 888 | 103 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 889 | 103 | UInt32 to_precision = to_decimal_type.get_precision(); | 890 | 103 | ToDataType::check_type_precision(to_precision); | 891 | 103 | UInt32 to_scale = to_decimal_type.get_scale(); | 892 | 103 | ToDataType::check_type_scale(to_scale); | 893 | | | 894 | 103 | auto from_max_int_digit_count = from_original_precision - from_original_scale; | 895 | 103 | auto to_max_int_digit_count = to_precision - to_scale; | 896 | 103 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count) || | 897 | 103 | (to_max_int_digit_count == from_max_int_digit_count && | 898 | 75 | to_scale < from_original_scale); | 899 | | // only in non-strict mode and may overflow, we set nullable | 900 | 103 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 901 | | | 902 | 103 | size_t size = col_from->size(); | 903 | 103 | ColumnUInt8::MutablePtr col_null_map_to; | 904 | 103 | NullMap::value_type* null_map_data = nullptr; | 905 | 103 | if (narrow_integral) { | 906 | 35 | col_null_map_to = ColumnUInt8::create(size, 0); | 907 | 35 | null_map_data = col_null_map_to->get_data().data(); | 908 | 35 | } | 909 | 103 | CastParameters params; | 910 | 103 | params.is_strict = (CastMode == CastModeType::StrictMode); | 911 | 103 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 912 | 103 | const auto& vec_from = col_from->get_data(); | 913 | 103 | const auto* vec_from_data = vec_from.data(); | 914 | 103 | auto& vec_to = col_to->get_data(); | 915 | 103 | auto* vec_to_data = vec_to.data(); | 916 | | | 917 | 103 | using MaxFieldType = | 918 | 103 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 919 | 103 | (std::is_same_v<ToFieldType, Decimal128V3> || | 920 | 103 | std::is_same_v<FromFieldType, Decimal128V3>), | 921 | 103 | Decimal128V3, | 922 | 103 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 923 | 103 | FromFieldType, ToFieldType>>; | 924 | 103 | using MaxNativeType = typename MaxFieldType::NativeType; | 925 | | | 926 | 103 | constexpr UInt32 to_max_digits = | 927 | 103 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 928 | 103 | bool multiply_may_overflow = false; | 929 | 103 | if (to_scale > from_scale) { | 930 | 38 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 931 | 38 | } | 932 | | | 933 | 103 | typename ToFieldType::NativeType max_result = | 934 | 103 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 935 | 103 | typename ToFieldType::NativeType min_result = -max_result; | 936 | | | 937 | 103 | MaxNativeType multiplier {}; | 938 | 103 | if (from_scale < to_scale) { | 939 | 38 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 940 | 38 | from_scale); | 941 | 65 | } else if (from_scale > to_scale) { | 942 | 65 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 943 | 65 | to_scale); | 944 | 65 | } | 945 | 103 | RETURN_IF_ERROR(std::visit( | 946 | 103 | [&](auto multiply_may_overflow, auto narrow_integral) { | 947 | 103 | for (size_t i = 0; i < size; i++) { | 948 | 103 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 949 | 103 | multiply_may_overflow, narrow_integral>( | 950 | 103 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 951 | 103 | to_precision, to_scale, min_result, max_result, multiplier, | 952 | 103 | params)) { | 953 | 103 | if (set_nullable) { | 954 | 103 | null_map_data[i] = 1; | 955 | 103 | } else { | 956 | 103 | return params.status; | 957 | 103 | } | 958 | 103 | } | 959 | 103 | } | 960 | 103 | return Status::OK(); | 961 | 103 | }, | 962 | 103 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 963 | 103 | if (narrow_integral) { | 964 | 35 | block.get_by_position(result).column = | 965 | 35 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 966 | 68 | } else { | 967 | 68 | block.get_by_position(result).column = std::move(col_to); | 968 | 68 | } | 969 | 103 | return Status::OK(); | 970 | 103 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEENS2_ILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 870 | 30 | const NullMap::value_type* null_map = nullptr) const override { | 871 | 30 | using FromFieldType = typename FromDataType::FieldType; | 872 | 30 | using ToFieldType = typename ToDataType::FieldType; | 873 | 30 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 874 | 30 | const auto* col_from = | 875 | 30 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 876 | 30 | if (!col_from) { | 877 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 878 | 0 | named_from.column->get_name()); | 879 | 0 | } | 880 | | | 881 | 30 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 882 | 30 | UInt32 from_precision = from_decimal_type.get_precision(); | 883 | 30 | UInt32 from_scale = from_decimal_type.get_scale(); | 884 | 30 | UInt32 from_original_precision = from_decimal_type.get_original_precision(); | 885 | 30 | UInt32 from_original_scale = from_decimal_type.get_original_scale(); | 886 | | | 887 | 30 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 888 | 30 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 889 | 30 | UInt32 to_precision = to_decimal_type.get_precision(); | 890 | 30 | ToDataType::check_type_precision(to_precision); | 891 | 30 | UInt32 to_scale = to_decimal_type.get_scale(); | 892 | 30 | ToDataType::check_type_scale(to_scale); | 893 | | | 894 | 30 | auto from_max_int_digit_count = from_original_precision - from_original_scale; | 895 | 30 | auto to_max_int_digit_count = to_precision - to_scale; | 896 | 30 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count) || | 897 | 30 | (to_max_int_digit_count == from_max_int_digit_count && | 898 | 0 | to_scale < from_original_scale); | 899 | | // only in non-strict mode and may overflow, we set nullable | 900 | 30 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 901 | | | 902 | 30 | size_t size = col_from->size(); | 903 | 30 | ColumnUInt8::MutablePtr col_null_map_to; | 904 | 30 | NullMap::value_type* null_map_data = nullptr; | 905 | 30 | if (narrow_integral) { | 906 | 30 | col_null_map_to = ColumnUInt8::create(size, 0); | 907 | 30 | null_map_data = col_null_map_to->get_data().data(); | 908 | 30 | } | 909 | 30 | CastParameters params; | 910 | 30 | params.is_strict = (CastMode == CastModeType::StrictMode); | 911 | 30 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 912 | 30 | const auto& vec_from = col_from->get_data(); | 913 | 30 | const auto* vec_from_data = vec_from.data(); | 914 | 30 | auto& vec_to = col_to->get_data(); | 915 | 30 | auto* vec_to_data = vec_to.data(); | 916 | | | 917 | 30 | using MaxFieldType = | 918 | 30 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 919 | 30 | (std::is_same_v<ToFieldType, Decimal128V3> || | 920 | 30 | std::is_same_v<FromFieldType, Decimal128V3>), | 921 | 30 | Decimal128V3, | 922 | 30 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 923 | 30 | FromFieldType, ToFieldType>>; | 924 | 30 | using MaxNativeType = typename MaxFieldType::NativeType; | 925 | | | 926 | 30 | constexpr UInt32 to_max_digits = | 927 | 30 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 928 | 30 | bool multiply_may_overflow = false; | 929 | 30 | if (to_scale > from_scale) { | 930 | 30 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 931 | 30 | } | 932 | | | 933 | 30 | typename ToFieldType::NativeType max_result = | 934 | 30 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 935 | 30 | typename ToFieldType::NativeType min_result = -max_result; | 936 | | | 937 | 30 | MaxNativeType multiplier {}; | 938 | 30 | if (from_scale < to_scale) { | 939 | 30 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 940 | 30 | from_scale); | 941 | 30 | } else if (from_scale > to_scale) { | 942 | 0 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 943 | 0 | to_scale); | 944 | 0 | } | 945 | 30 | RETURN_IF_ERROR(std::visit( | 946 | 30 | [&](auto multiply_may_overflow, auto narrow_integral) { | 947 | 30 | for (size_t i = 0; i < size; i++) { | 948 | 30 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 949 | 30 | multiply_may_overflow, narrow_integral>( | 950 | 30 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 951 | 30 | to_precision, to_scale, min_result, max_result, multiplier, | 952 | 30 | params)) { | 953 | 30 | if (set_nullable) { | 954 | 30 | null_map_data[i] = 1; | 955 | 30 | } else { | 956 | 30 | return params.status; | 957 | 30 | } | 958 | 30 | } | 959 | 30 | } | 960 | 30 | return Status::OK(); | 961 | 30 | }, | 962 | 30 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 963 | 0 | if (narrow_integral) { | 964 | 0 | block.get_by_position(result).column = | 965 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 966 | 0 | } else { | 967 | 0 | block.get_by_position(result).column = std::move(col_to); | 968 | 0 | } | 969 | 0 | return Status::OK(); | 970 | 30 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE20EEENS2_ILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 870 | 102 | const NullMap::value_type* null_map = nullptr) const override { | 871 | 102 | using FromFieldType = typename FromDataType::FieldType; | 872 | 102 | using ToFieldType = typename ToDataType::FieldType; | 873 | 102 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 874 | 102 | const auto* col_from = | 875 | 102 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 876 | 102 | if (!col_from) { | 877 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 878 | 0 | named_from.column->get_name()); | 879 | 0 | } | 880 | | | 881 | 102 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 882 | 102 | UInt32 from_precision = from_decimal_type.get_precision(); | 883 | 102 | UInt32 from_scale = from_decimal_type.get_scale(); | 884 | 102 | UInt32 from_original_precision = from_decimal_type.get_original_precision(); | 885 | 102 | UInt32 from_original_scale = from_decimal_type.get_original_scale(); | 886 | | | 887 | 102 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 888 | 102 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 889 | 102 | UInt32 to_precision = to_decimal_type.get_precision(); | 890 | 102 | ToDataType::check_type_precision(to_precision); | 891 | 102 | UInt32 to_scale = to_decimal_type.get_scale(); | 892 | 102 | ToDataType::check_type_scale(to_scale); | 893 | | | 894 | 102 | auto from_max_int_digit_count = from_original_precision - from_original_scale; | 895 | 102 | auto to_max_int_digit_count = to_precision - to_scale; | 896 | 102 | bool narrow_integral = (to_max_int_digit_count < from_max_int_digit_count) || | 897 | 102 | (to_max_int_digit_count == from_max_int_digit_count && | 898 | 74 | to_scale < from_original_scale); | 899 | | // only in non-strict mode and may overflow, we set nullable | 900 | 102 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 901 | | | 902 | 102 | size_t size = col_from->size(); | 903 | 102 | ColumnUInt8::MutablePtr col_null_map_to; | 904 | 102 | NullMap::value_type* null_map_data = nullptr; | 905 | 102 | if (narrow_integral) { | 906 | 28 | col_null_map_to = ColumnUInt8::create(size, 0); | 907 | 28 | null_map_data = col_null_map_to->get_data().data(); | 908 | 28 | } | 909 | 102 | CastParameters params; | 910 | 102 | params.is_strict = (CastMode == CastModeType::StrictMode); | 911 | 102 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 912 | 102 | const auto& vec_from = col_from->get_data(); | 913 | 102 | const auto* vec_from_data = vec_from.data(); | 914 | 102 | auto& vec_to = col_to->get_data(); | 915 | 102 | auto* vec_to_data = vec_to.data(); | 916 | | | 917 | 102 | using MaxFieldType = | 918 | 102 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 919 | 102 | (std::is_same_v<ToFieldType, Decimal128V3> || | 920 | 102 | std::is_same_v<FromFieldType, Decimal128V3>), | 921 | 102 | Decimal128V3, | 922 | 102 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 923 | 102 | FromFieldType, ToFieldType>>; | 924 | 102 | using MaxNativeType = typename MaxFieldType::NativeType; | 925 | | | 926 | 102 | constexpr UInt32 to_max_digits = | 927 | 102 | NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 928 | 102 | bool multiply_may_overflow = false; | 929 | 102 | if (to_scale > from_scale) { | 930 | 38 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 931 | 38 | } | 932 | | | 933 | 102 | typename ToFieldType::NativeType max_result = | 934 | 102 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 935 | 102 | typename ToFieldType::NativeType min_result = -max_result; | 936 | | | 937 | 102 | MaxNativeType multiplier {}; | 938 | 102 | if (from_scale < to_scale) { | 939 | 38 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 940 | 38 | from_scale); | 941 | 64 | } else if (from_scale > to_scale) { | 942 | 64 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 943 | 64 | to_scale); | 944 | 64 | } | 945 | 102 | RETURN_IF_ERROR(std::visit( | 946 | 102 | [&](auto multiply_may_overflow, auto narrow_integral) { | 947 | 102 | for (size_t i = 0; i < size; i++) { | 948 | 102 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 949 | 102 | multiply_may_overflow, narrow_integral>( | 950 | 102 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 951 | 102 | to_precision, to_scale, min_result, max_result, multiplier, | 952 | 102 | params)) { | 953 | 102 | if (set_nullable) { | 954 | 102 | null_map_data[i] = 1; | 955 | 102 | } else { | 956 | 102 | return params.status; | 957 | 102 | } | 958 | 102 | } | 959 | 102 | } | 960 | 102 | return Status::OK(); | 961 | 102 | }, | 962 | 102 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 963 | 102 | if (narrow_integral) { | 964 | 28 | block.get_by_position(result).column = | 965 | 28 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 966 | 74 | } else { | 967 | 74 | block.get_by_position(result).column = std::move(col_to); | 968 | 74 | } | 969 | 102 | return Status::OK(); | 970 | 102 | } |
|
971 | | }; |
972 | | |
973 | | // cast between decimalv3 types |
974 | | template <CastModeType CastMode, typename FromDataType, typename ToDataType> |
975 | | requires(IsDataTypeDecimalV3<ToDataType> && IsDataTypeDecimalV3<FromDataType>) |
976 | | class CastToImpl<CastMode, FromDataType, ToDataType> : public CastToBase { |
977 | | public: |
978 | | Status execute_impl(FunctionContext* context, Block& block, const ColumnNumbers& arguments, |
979 | | uint32_t result, size_t input_rows_count, |
980 | 4.27k | const NullMap::value_type* null_map = nullptr) const override { |
981 | 4.27k | using FromFieldType = typename FromDataType::FieldType; |
982 | 4.27k | using ToFieldType = typename ToDataType::FieldType; |
983 | 4.27k | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); |
984 | 4.27k | const auto* col_from = |
985 | 4.27k | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); |
986 | 4.27k | if (!col_from) { |
987 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", |
988 | 0 | named_from.column->get_name()); |
989 | 0 | } |
990 | | |
991 | 4.27k | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); |
992 | 4.27k | UInt32 from_precision = from_decimal_type.get_precision(); |
993 | 4.27k | UInt32 from_scale = from_decimal_type.get_scale(); |
994 | | |
995 | 4.27k | const ColumnWithTypeAndName& named_to = block.get_by_position(result); |
996 | 4.27k | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); |
997 | 4.27k | UInt32 to_precision = to_decimal_type.get_precision(); |
998 | 4.27k | ToDataType::check_type_precision(to_precision); |
999 | 4.27k | UInt32 to_scale = to_decimal_type.get_scale(); |
1000 | 4.27k | ToDataType::check_type_scale(to_scale); |
1001 | | |
1002 | 4.27k | auto from_max_int_digit_count = from_precision - from_scale; |
1003 | 4.27k | auto to_max_int_digit_count = to_precision - to_scale; |
1004 | 4.27k | bool narrow_integral = |
1005 | 4.27k | (to_max_int_digit_count < from_max_int_digit_count) || |
1006 | 4.27k | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); |
1007 | | // only in non-strict mode and may overflow, we set nullable |
1008 | 4.27k | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; |
1009 | | |
1010 | 4.27k | size_t size = col_from->size(); |
1011 | 4.27k | ColumnUInt8::MutablePtr col_null_map_to; |
1012 | 4.27k | NullMap::value_type* null_map_data = nullptr; |
1013 | 4.27k | if (narrow_integral) { |
1014 | 3.10k | col_null_map_to = ColumnUInt8::create(size, 0); |
1015 | 3.10k | null_map_data = col_null_map_to->get_data().data(); |
1016 | 3.10k | } |
1017 | 4.27k | CastParameters params; |
1018 | 4.27k | params.is_strict = (CastMode == CastModeType::StrictMode); |
1019 | 4.27k | auto col_to = ToDataType::ColumnType::create(size, to_scale); |
1020 | 4.27k | const auto& vec_from = col_from->get_data(); |
1021 | 4.27k | const auto* vec_from_data = vec_from.data(); |
1022 | 4.27k | auto& vec_to = col_to->get_data(); |
1023 | 4.27k | auto* vec_to_data = vec_to.data(); |
1024 | | |
1025 | 4.27k | using MaxFieldType = |
1026 | 4.27k | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && |
1027 | 4.27k | (std::is_same_v<ToFieldType, Decimal128V3> || |
1028 | 4.27k | std::is_same_v<FromFieldType, Decimal128V3>), |
1029 | 4.27k | Decimal128V3, |
1030 | 4.27k | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), |
1031 | 4.27k | FromFieldType, ToFieldType>>; |
1032 | 4.27k | using MaxNativeType = typename MaxFieldType::NativeType; |
1033 | | |
1034 | 4.27k | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); |
1035 | 4.27k | bool multiply_may_overflow = false; |
1036 | 4.27k | if (to_scale > from_scale) { |
1037 | 1.95k | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; |
1038 | 1.95k | } |
1039 | | |
1040 | 4.27k | typename ToFieldType::NativeType max_result = |
1041 | 4.27k | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); |
1042 | 4.27k | typename ToFieldType::NativeType min_result = -max_result; |
1043 | | |
1044 | 4.27k | MaxNativeType multiplier {}; |
1045 | 4.27k | if (from_scale < to_scale) { |
1046 | 1.95k | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - |
1047 | 1.95k | from_scale); |
1048 | 2.31k | } else if (from_scale > to_scale) { |
1049 | 1.51k | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - |
1050 | 1.51k | to_scale); |
1051 | 1.51k | } |
1052 | 4.27k | RETURN_IF_ERROR(std::visit( |
1053 | 4.27k | [&](auto multiply_may_overflow, auto narrow_integral) { |
1054 | 4.27k | for (size_t i = 0; i < size; i++) { |
1055 | 4.27k | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, |
1056 | 4.27k | multiply_may_overflow, narrow_integral>( |
1057 | 4.27k | vec_from_data[i], from_precision, from_scale, vec_to_data[i], |
1058 | 4.27k | to_precision, to_scale, min_result, max_result, multiplier, |
1059 | 4.27k | params)) { |
1060 | 4.27k | if (set_nullable) { |
1061 | 4.27k | null_map_data[i] = 1; |
1062 | 4.27k | } else { |
1063 | 4.27k | return params.status; |
1064 | 4.27k | } |
1065 | 4.27k | } |
1066 | 4.27k | } |
1067 | 4.27k | return Status::OK(); |
1068 | 4.27k | }, |
1069 | 4.27k | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); |
1070 | 2.77k | if (narrow_integral) { |
1071 | 1.60k | block.get_by_position(result).column = |
1072 | 1.60k | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); |
1073 | 1.60k | } else { |
1074 | 1.17k | block.get_by_position(result).column = std::move(col_to); |
1075 | 1.17k | } |
1076 | 2.77k | return Status::OK(); |
1077 | 4.27k | } _ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEES4_E12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 980 | 53 | const NullMap::value_type* null_map = nullptr) const override { | 981 | 53 | using FromFieldType = typename FromDataType::FieldType; | 982 | 53 | using ToFieldType = typename ToDataType::FieldType; | 983 | 53 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 984 | 53 | const auto* col_from = | 985 | 53 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 986 | 53 | if (!col_from) { | 987 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 988 | 0 | named_from.column->get_name()); | 989 | 0 | } | 990 | | | 991 | 53 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 992 | 53 | UInt32 from_precision = from_decimal_type.get_precision(); | 993 | 53 | UInt32 from_scale = from_decimal_type.get_scale(); | 994 | | | 995 | 53 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 996 | 53 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 997 | 53 | UInt32 to_precision = to_decimal_type.get_precision(); | 998 | 53 | ToDataType::check_type_precision(to_precision); | 999 | 53 | UInt32 to_scale = to_decimal_type.get_scale(); | 1000 | 53 | ToDataType::check_type_scale(to_scale); | 1001 | | | 1002 | 53 | auto from_max_int_digit_count = from_precision - from_scale; | 1003 | 53 | auto to_max_int_digit_count = to_precision - to_scale; | 1004 | 53 | bool narrow_integral = | 1005 | 53 | (to_max_int_digit_count < from_max_int_digit_count) || | 1006 | 53 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1007 | | // only in non-strict mode and may overflow, we set nullable | 1008 | 53 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1009 | | | 1010 | 53 | size_t size = col_from->size(); | 1011 | 53 | ColumnUInt8::MutablePtr col_null_map_to; | 1012 | 53 | NullMap::value_type* null_map_data = nullptr; | 1013 | 53 | if (narrow_integral) { | 1014 | 53 | col_null_map_to = ColumnUInt8::create(size, 0); | 1015 | 53 | null_map_data = col_null_map_to->get_data().data(); | 1016 | 53 | } | 1017 | 53 | CastParameters params; | 1018 | 53 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1019 | 53 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1020 | 53 | const auto& vec_from = col_from->get_data(); | 1021 | 53 | const auto* vec_from_data = vec_from.data(); | 1022 | 53 | auto& vec_to = col_to->get_data(); | 1023 | 53 | auto* vec_to_data = vec_to.data(); | 1024 | | | 1025 | 53 | using MaxFieldType = | 1026 | 53 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1027 | 53 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1028 | 53 | std::is_same_v<FromFieldType, Decimal128V3>), | 1029 | 53 | Decimal128V3, | 1030 | 53 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1031 | 53 | FromFieldType, ToFieldType>>; | 1032 | 53 | using MaxNativeType = typename MaxFieldType::NativeType; | 1033 | | | 1034 | 53 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1035 | 53 | bool multiply_may_overflow = false; | 1036 | 53 | if (to_scale > from_scale) { | 1037 | 27 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1038 | 27 | } | 1039 | | | 1040 | 53 | typename ToFieldType::NativeType max_result = | 1041 | 53 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1042 | 53 | typename ToFieldType::NativeType min_result = -max_result; | 1043 | | | 1044 | 53 | MaxNativeType multiplier {}; | 1045 | 53 | if (from_scale < to_scale) { | 1046 | 27 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1047 | 27 | from_scale); | 1048 | 27 | } else if (from_scale > to_scale) { | 1049 | 20 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1050 | 20 | to_scale); | 1051 | 20 | } | 1052 | 53 | RETURN_IF_ERROR(std::visit( | 1053 | 53 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1054 | 53 | for (size_t i = 0; i < size; i++) { | 1055 | 53 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1056 | 53 | multiply_may_overflow, narrow_integral>( | 1057 | 53 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1058 | 53 | to_precision, to_scale, min_result, max_result, multiplier, | 1059 | 53 | params)) { | 1060 | 53 | if (set_nullable) { | 1061 | 53 | null_map_data[i] = 1; | 1062 | 53 | } else { | 1063 | 53 | return params.status; | 1064 | 53 | } | 1065 | 53 | } | 1066 | 53 | } | 1067 | 53 | return Status::OK(); | 1068 | 53 | }, | 1069 | 53 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1070 | 0 | if (narrow_integral) { | 1071 | 0 | block.get_by_position(result).column = | 1072 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1073 | 0 | } else { | 1074 | 0 | block.get_by_position(result).column = std::move(col_to); | 1075 | 0 | } | 1076 | 0 | return Status::OK(); | 1077 | 53 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEES4_E12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 980 | 75 | const NullMap::value_type* null_map = nullptr) const override { | 981 | 75 | using FromFieldType = typename FromDataType::FieldType; | 982 | 75 | using ToFieldType = typename ToDataType::FieldType; | 983 | 75 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 984 | 75 | const auto* col_from = | 985 | 75 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 986 | 75 | if (!col_from) { | 987 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 988 | 0 | named_from.column->get_name()); | 989 | 0 | } | 990 | | | 991 | 75 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 992 | 75 | UInt32 from_precision = from_decimal_type.get_precision(); | 993 | 75 | UInt32 from_scale = from_decimal_type.get_scale(); | 994 | | | 995 | 75 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 996 | 75 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 997 | 75 | UInt32 to_precision = to_decimal_type.get_precision(); | 998 | 75 | ToDataType::check_type_precision(to_precision); | 999 | 75 | UInt32 to_scale = to_decimal_type.get_scale(); | 1000 | 75 | ToDataType::check_type_scale(to_scale); | 1001 | | | 1002 | 75 | auto from_max_int_digit_count = from_precision - from_scale; | 1003 | 75 | auto to_max_int_digit_count = to_precision - to_scale; | 1004 | 75 | bool narrow_integral = | 1005 | 75 | (to_max_int_digit_count < from_max_int_digit_count) || | 1006 | 75 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1007 | | // only in non-strict mode and may overflow, we set nullable | 1008 | 75 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1009 | | | 1010 | 75 | size_t size = col_from->size(); | 1011 | 75 | ColumnUInt8::MutablePtr col_null_map_to; | 1012 | 75 | NullMap::value_type* null_map_data = nullptr; | 1013 | 75 | if (narrow_integral) { | 1014 | 45 | col_null_map_to = ColumnUInt8::create(size, 0); | 1015 | 45 | null_map_data = col_null_map_to->get_data().data(); | 1016 | 45 | } | 1017 | 75 | CastParameters params; | 1018 | 75 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1019 | 75 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1020 | 75 | const auto& vec_from = col_from->get_data(); | 1021 | 75 | const auto* vec_from_data = vec_from.data(); | 1022 | 75 | auto& vec_to = col_to->get_data(); | 1023 | 75 | auto* vec_to_data = vec_to.data(); | 1024 | | | 1025 | 75 | using MaxFieldType = | 1026 | 75 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1027 | 75 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1028 | 75 | std::is_same_v<FromFieldType, Decimal128V3>), | 1029 | 75 | Decimal128V3, | 1030 | 75 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1031 | 75 | FromFieldType, ToFieldType>>; | 1032 | 75 | using MaxNativeType = typename MaxFieldType::NativeType; | 1033 | | | 1034 | 75 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1035 | 75 | bool multiply_may_overflow = false; | 1036 | 75 | if (to_scale > from_scale) { | 1037 | 35 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1038 | 35 | } | 1039 | | | 1040 | 75 | typename ToFieldType::NativeType max_result = | 1041 | 75 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1042 | 75 | typename ToFieldType::NativeType min_result = -max_result; | 1043 | | | 1044 | 75 | MaxNativeType multiplier {}; | 1045 | 75 | if (from_scale < to_scale) { | 1046 | 35 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1047 | 35 | from_scale); | 1048 | 40 | } else if (from_scale > to_scale) { | 1049 | 30 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1050 | 30 | to_scale); | 1051 | 30 | } | 1052 | 75 | RETURN_IF_ERROR(std::visit( | 1053 | 75 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1054 | 75 | for (size_t i = 0; i < size; i++) { | 1055 | 75 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1056 | 75 | multiply_may_overflow, narrow_integral>( | 1057 | 75 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1058 | 75 | to_precision, to_scale, min_result, max_result, multiplier, | 1059 | 75 | params)) { | 1060 | 75 | if (set_nullable) { | 1061 | 75 | null_map_data[i] = 1; | 1062 | 75 | } else { | 1063 | 75 | return params.status; | 1064 | 75 | } | 1065 | 75 | } | 1066 | 75 | } | 1067 | 75 | return Status::OK(); | 1068 | 75 | }, | 1069 | 75 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1070 | 75 | if (narrow_integral) { | 1071 | 45 | block.get_by_position(result).column = | 1072 | 45 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1073 | 45 | } else { | 1074 | 30 | block.get_by_position(result).column = std::move(col_to); | 1075 | 30 | } | 1076 | 75 | return Status::OK(); | 1077 | 75 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEENS2_ILS3_28EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 980 | 129 | const NullMap::value_type* null_map = nullptr) const override { | 981 | 129 | using FromFieldType = typename FromDataType::FieldType; | 982 | 129 | using ToFieldType = typename ToDataType::FieldType; | 983 | 129 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 984 | 129 | const auto* col_from = | 985 | 129 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 986 | 129 | if (!col_from) { | 987 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 988 | 0 | named_from.column->get_name()); | 989 | 0 | } | 990 | | | 991 | 129 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 992 | 129 | UInt32 from_precision = from_decimal_type.get_precision(); | 993 | 129 | UInt32 from_scale = from_decimal_type.get_scale(); | 994 | | | 995 | 129 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 996 | 129 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 997 | 129 | UInt32 to_precision = to_decimal_type.get_precision(); | 998 | 129 | ToDataType::check_type_precision(to_precision); | 999 | 129 | UInt32 to_scale = to_decimal_type.get_scale(); | 1000 | 129 | ToDataType::check_type_scale(to_scale); | 1001 | | | 1002 | 129 | auto from_max_int_digit_count = from_precision - from_scale; | 1003 | 129 | auto to_max_int_digit_count = to_precision - to_scale; | 1004 | 129 | bool narrow_integral = | 1005 | 129 | (to_max_int_digit_count < from_max_int_digit_count) || | 1006 | 129 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1007 | | // only in non-strict mode and may overflow, we set nullable | 1008 | 129 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1009 | | | 1010 | 129 | size_t size = col_from->size(); | 1011 | 129 | ColumnUInt8::MutablePtr col_null_map_to; | 1012 | 129 | NullMap::value_type* null_map_data = nullptr; | 1013 | 129 | if (narrow_integral) { | 1014 | 129 | col_null_map_to = ColumnUInt8::create(size, 0); | 1015 | 129 | null_map_data = col_null_map_to->get_data().data(); | 1016 | 129 | } | 1017 | 129 | CastParameters params; | 1018 | 129 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1019 | 129 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1020 | 129 | const auto& vec_from = col_from->get_data(); | 1021 | 129 | const auto* vec_from_data = vec_from.data(); | 1022 | 129 | auto& vec_to = col_to->get_data(); | 1023 | 129 | auto* vec_to_data = vec_to.data(); | 1024 | | | 1025 | 129 | using MaxFieldType = | 1026 | 129 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1027 | 129 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1028 | 129 | std::is_same_v<FromFieldType, Decimal128V3>), | 1029 | 129 | Decimal128V3, | 1030 | 129 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1031 | 129 | FromFieldType, ToFieldType>>; | 1032 | 129 | using MaxNativeType = typename MaxFieldType::NativeType; | 1033 | | | 1034 | 129 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1035 | 129 | bool multiply_may_overflow = false; | 1036 | 129 | if (to_scale > from_scale) { | 1037 | 36 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1038 | 36 | } | 1039 | | | 1040 | 129 | typename ToFieldType::NativeType max_result = | 1041 | 129 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1042 | 129 | typename ToFieldType::NativeType min_result = -max_result; | 1043 | | | 1044 | 129 | MaxNativeType multiplier {}; | 1045 | 129 | if (from_scale < to_scale) { | 1046 | 36 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1047 | 36 | from_scale); | 1048 | 93 | } else if (from_scale > to_scale) { | 1049 | 66 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1050 | 66 | to_scale); | 1051 | 66 | } | 1052 | 129 | RETURN_IF_ERROR(std::visit( | 1053 | 129 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1054 | 129 | for (size_t i = 0; i < size; i++) { | 1055 | 129 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1056 | 129 | multiply_may_overflow, narrow_integral>( | 1057 | 129 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1058 | 129 | to_precision, to_scale, min_result, max_result, multiplier, | 1059 | 129 | params)) { | 1060 | 129 | if (set_nullable) { | 1061 | 129 | null_map_data[i] = 1; | 1062 | 129 | } else { | 1063 | 129 | return params.status; | 1064 | 129 | } | 1065 | 129 | } | 1066 | 129 | } | 1067 | 129 | return Status::OK(); | 1068 | 129 | }, | 1069 | 129 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1070 | 0 | if (narrow_integral) { | 1071 | 0 | block.get_by_position(result).column = | 1072 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1073 | 0 | } else { | 1074 | 0 | block.get_by_position(result).column = std::move(col_to); | 1075 | 0 | } | 1076 | 0 | return Status::OK(); | 1077 | 129 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEENS2_ILS3_28EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 980 | 156 | const NullMap::value_type* null_map = nullptr) const override { | 981 | 156 | using FromFieldType = typename FromDataType::FieldType; | 982 | 156 | using ToFieldType = typename ToDataType::FieldType; | 983 | 156 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 984 | 156 | const auto* col_from = | 985 | 156 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 986 | 156 | if (!col_from) { | 987 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 988 | 0 | named_from.column->get_name()); | 989 | 0 | } | 990 | | | 991 | 156 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 992 | 156 | UInt32 from_precision = from_decimal_type.get_precision(); | 993 | 156 | UInt32 from_scale = from_decimal_type.get_scale(); | 994 | | | 995 | 156 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 996 | 156 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 997 | 156 | UInt32 to_precision = to_decimal_type.get_precision(); | 998 | 156 | ToDataType::check_type_precision(to_precision); | 999 | 156 | UInt32 to_scale = to_decimal_type.get_scale(); | 1000 | 156 | ToDataType::check_type_scale(to_scale); | 1001 | | | 1002 | 156 | auto from_max_int_digit_count = from_precision - from_scale; | 1003 | 156 | auto to_max_int_digit_count = to_precision - to_scale; | 1004 | 156 | bool narrow_integral = | 1005 | 156 | (to_max_int_digit_count < from_max_int_digit_count) || | 1006 | 156 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1007 | | // only in non-strict mode and may overflow, we set nullable | 1008 | 156 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1009 | | | 1010 | 156 | size_t size = col_from->size(); | 1011 | 156 | ColumnUInt8::MutablePtr col_null_map_to; | 1012 | 156 | NullMap::value_type* null_map_data = nullptr; | 1013 | 156 | if (narrow_integral) { | 1014 | 136 | col_null_map_to = ColumnUInt8::create(size, 0); | 1015 | 136 | null_map_data = col_null_map_to->get_data().data(); | 1016 | 136 | } | 1017 | 156 | CastParameters params; | 1018 | 156 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1019 | 156 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1020 | 156 | const auto& vec_from = col_from->get_data(); | 1021 | 156 | const auto* vec_from_data = vec_from.data(); | 1022 | 156 | auto& vec_to = col_to->get_data(); | 1023 | 156 | auto* vec_to_data = vec_to.data(); | 1024 | | | 1025 | 156 | using MaxFieldType = | 1026 | 156 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1027 | 156 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1028 | 156 | std::is_same_v<FromFieldType, Decimal128V3>), | 1029 | 156 | Decimal128V3, | 1030 | 156 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1031 | 156 | FromFieldType, ToFieldType>>; | 1032 | 156 | using MaxNativeType = typename MaxFieldType::NativeType; | 1033 | | | 1034 | 156 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1035 | 156 | bool multiply_may_overflow = false; | 1036 | 156 | if (to_scale > from_scale) { | 1037 | 42 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1038 | 42 | } | 1039 | | | 1040 | 156 | typename ToFieldType::NativeType max_result = | 1041 | 156 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1042 | 156 | typename ToFieldType::NativeType min_result = -max_result; | 1043 | | | 1044 | 156 | MaxNativeType multiplier {}; | 1045 | 156 | if (from_scale < to_scale) { | 1046 | 42 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1047 | 42 | from_scale); | 1048 | 114 | } else if (from_scale > to_scale) { | 1049 | 72 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1050 | 72 | to_scale); | 1051 | 72 | } | 1052 | 156 | RETURN_IF_ERROR(std::visit( | 1053 | 156 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1054 | 156 | for (size_t i = 0; i < size; i++) { | 1055 | 156 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1056 | 156 | multiply_may_overflow, narrow_integral>( | 1057 | 156 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1058 | 156 | to_precision, to_scale, min_result, max_result, multiplier, | 1059 | 156 | params)) { | 1060 | 156 | if (set_nullable) { | 1061 | 156 | null_map_data[i] = 1; | 1062 | 156 | } else { | 1063 | 156 | return params.status; | 1064 | 156 | } | 1065 | 156 | } | 1066 | 156 | } | 1067 | 156 | return Status::OK(); | 1068 | 156 | }, | 1069 | 156 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1070 | 156 | if (narrow_integral) { | 1071 | 136 | block.get_by_position(result).column = | 1072 | 136 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1073 | 136 | } else { | 1074 | 20 | block.get_by_position(result).column = std::move(col_to); | 1075 | 20 | } | 1076 | 156 | return Status::OK(); | 1077 | 156 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEENS2_ILS3_28EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 980 | 140 | const NullMap::value_type* null_map = nullptr) const override { | 981 | 140 | using FromFieldType = typename FromDataType::FieldType; | 982 | 140 | using ToFieldType = typename ToDataType::FieldType; | 983 | 140 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 984 | 140 | const auto* col_from = | 985 | 140 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 986 | 140 | if (!col_from) { | 987 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 988 | 0 | named_from.column->get_name()); | 989 | 0 | } | 990 | | | 991 | 140 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 992 | 140 | UInt32 from_precision = from_decimal_type.get_precision(); | 993 | 140 | UInt32 from_scale = from_decimal_type.get_scale(); | 994 | | | 995 | 140 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 996 | 140 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 997 | 140 | UInt32 to_precision = to_decimal_type.get_precision(); | 998 | 140 | ToDataType::check_type_precision(to_precision); | 999 | 140 | UInt32 to_scale = to_decimal_type.get_scale(); | 1000 | 140 | ToDataType::check_type_scale(to_scale); | 1001 | | | 1002 | 140 | auto from_max_int_digit_count = from_precision - from_scale; | 1003 | 140 | auto to_max_int_digit_count = to_precision - to_scale; | 1004 | 140 | bool narrow_integral = | 1005 | 140 | (to_max_int_digit_count < from_max_int_digit_count) || | 1006 | 140 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1007 | | // only in non-strict mode and may overflow, we set nullable | 1008 | 140 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1009 | | | 1010 | 140 | size_t size = col_from->size(); | 1011 | 140 | ColumnUInt8::MutablePtr col_null_map_to; | 1012 | 140 | NullMap::value_type* null_map_data = nullptr; | 1013 | 140 | if (narrow_integral) { | 1014 | 140 | col_null_map_to = ColumnUInt8::create(size, 0); | 1015 | 140 | null_map_data = col_null_map_to->get_data().data(); | 1016 | 140 | } | 1017 | 140 | CastParameters params; | 1018 | 140 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1019 | 140 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1020 | 140 | const auto& vec_from = col_from->get_data(); | 1021 | 140 | const auto* vec_from_data = vec_from.data(); | 1022 | 140 | auto& vec_to = col_to->get_data(); | 1023 | 140 | auto* vec_to_data = vec_to.data(); | 1024 | | | 1025 | 140 | using MaxFieldType = | 1026 | 140 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1027 | 140 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1028 | 140 | std::is_same_v<FromFieldType, Decimal128V3>), | 1029 | 140 | Decimal128V3, | 1030 | 140 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1031 | 140 | FromFieldType, ToFieldType>>; | 1032 | 140 | using MaxNativeType = typename MaxFieldType::NativeType; | 1033 | | | 1034 | 140 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1035 | 140 | bool multiply_may_overflow = false; | 1036 | 140 | if (to_scale > from_scale) { | 1037 | 36 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1038 | 36 | } | 1039 | | | 1040 | 140 | typename ToFieldType::NativeType max_result = | 1041 | 140 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1042 | 140 | typename ToFieldType::NativeType min_result = -max_result; | 1043 | | | 1044 | 140 | MaxNativeType multiplier {}; | 1045 | 140 | if (from_scale < to_scale) { | 1046 | 36 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1047 | 36 | from_scale); | 1048 | 104 | } else if (from_scale > to_scale) { | 1049 | 80 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1050 | 80 | to_scale); | 1051 | 80 | } | 1052 | 140 | RETURN_IF_ERROR(std::visit( | 1053 | 140 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1054 | 140 | for (size_t i = 0; i < size; i++) { | 1055 | 140 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1056 | 140 | multiply_may_overflow, narrow_integral>( | 1057 | 140 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1058 | 140 | to_precision, to_scale, min_result, max_result, multiplier, | 1059 | 140 | params)) { | 1060 | 140 | if (set_nullable) { | 1061 | 140 | null_map_data[i] = 1; | 1062 | 140 | } else { | 1063 | 140 | return params.status; | 1064 | 140 | } | 1065 | 140 | } | 1066 | 140 | } | 1067 | 140 | return Status::OK(); | 1068 | 140 | }, | 1069 | 140 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1070 | 0 | if (narrow_integral) { | 1071 | 0 | block.get_by_position(result).column = | 1072 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1073 | 0 | } else { | 1074 | 0 | block.get_by_position(result).column = std::move(col_to); | 1075 | 0 | } | 1076 | 0 | return Status::OK(); | 1077 | 140 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEENS2_ILS3_28EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 980 | 156 | const NullMap::value_type* null_map = nullptr) const override { | 981 | 156 | using FromFieldType = typename FromDataType::FieldType; | 982 | 156 | using ToFieldType = typename ToDataType::FieldType; | 983 | 156 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 984 | 156 | const auto* col_from = | 985 | 156 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 986 | 156 | if (!col_from) { | 987 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 988 | 0 | named_from.column->get_name()); | 989 | 0 | } | 990 | | | 991 | 156 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 992 | 156 | UInt32 from_precision = from_decimal_type.get_precision(); | 993 | 156 | UInt32 from_scale = from_decimal_type.get_scale(); | 994 | | | 995 | 156 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 996 | 156 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 997 | 156 | UInt32 to_precision = to_decimal_type.get_precision(); | 998 | 156 | ToDataType::check_type_precision(to_precision); | 999 | 156 | UInt32 to_scale = to_decimal_type.get_scale(); | 1000 | 156 | ToDataType::check_type_scale(to_scale); | 1001 | | | 1002 | 156 | auto from_max_int_digit_count = from_precision - from_scale; | 1003 | 156 | auto to_max_int_digit_count = to_precision - to_scale; | 1004 | 156 | bool narrow_integral = | 1005 | 156 | (to_max_int_digit_count < from_max_int_digit_count) || | 1006 | 156 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1007 | | // only in non-strict mode and may overflow, we set nullable | 1008 | 156 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1009 | | | 1010 | 156 | size_t size = col_from->size(); | 1011 | 156 | ColumnUInt8::MutablePtr col_null_map_to; | 1012 | 156 | NullMap::value_type* null_map_data = nullptr; | 1013 | 156 | if (narrow_integral) { | 1014 | 136 | col_null_map_to = ColumnUInt8::create(size, 0); | 1015 | 136 | null_map_data = col_null_map_to->get_data().data(); | 1016 | 136 | } | 1017 | 156 | CastParameters params; | 1018 | 156 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1019 | 156 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1020 | 156 | const auto& vec_from = col_from->get_data(); | 1021 | 156 | const auto* vec_from_data = vec_from.data(); | 1022 | 156 | auto& vec_to = col_to->get_data(); | 1023 | 156 | auto* vec_to_data = vec_to.data(); | 1024 | | | 1025 | 156 | using MaxFieldType = | 1026 | 156 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1027 | 156 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1028 | 156 | std::is_same_v<FromFieldType, Decimal128V3>), | 1029 | 156 | Decimal128V3, | 1030 | 156 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1031 | 156 | FromFieldType, ToFieldType>>; | 1032 | 156 | using MaxNativeType = typename MaxFieldType::NativeType; | 1033 | | | 1034 | 156 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1035 | 156 | bool multiply_may_overflow = false; | 1036 | 156 | if (to_scale > from_scale) { | 1037 | 42 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1038 | 42 | } | 1039 | | | 1040 | 156 | typename ToFieldType::NativeType max_result = | 1041 | 156 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1042 | 156 | typename ToFieldType::NativeType min_result = -max_result; | 1043 | | | 1044 | 156 | MaxNativeType multiplier {}; | 1045 | 156 | if (from_scale < to_scale) { | 1046 | 42 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1047 | 42 | from_scale); | 1048 | 114 | } else if (from_scale > to_scale) { | 1049 | 74 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1050 | 74 | to_scale); | 1051 | 74 | } | 1052 | 156 | RETURN_IF_ERROR(std::visit( | 1053 | 156 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1054 | 156 | for (size_t i = 0; i < size; i++) { | 1055 | 156 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1056 | 156 | multiply_may_overflow, narrow_integral>( | 1057 | 156 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1058 | 156 | to_precision, to_scale, min_result, max_result, multiplier, | 1059 | 156 | params)) { | 1060 | 156 | if (set_nullable) { | 1061 | 156 | null_map_data[i] = 1; | 1062 | 156 | } else { | 1063 | 156 | return params.status; | 1064 | 156 | } | 1065 | 156 | } | 1066 | 156 | } | 1067 | 156 | return Status::OK(); | 1068 | 156 | }, | 1069 | 156 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1070 | 156 | if (narrow_integral) { | 1071 | 136 | block.get_by_position(result).column = | 1072 | 136 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1073 | 136 | } else { | 1074 | 20 | block.get_by_position(result).column = std::move(col_to); | 1075 | 20 | } | 1076 | 156 | return Status::OK(); | 1077 | 156 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEENS2_ILS3_28EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 980 | 140 | const NullMap::value_type* null_map = nullptr) const override { | 981 | 140 | using FromFieldType = typename FromDataType::FieldType; | 982 | 140 | using ToFieldType = typename ToDataType::FieldType; | 983 | 140 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 984 | 140 | const auto* col_from = | 985 | 140 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 986 | 140 | if (!col_from) { | 987 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 988 | 0 | named_from.column->get_name()); | 989 | 0 | } | 990 | | | 991 | 140 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 992 | 140 | UInt32 from_precision = from_decimal_type.get_precision(); | 993 | 140 | UInt32 from_scale = from_decimal_type.get_scale(); | 994 | | | 995 | 140 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 996 | 140 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 997 | 140 | UInt32 to_precision = to_decimal_type.get_precision(); | 998 | 140 | ToDataType::check_type_precision(to_precision); | 999 | 140 | UInt32 to_scale = to_decimal_type.get_scale(); | 1000 | 140 | ToDataType::check_type_scale(to_scale); | 1001 | | | 1002 | 140 | auto from_max_int_digit_count = from_precision - from_scale; | 1003 | 140 | auto to_max_int_digit_count = to_precision - to_scale; | 1004 | 140 | bool narrow_integral = | 1005 | 140 | (to_max_int_digit_count < from_max_int_digit_count) || | 1006 | 140 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1007 | | // only in non-strict mode and may overflow, we set nullable | 1008 | 140 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1009 | | | 1010 | 140 | size_t size = col_from->size(); | 1011 | 140 | ColumnUInt8::MutablePtr col_null_map_to; | 1012 | 140 | NullMap::value_type* null_map_data = nullptr; | 1013 | 140 | if (narrow_integral) { | 1014 | 140 | col_null_map_to = ColumnUInt8::create(size, 0); | 1015 | 140 | null_map_data = col_null_map_to->get_data().data(); | 1016 | 140 | } | 1017 | 140 | CastParameters params; | 1018 | 140 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1019 | 140 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1020 | 140 | const auto& vec_from = col_from->get_data(); | 1021 | 140 | const auto* vec_from_data = vec_from.data(); | 1022 | 140 | auto& vec_to = col_to->get_data(); | 1023 | 140 | auto* vec_to_data = vec_to.data(); | 1024 | | | 1025 | 140 | using MaxFieldType = | 1026 | 140 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1027 | 140 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1028 | 140 | std::is_same_v<FromFieldType, Decimal128V3>), | 1029 | 140 | Decimal128V3, | 1030 | 140 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1031 | 140 | FromFieldType, ToFieldType>>; | 1032 | 140 | using MaxNativeType = typename MaxFieldType::NativeType; | 1033 | | | 1034 | 140 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1035 | 140 | bool multiply_may_overflow = false; | 1036 | 140 | if (to_scale > from_scale) { | 1037 | 36 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1038 | 36 | } | 1039 | | | 1040 | 140 | typename ToFieldType::NativeType max_result = | 1041 | 140 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1042 | 140 | typename ToFieldType::NativeType min_result = -max_result; | 1043 | | | 1044 | 140 | MaxNativeType multiplier {}; | 1045 | 140 | if (from_scale < to_scale) { | 1046 | 36 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1047 | 36 | from_scale); | 1048 | 104 | } else if (from_scale > to_scale) { | 1049 | 80 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1050 | 80 | to_scale); | 1051 | 80 | } | 1052 | 140 | RETURN_IF_ERROR(std::visit( | 1053 | 140 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1054 | 140 | for (size_t i = 0; i < size; i++) { | 1055 | 140 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1056 | 140 | multiply_may_overflow, narrow_integral>( | 1057 | 140 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1058 | 140 | to_precision, to_scale, min_result, max_result, multiplier, | 1059 | 140 | params)) { | 1060 | 140 | if (set_nullable) { | 1061 | 140 | null_map_data[i] = 1; | 1062 | 140 | } else { | 1063 | 140 | return params.status; | 1064 | 140 | } | 1065 | 140 | } | 1066 | 140 | } | 1067 | 140 | return Status::OK(); | 1068 | 140 | }, | 1069 | 140 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1070 | 0 | if (narrow_integral) { | 1071 | 0 | block.get_by_position(result).column = | 1072 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1073 | 0 | } else { | 1074 | 0 | block.get_by_position(result).column = std::move(col_to); | 1075 | 0 | } | 1076 | 0 | return Status::OK(); | 1077 | 140 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEENS2_ILS3_28EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 980 | 156 | const NullMap::value_type* null_map = nullptr) const override { | 981 | 156 | using FromFieldType = typename FromDataType::FieldType; | 982 | 156 | using ToFieldType = typename ToDataType::FieldType; | 983 | 156 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 984 | 156 | const auto* col_from = | 985 | 156 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 986 | 156 | if (!col_from) { | 987 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 988 | 0 | named_from.column->get_name()); | 989 | 0 | } | 990 | | | 991 | 156 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 992 | 156 | UInt32 from_precision = from_decimal_type.get_precision(); | 993 | 156 | UInt32 from_scale = from_decimal_type.get_scale(); | 994 | | | 995 | 156 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 996 | 156 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 997 | 156 | UInt32 to_precision = to_decimal_type.get_precision(); | 998 | 156 | ToDataType::check_type_precision(to_precision); | 999 | 156 | UInt32 to_scale = to_decimal_type.get_scale(); | 1000 | 156 | ToDataType::check_type_scale(to_scale); | 1001 | | | 1002 | 156 | auto from_max_int_digit_count = from_precision - from_scale; | 1003 | 156 | auto to_max_int_digit_count = to_precision - to_scale; | 1004 | 156 | bool narrow_integral = | 1005 | 156 | (to_max_int_digit_count < from_max_int_digit_count) || | 1006 | 156 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1007 | | // only in non-strict mode and may overflow, we set nullable | 1008 | 156 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1009 | | | 1010 | 156 | size_t size = col_from->size(); | 1011 | 156 | ColumnUInt8::MutablePtr col_null_map_to; | 1012 | 156 | NullMap::value_type* null_map_data = nullptr; | 1013 | 156 | if (narrow_integral) { | 1014 | 136 | col_null_map_to = ColumnUInt8::create(size, 0); | 1015 | 136 | null_map_data = col_null_map_to->get_data().data(); | 1016 | 136 | } | 1017 | 156 | CastParameters params; | 1018 | 156 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1019 | 156 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1020 | 156 | const auto& vec_from = col_from->get_data(); | 1021 | 156 | const auto* vec_from_data = vec_from.data(); | 1022 | 156 | auto& vec_to = col_to->get_data(); | 1023 | 156 | auto* vec_to_data = vec_to.data(); | 1024 | | | 1025 | 156 | using MaxFieldType = | 1026 | 156 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1027 | 156 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1028 | 156 | std::is_same_v<FromFieldType, Decimal128V3>), | 1029 | 156 | Decimal128V3, | 1030 | 156 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1031 | 156 | FromFieldType, ToFieldType>>; | 1032 | 156 | using MaxNativeType = typename MaxFieldType::NativeType; | 1033 | | | 1034 | 156 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1035 | 156 | bool multiply_may_overflow = false; | 1036 | 156 | if (to_scale > from_scale) { | 1037 | 42 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1038 | 42 | } | 1039 | | | 1040 | 156 | typename ToFieldType::NativeType max_result = | 1041 | 156 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1042 | 156 | typename ToFieldType::NativeType min_result = -max_result; | 1043 | | | 1044 | 156 | MaxNativeType multiplier {}; | 1045 | 156 | if (from_scale < to_scale) { | 1046 | 42 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1047 | 42 | from_scale); | 1048 | 114 | } else if (from_scale > to_scale) { | 1049 | 74 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1050 | 74 | to_scale); | 1051 | 74 | } | 1052 | 156 | RETURN_IF_ERROR(std::visit( | 1053 | 156 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1054 | 156 | for (size_t i = 0; i < size; i++) { | 1055 | 156 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1056 | 156 | multiply_may_overflow, narrow_integral>( | 1057 | 156 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1058 | 156 | to_precision, to_scale, min_result, max_result, multiplier, | 1059 | 156 | params)) { | 1060 | 156 | if (set_nullable) { | 1061 | 156 | null_map_data[i] = 1; | 1062 | 156 | } else { | 1063 | 156 | return params.status; | 1064 | 156 | } | 1065 | 156 | } | 1066 | 156 | } | 1067 | 156 | return Status::OK(); | 1068 | 156 | }, | 1069 | 156 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1070 | 156 | if (narrow_integral) { | 1071 | 136 | block.get_by_position(result).column = | 1072 | 136 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1073 | 136 | } else { | 1074 | 20 | block.get_by_position(result).column = std::move(col_to); | 1075 | 20 | } | 1076 | 156 | return Status::OK(); | 1077 | 156 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEENS2_ILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 980 | 36 | const NullMap::value_type* null_map = nullptr) const override { | 981 | 36 | using FromFieldType = typename FromDataType::FieldType; | 982 | 36 | using ToFieldType = typename ToDataType::FieldType; | 983 | 36 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 984 | 36 | const auto* col_from = | 985 | 36 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 986 | 36 | if (!col_from) { | 987 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 988 | 0 | named_from.column->get_name()); | 989 | 0 | } | 990 | | | 991 | 36 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 992 | 36 | UInt32 from_precision = from_decimal_type.get_precision(); | 993 | 36 | UInt32 from_scale = from_decimal_type.get_scale(); | 994 | | | 995 | 36 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 996 | 36 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 997 | 36 | UInt32 to_precision = to_decimal_type.get_precision(); | 998 | 36 | ToDataType::check_type_precision(to_precision); | 999 | 36 | UInt32 to_scale = to_decimal_type.get_scale(); | 1000 | 36 | ToDataType::check_type_scale(to_scale); | 1001 | | | 1002 | 36 | auto from_max_int_digit_count = from_precision - from_scale; | 1003 | 36 | auto to_max_int_digit_count = to_precision - to_scale; | 1004 | 36 | bool narrow_integral = | 1005 | 36 | (to_max_int_digit_count < from_max_int_digit_count) || | 1006 | 36 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1007 | | // only in non-strict mode and may overflow, we set nullable | 1008 | 36 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1009 | | | 1010 | 36 | size_t size = col_from->size(); | 1011 | 36 | ColumnUInt8::MutablePtr col_null_map_to; | 1012 | 36 | NullMap::value_type* null_map_data = nullptr; | 1013 | 36 | if (narrow_integral) { | 1014 | 36 | col_null_map_to = ColumnUInt8::create(size, 0); | 1015 | 36 | null_map_data = col_null_map_to->get_data().data(); | 1016 | 36 | } | 1017 | 36 | CastParameters params; | 1018 | 36 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1019 | 36 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1020 | 36 | const auto& vec_from = col_from->get_data(); | 1021 | 36 | const auto* vec_from_data = vec_from.data(); | 1022 | 36 | auto& vec_to = col_to->get_data(); | 1023 | 36 | auto* vec_to_data = vec_to.data(); | 1024 | | | 1025 | 36 | using MaxFieldType = | 1026 | 36 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1027 | 36 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1028 | 36 | std::is_same_v<FromFieldType, Decimal128V3>), | 1029 | 36 | Decimal128V3, | 1030 | 36 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1031 | 36 | FromFieldType, ToFieldType>>; | 1032 | 36 | using MaxNativeType = typename MaxFieldType::NativeType; | 1033 | | | 1034 | 36 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1035 | 36 | bool multiply_may_overflow = false; | 1036 | 36 | if (to_scale > from_scale) { | 1037 | 36 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1038 | 36 | } | 1039 | | | 1040 | 36 | typename ToFieldType::NativeType max_result = | 1041 | 36 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1042 | 36 | typename ToFieldType::NativeType min_result = -max_result; | 1043 | | | 1044 | 36 | MaxNativeType multiplier {}; | 1045 | 36 | if (from_scale < to_scale) { | 1046 | 36 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1047 | 36 | from_scale); | 1048 | 36 | } else if (from_scale > to_scale) { | 1049 | 0 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1050 | 0 | to_scale); | 1051 | 0 | } | 1052 | 36 | RETURN_IF_ERROR(std::visit( | 1053 | 36 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1054 | 36 | for (size_t i = 0; i < size; i++) { | 1055 | 36 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1056 | 36 | multiply_may_overflow, narrow_integral>( | 1057 | 36 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1058 | 36 | to_precision, to_scale, min_result, max_result, multiplier, | 1059 | 36 | params)) { | 1060 | 36 | if (set_nullable) { | 1061 | 36 | null_map_data[i] = 1; | 1062 | 36 | } else { | 1063 | 36 | return params.status; | 1064 | 36 | } | 1065 | 36 | } | 1066 | 36 | } | 1067 | 36 | return Status::OK(); | 1068 | 36 | }, | 1069 | 36 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1070 | 0 | if (narrow_integral) { | 1071 | 0 | block.get_by_position(result).column = | 1072 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1073 | 0 | } else { | 1074 | 0 | block.get_by_position(result).column = std::move(col_to); | 1075 | 0 | } | 1076 | 0 | return Status::OK(); | 1077 | 36 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEENS2_ILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 980 | 132 | const NullMap::value_type* null_map = nullptr) const override { | 981 | 132 | using FromFieldType = typename FromDataType::FieldType; | 982 | 132 | using ToFieldType = typename ToDataType::FieldType; | 983 | 132 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 984 | 132 | const auto* col_from = | 985 | 132 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 986 | 132 | if (!col_from) { | 987 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 988 | 0 | named_from.column->get_name()); | 989 | 0 | } | 990 | | | 991 | 132 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 992 | 132 | UInt32 from_precision = from_decimal_type.get_precision(); | 993 | 132 | UInt32 from_scale = from_decimal_type.get_scale(); | 994 | | | 995 | 132 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 996 | 132 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 997 | 132 | UInt32 to_precision = to_decimal_type.get_precision(); | 998 | 132 | ToDataType::check_type_precision(to_precision); | 999 | 132 | UInt32 to_scale = to_decimal_type.get_scale(); | 1000 | 132 | ToDataType::check_type_scale(to_scale); | 1001 | | | 1002 | 132 | auto from_max_int_digit_count = from_precision - from_scale; | 1003 | 132 | auto to_max_int_digit_count = to_precision - to_scale; | 1004 | 132 | bool narrow_integral = | 1005 | 132 | (to_max_int_digit_count < from_max_int_digit_count) || | 1006 | 132 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1007 | | // only in non-strict mode and may overflow, we set nullable | 1008 | 132 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1009 | | | 1010 | 132 | size_t size = col_from->size(); | 1011 | 132 | ColumnUInt8::MutablePtr col_null_map_to; | 1012 | 132 | NullMap::value_type* null_map_data = nullptr; | 1013 | 132 | if (narrow_integral) { | 1014 | 32 | col_null_map_to = ColumnUInt8::create(size, 0); | 1015 | 32 | null_map_data = col_null_map_to->get_data().data(); | 1016 | 32 | } | 1017 | 132 | CastParameters params; | 1018 | 132 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1019 | 132 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1020 | 132 | const auto& vec_from = col_from->get_data(); | 1021 | 132 | const auto* vec_from_data = vec_from.data(); | 1022 | 132 | auto& vec_to = col_to->get_data(); | 1023 | 132 | auto* vec_to_data = vec_to.data(); | 1024 | | | 1025 | 132 | using MaxFieldType = | 1026 | 132 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1027 | 132 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1028 | 132 | std::is_same_v<FromFieldType, Decimal128V3>), | 1029 | 132 | Decimal128V3, | 1030 | 132 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1031 | 132 | FromFieldType, ToFieldType>>; | 1032 | 132 | using MaxNativeType = typename MaxFieldType::NativeType; | 1033 | | | 1034 | 132 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1035 | 132 | bool multiply_may_overflow = false; | 1036 | 132 | if (to_scale > from_scale) { | 1037 | 69 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1038 | 69 | } | 1039 | | | 1040 | 132 | typename ToFieldType::NativeType max_result = | 1041 | 132 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1042 | 132 | typename ToFieldType::NativeType min_result = -max_result; | 1043 | | | 1044 | 132 | MaxNativeType multiplier {}; | 1045 | 132 | if (from_scale < to_scale) { | 1046 | 69 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1047 | 69 | from_scale); | 1048 | 69 | } else if (from_scale > to_scale) { | 1049 | 30 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1050 | 30 | to_scale); | 1051 | 30 | } | 1052 | 132 | RETURN_IF_ERROR(std::visit( | 1053 | 132 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1054 | 132 | for (size_t i = 0; i < size; i++) { | 1055 | 132 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1056 | 132 | multiply_may_overflow, narrow_integral>( | 1057 | 132 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1058 | 132 | to_precision, to_scale, min_result, max_result, multiplier, | 1059 | 132 | params)) { | 1060 | 132 | if (set_nullable) { | 1061 | 132 | null_map_data[i] = 1; | 1062 | 132 | } else { | 1063 | 132 | return params.status; | 1064 | 132 | } | 1065 | 132 | } | 1066 | 132 | } | 1067 | 132 | return Status::OK(); | 1068 | 132 | }, | 1069 | 132 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1070 | 132 | if (narrow_integral) { | 1071 | 32 | block.get_by_position(result).column = | 1072 | 32 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1073 | 100 | } else { | 1074 | 100 | block.get_by_position(result).column = std::move(col_to); | 1075 | 100 | } | 1076 | 132 | return Status::OK(); | 1077 | 132 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEES4_E12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 980 | 92 | const NullMap::value_type* null_map = nullptr) const override { | 981 | 92 | using FromFieldType = typename FromDataType::FieldType; | 982 | 92 | using ToFieldType = typename ToDataType::FieldType; | 983 | 92 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 984 | 92 | const auto* col_from = | 985 | 92 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 986 | 92 | if (!col_from) { | 987 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 988 | 0 | named_from.column->get_name()); | 989 | 0 | } | 990 | | | 991 | 92 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 992 | 92 | UInt32 from_precision = from_decimal_type.get_precision(); | 993 | 92 | UInt32 from_scale = from_decimal_type.get_scale(); | 994 | | | 995 | 92 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 996 | 92 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 997 | 92 | UInt32 to_precision = to_decimal_type.get_precision(); | 998 | 92 | ToDataType::check_type_precision(to_precision); | 999 | 92 | UInt32 to_scale = to_decimal_type.get_scale(); | 1000 | 92 | ToDataType::check_type_scale(to_scale); | 1001 | | | 1002 | 92 | auto from_max_int_digit_count = from_precision - from_scale; | 1003 | 92 | auto to_max_int_digit_count = to_precision - to_scale; | 1004 | 92 | bool narrow_integral = | 1005 | 92 | (to_max_int_digit_count < from_max_int_digit_count) || | 1006 | 92 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1007 | | // only in non-strict mode and may overflow, we set nullable | 1008 | 92 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1009 | | | 1010 | 92 | size_t size = col_from->size(); | 1011 | 92 | ColumnUInt8::MutablePtr col_null_map_to; | 1012 | 92 | NullMap::value_type* null_map_data = nullptr; | 1013 | 92 | if (narrow_integral) { | 1014 | 92 | col_null_map_to = ColumnUInt8::create(size, 0); | 1015 | 92 | null_map_data = col_null_map_to->get_data().data(); | 1016 | 92 | } | 1017 | 92 | CastParameters params; | 1018 | 92 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1019 | 92 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1020 | 92 | const auto& vec_from = col_from->get_data(); | 1021 | 92 | const auto* vec_from_data = vec_from.data(); | 1022 | 92 | auto& vec_to = col_to->get_data(); | 1023 | 92 | auto* vec_to_data = vec_to.data(); | 1024 | | | 1025 | 92 | using MaxFieldType = | 1026 | 92 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1027 | 92 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1028 | 92 | std::is_same_v<FromFieldType, Decimal128V3>), | 1029 | 92 | Decimal128V3, | 1030 | 92 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1031 | 92 | FromFieldType, ToFieldType>>; | 1032 | 92 | using MaxNativeType = typename MaxFieldType::NativeType; | 1033 | | | 1034 | 92 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1035 | 92 | bool multiply_may_overflow = false; | 1036 | 92 | if (to_scale > from_scale) { | 1037 | 66 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1038 | 66 | } | 1039 | | | 1040 | 92 | typename ToFieldType::NativeType max_result = | 1041 | 92 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1042 | 92 | typename ToFieldType::NativeType min_result = -max_result; | 1043 | | | 1044 | 92 | MaxNativeType multiplier {}; | 1045 | 92 | if (from_scale < to_scale) { | 1046 | 66 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1047 | 66 | from_scale); | 1048 | 66 | } else if (from_scale > to_scale) { | 1049 | 20 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1050 | 20 | to_scale); | 1051 | 20 | } | 1052 | 92 | RETURN_IF_ERROR(std::visit( | 1053 | 92 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1054 | 92 | for (size_t i = 0; i < size; i++) { | 1055 | 92 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1056 | 92 | multiply_may_overflow, narrow_integral>( | 1057 | 92 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1058 | 92 | to_precision, to_scale, min_result, max_result, multiplier, | 1059 | 92 | params)) { | 1060 | 92 | if (set_nullable) { | 1061 | 92 | null_map_data[i] = 1; | 1062 | 92 | } else { | 1063 | 92 | return params.status; | 1064 | 92 | } | 1065 | 92 | } | 1066 | 92 | } | 1067 | 92 | return Status::OK(); | 1068 | 92 | }, | 1069 | 92 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1070 | 0 | if (narrow_integral) { | 1071 | 0 | block.get_by_position(result).column = | 1072 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1073 | 0 | } else { | 1074 | 0 | block.get_by_position(result).column = std::move(col_to); | 1075 | 0 | } | 1076 | 0 | return Status::OK(); | 1077 | 92 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEES4_E12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 980 | 180 | const NullMap::value_type* null_map = nullptr) const override { | 981 | 180 | using FromFieldType = typename FromDataType::FieldType; | 982 | 180 | using ToFieldType = typename ToDataType::FieldType; | 983 | 180 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 984 | 180 | const auto* col_from = | 985 | 180 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 986 | 180 | if (!col_from) { | 987 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 988 | 0 | named_from.column->get_name()); | 989 | 0 | } | 990 | | | 991 | 180 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 992 | 180 | UInt32 from_precision = from_decimal_type.get_precision(); | 993 | 180 | UInt32 from_scale = from_decimal_type.get_scale(); | 994 | | | 995 | 180 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 996 | 180 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 997 | 180 | UInt32 to_precision = to_decimal_type.get_precision(); | 998 | 180 | ToDataType::check_type_precision(to_precision); | 999 | 180 | UInt32 to_scale = to_decimal_type.get_scale(); | 1000 | 180 | ToDataType::check_type_scale(to_scale); | 1001 | | | 1002 | 180 | auto from_max_int_digit_count = from_precision - from_scale; | 1003 | 180 | auto to_max_int_digit_count = to_precision - to_scale; | 1004 | 180 | bool narrow_integral = | 1005 | 180 | (to_max_int_digit_count < from_max_int_digit_count) || | 1006 | 180 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1007 | | // only in non-strict mode and may overflow, we set nullable | 1008 | 180 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1009 | | | 1010 | 180 | size_t size = col_from->size(); | 1011 | 180 | ColumnUInt8::MutablePtr col_null_map_to; | 1012 | 180 | NullMap::value_type* null_map_data = nullptr; | 1013 | 180 | if (narrow_integral) { | 1014 | 104 | col_null_map_to = ColumnUInt8::create(size, 0); | 1015 | 104 | null_map_data = col_null_map_to->get_data().data(); | 1016 | 104 | } | 1017 | 180 | CastParameters params; | 1018 | 180 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1019 | 180 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1020 | 180 | const auto& vec_from = col_from->get_data(); | 1021 | 180 | const auto* vec_from_data = vec_from.data(); | 1022 | 180 | auto& vec_to = col_to->get_data(); | 1023 | 180 | auto* vec_to_data = vec_to.data(); | 1024 | | | 1025 | 180 | using MaxFieldType = | 1026 | 180 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1027 | 180 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1028 | 180 | std::is_same_v<FromFieldType, Decimal128V3>), | 1029 | 180 | Decimal128V3, | 1030 | 180 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1031 | 180 | FromFieldType, ToFieldType>>; | 1032 | 180 | using MaxNativeType = typename MaxFieldType::NativeType; | 1033 | | | 1034 | 180 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1035 | 180 | bool multiply_may_overflow = false; | 1036 | 180 | if (to_scale > from_scale) { | 1037 | 86 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1038 | 86 | } | 1039 | | | 1040 | 180 | typename ToFieldType::NativeType max_result = | 1041 | 180 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1042 | 180 | typename ToFieldType::NativeType min_result = -max_result; | 1043 | | | 1044 | 180 | MaxNativeType multiplier {}; | 1045 | 180 | if (from_scale < to_scale) { | 1046 | 86 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1047 | 86 | from_scale); | 1048 | 94 | } else if (from_scale > to_scale) { | 1049 | 68 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1050 | 68 | to_scale); | 1051 | 68 | } | 1052 | 180 | RETURN_IF_ERROR(std::visit( | 1053 | 180 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1054 | 180 | for (size_t i = 0; i < size; i++) { | 1055 | 180 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1056 | 180 | multiply_may_overflow, narrow_integral>( | 1057 | 180 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1058 | 180 | to_precision, to_scale, min_result, max_result, multiplier, | 1059 | 180 | params)) { | 1060 | 180 | if (set_nullable) { | 1061 | 180 | null_map_data[i] = 1; | 1062 | 180 | } else { | 1063 | 180 | return params.status; | 1064 | 180 | } | 1065 | 180 | } | 1066 | 180 | } | 1067 | 180 | return Status::OK(); | 1068 | 180 | }, | 1069 | 180 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1070 | 180 | if (narrow_integral) { | 1071 | 104 | block.get_by_position(result).column = | 1072 | 104 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1073 | 104 | } else { | 1074 | 76 | block.get_by_position(result).column = std::move(col_to); | 1075 | 76 | } | 1076 | 180 | return Status::OK(); | 1077 | 180 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEENS2_ILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 980 | 153 | const NullMap::value_type* null_map = nullptr) const override { | 981 | 153 | using FromFieldType = typename FromDataType::FieldType; | 982 | 153 | using ToFieldType = typename ToDataType::FieldType; | 983 | 153 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 984 | 153 | const auto* col_from = | 985 | 153 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 986 | 153 | if (!col_from) { | 987 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 988 | 0 | named_from.column->get_name()); | 989 | 0 | } | 990 | | | 991 | 153 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 992 | 153 | UInt32 from_precision = from_decimal_type.get_precision(); | 993 | 153 | UInt32 from_scale = from_decimal_type.get_scale(); | 994 | | | 995 | 153 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 996 | 153 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 997 | 153 | UInt32 to_precision = to_decimal_type.get_precision(); | 998 | 153 | ToDataType::check_type_precision(to_precision); | 999 | 153 | UInt32 to_scale = to_decimal_type.get_scale(); | 1000 | 153 | ToDataType::check_type_scale(to_scale); | 1001 | | | 1002 | 153 | auto from_max_int_digit_count = from_precision - from_scale; | 1003 | 153 | auto to_max_int_digit_count = to_precision - to_scale; | 1004 | 153 | bool narrow_integral = | 1005 | 153 | (to_max_int_digit_count < from_max_int_digit_count) || | 1006 | 153 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1007 | | // only in non-strict mode and may overflow, we set nullable | 1008 | 153 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1009 | | | 1010 | 153 | size_t size = col_from->size(); | 1011 | 153 | ColumnUInt8::MutablePtr col_null_map_to; | 1012 | 153 | NullMap::value_type* null_map_data = nullptr; | 1013 | 153 | if (narrow_integral) { | 1014 | 153 | col_null_map_to = ColumnUInt8::create(size, 0); | 1015 | 153 | null_map_data = col_null_map_to->get_data().data(); | 1016 | 153 | } | 1017 | 153 | CastParameters params; | 1018 | 153 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1019 | 153 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1020 | 153 | const auto& vec_from = col_from->get_data(); | 1021 | 153 | const auto* vec_from_data = vec_from.data(); | 1022 | 153 | auto& vec_to = col_to->get_data(); | 1023 | 153 | auto* vec_to_data = vec_to.data(); | 1024 | | | 1025 | 153 | using MaxFieldType = | 1026 | 153 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1027 | 153 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1028 | 153 | std::is_same_v<FromFieldType, Decimal128V3>), | 1029 | 153 | Decimal128V3, | 1030 | 153 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1031 | 153 | FromFieldType, ToFieldType>>; | 1032 | 153 | using MaxNativeType = typename MaxFieldType::NativeType; | 1033 | | | 1034 | 153 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1035 | 153 | bool multiply_may_overflow = false; | 1036 | 153 | if (to_scale > from_scale) { | 1037 | 60 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1038 | 60 | } | 1039 | | | 1040 | 153 | typename ToFieldType::NativeType max_result = | 1041 | 153 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1042 | 153 | typename ToFieldType::NativeType min_result = -max_result; | 1043 | | | 1044 | 153 | MaxNativeType multiplier {}; | 1045 | 153 | if (from_scale < to_scale) { | 1046 | 60 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1047 | 60 | from_scale); | 1048 | 93 | } else if (from_scale > to_scale) { | 1049 | 66 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1050 | 66 | to_scale); | 1051 | 66 | } | 1052 | 153 | RETURN_IF_ERROR(std::visit( | 1053 | 153 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1054 | 153 | for (size_t i = 0; i < size; i++) { | 1055 | 153 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1056 | 153 | multiply_may_overflow, narrow_integral>( | 1057 | 153 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1058 | 153 | to_precision, to_scale, min_result, max_result, multiplier, | 1059 | 153 | params)) { | 1060 | 153 | if (set_nullable) { | 1061 | 153 | null_map_data[i] = 1; | 1062 | 153 | } else { | 1063 | 153 | return params.status; | 1064 | 153 | } | 1065 | 153 | } | 1066 | 153 | } | 1067 | 153 | return Status::OK(); | 1068 | 153 | }, | 1069 | 153 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1070 | 0 | if (narrow_integral) { | 1071 | 0 | block.get_by_position(result).column = | 1072 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1073 | 0 | } else { | 1074 | 0 | block.get_by_position(result).column = std::move(col_to); | 1075 | 0 | } | 1076 | 0 | return Status::OK(); | 1077 | 153 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEENS2_ILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 980 | 228 | const NullMap::value_type* null_map = nullptr) const override { | 981 | 228 | using FromFieldType = typename FromDataType::FieldType; | 982 | 228 | using ToFieldType = typename ToDataType::FieldType; | 983 | 228 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 984 | 228 | const auto* col_from = | 985 | 228 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 986 | 228 | if (!col_from) { | 987 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 988 | 0 | named_from.column->get_name()); | 989 | 0 | } | 990 | | | 991 | 228 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 992 | 228 | UInt32 from_precision = from_decimal_type.get_precision(); | 993 | 228 | UInt32 from_scale = from_decimal_type.get_scale(); | 994 | | | 995 | 228 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 996 | 228 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 997 | 228 | UInt32 to_precision = to_decimal_type.get_precision(); | 998 | 228 | ToDataType::check_type_precision(to_precision); | 999 | 228 | UInt32 to_scale = to_decimal_type.get_scale(); | 1000 | 228 | ToDataType::check_type_scale(to_scale); | 1001 | | | 1002 | 228 | auto from_max_int_digit_count = from_precision - from_scale; | 1003 | 228 | auto to_max_int_digit_count = to_precision - to_scale; | 1004 | 228 | bool narrow_integral = | 1005 | 228 | (to_max_int_digit_count < from_max_int_digit_count) || | 1006 | 228 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1007 | | // only in non-strict mode and may overflow, we set nullable | 1008 | 228 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1009 | | | 1010 | 228 | size_t size = col_from->size(); | 1011 | 228 | ColumnUInt8::MutablePtr col_null_map_to; | 1012 | 228 | NullMap::value_type* null_map_data = nullptr; | 1013 | 228 | if (narrow_integral) { | 1014 | 192 | col_null_map_to = ColumnUInt8::create(size, 0); | 1015 | 192 | null_map_data = col_null_map_to->get_data().data(); | 1016 | 192 | } | 1017 | 228 | CastParameters params; | 1018 | 228 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1019 | 228 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1020 | 228 | const auto& vec_from = col_from->get_data(); | 1021 | 228 | const auto* vec_from_data = vec_from.data(); | 1022 | 228 | auto& vec_to = col_to->get_data(); | 1023 | 228 | auto* vec_to_data = vec_to.data(); | 1024 | | | 1025 | 228 | using MaxFieldType = | 1026 | 228 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1027 | 228 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1028 | 228 | std::is_same_v<FromFieldType, Decimal128V3>), | 1029 | 228 | Decimal128V3, | 1030 | 228 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1031 | 228 | FromFieldType, ToFieldType>>; | 1032 | 228 | using MaxNativeType = typename MaxFieldType::NativeType; | 1033 | | | 1034 | 228 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1035 | 228 | bool multiply_may_overflow = false; | 1036 | 228 | if (to_scale > from_scale) { | 1037 | 76 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1038 | 76 | } | 1039 | | | 1040 | 228 | typename ToFieldType::NativeType max_result = | 1041 | 228 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1042 | 228 | typename ToFieldType::NativeType min_result = -max_result; | 1043 | | | 1044 | 228 | MaxNativeType multiplier {}; | 1045 | 228 | if (from_scale < to_scale) { | 1046 | 76 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1047 | 76 | from_scale); | 1048 | 152 | } else if (from_scale > to_scale) { | 1049 | 94 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1050 | 94 | to_scale); | 1051 | 94 | } | 1052 | 228 | RETURN_IF_ERROR(std::visit( | 1053 | 228 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1054 | 228 | for (size_t i = 0; i < size; i++) { | 1055 | 228 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1056 | 228 | multiply_may_overflow, narrow_integral>( | 1057 | 228 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1058 | 228 | to_precision, to_scale, min_result, max_result, multiplier, | 1059 | 228 | params)) { | 1060 | 228 | if (set_nullable) { | 1061 | 228 | null_map_data[i] = 1; | 1062 | 228 | } else { | 1063 | 228 | return params.status; | 1064 | 228 | } | 1065 | 228 | } | 1066 | 228 | } | 1067 | 228 | return Status::OK(); | 1068 | 228 | }, | 1069 | 228 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1070 | 228 | if (narrow_integral) { | 1071 | 192 | block.get_by_position(result).column = | 1072 | 192 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1073 | 192 | } else { | 1074 | 36 | block.get_by_position(result).column = std::move(col_to); | 1075 | 36 | } | 1076 | 228 | return Status::OK(); | 1077 | 228 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEENS2_ILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 980 | 164 | const NullMap::value_type* null_map = nullptr) const override { | 981 | 164 | using FromFieldType = typename FromDataType::FieldType; | 982 | 164 | using ToFieldType = typename ToDataType::FieldType; | 983 | 164 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 984 | 164 | const auto* col_from = | 985 | 164 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 986 | 164 | if (!col_from) { | 987 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 988 | 0 | named_from.column->get_name()); | 989 | 0 | } | 990 | | | 991 | 164 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 992 | 164 | UInt32 from_precision = from_decimal_type.get_precision(); | 993 | 164 | UInt32 from_scale = from_decimal_type.get_scale(); | 994 | | | 995 | 164 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 996 | 164 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 997 | 164 | UInt32 to_precision = to_decimal_type.get_precision(); | 998 | 164 | ToDataType::check_type_precision(to_precision); | 999 | 164 | UInt32 to_scale = to_decimal_type.get_scale(); | 1000 | 164 | ToDataType::check_type_scale(to_scale); | 1001 | | | 1002 | 164 | auto from_max_int_digit_count = from_precision - from_scale; | 1003 | 164 | auto to_max_int_digit_count = to_precision - to_scale; | 1004 | 164 | bool narrow_integral = | 1005 | 164 | (to_max_int_digit_count < from_max_int_digit_count) || | 1006 | 164 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1007 | | // only in non-strict mode and may overflow, we set nullable | 1008 | 164 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1009 | | | 1010 | 164 | size_t size = col_from->size(); | 1011 | 164 | ColumnUInt8::MutablePtr col_null_map_to; | 1012 | 164 | NullMap::value_type* null_map_data = nullptr; | 1013 | 164 | if (narrow_integral) { | 1014 | 164 | col_null_map_to = ColumnUInt8::create(size, 0); | 1015 | 164 | null_map_data = col_null_map_to->get_data().data(); | 1016 | 164 | } | 1017 | 164 | CastParameters params; | 1018 | 164 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1019 | 164 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1020 | 164 | const auto& vec_from = col_from->get_data(); | 1021 | 164 | const auto* vec_from_data = vec_from.data(); | 1022 | 164 | auto& vec_to = col_to->get_data(); | 1023 | 164 | auto* vec_to_data = vec_to.data(); | 1024 | | | 1025 | 164 | using MaxFieldType = | 1026 | 164 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1027 | 164 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1028 | 164 | std::is_same_v<FromFieldType, Decimal128V3>), | 1029 | 164 | Decimal128V3, | 1030 | 164 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1031 | 164 | FromFieldType, ToFieldType>>; | 1032 | 164 | using MaxNativeType = typename MaxFieldType::NativeType; | 1033 | | | 1034 | 164 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1035 | 164 | bool multiply_may_overflow = false; | 1036 | 164 | if (to_scale > from_scale) { | 1037 | 60 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1038 | 60 | } | 1039 | | | 1040 | 164 | typename ToFieldType::NativeType max_result = | 1041 | 164 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1042 | 164 | typename ToFieldType::NativeType min_result = -max_result; | 1043 | | | 1044 | 164 | MaxNativeType multiplier {}; | 1045 | 164 | if (from_scale < to_scale) { | 1046 | 60 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1047 | 60 | from_scale); | 1048 | 104 | } else if (from_scale > to_scale) { | 1049 | 80 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1050 | 80 | to_scale); | 1051 | 80 | } | 1052 | 164 | RETURN_IF_ERROR(std::visit( | 1053 | 164 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1054 | 164 | for (size_t i = 0; i < size; i++) { | 1055 | 164 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1056 | 164 | multiply_may_overflow, narrow_integral>( | 1057 | 164 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1058 | 164 | to_precision, to_scale, min_result, max_result, multiplier, | 1059 | 164 | params)) { | 1060 | 164 | if (set_nullable) { | 1061 | 164 | null_map_data[i] = 1; | 1062 | 164 | } else { | 1063 | 164 | return params.status; | 1064 | 164 | } | 1065 | 164 | } | 1066 | 164 | } | 1067 | 164 | return Status::OK(); | 1068 | 164 | }, | 1069 | 164 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1070 | 0 | if (narrow_integral) { | 1071 | 0 | block.get_by_position(result).column = | 1072 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1073 | 0 | } else { | 1074 | 0 | block.get_by_position(result).column = std::move(col_to); | 1075 | 0 | } | 1076 | 0 | return Status::OK(); | 1077 | 164 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEENS2_ILS3_29EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 980 | 228 | const NullMap::value_type* null_map = nullptr) const override { | 981 | 228 | using FromFieldType = typename FromDataType::FieldType; | 982 | 228 | using ToFieldType = typename ToDataType::FieldType; | 983 | 228 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 984 | 228 | const auto* col_from = | 985 | 228 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 986 | 228 | if (!col_from) { | 987 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 988 | 0 | named_from.column->get_name()); | 989 | 0 | } | 990 | | | 991 | 228 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 992 | 228 | UInt32 from_precision = from_decimal_type.get_precision(); | 993 | 228 | UInt32 from_scale = from_decimal_type.get_scale(); | 994 | | | 995 | 228 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 996 | 228 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 997 | 228 | UInt32 to_precision = to_decimal_type.get_precision(); | 998 | 228 | ToDataType::check_type_precision(to_precision); | 999 | 228 | UInt32 to_scale = to_decimal_type.get_scale(); | 1000 | 228 | ToDataType::check_type_scale(to_scale); | 1001 | | | 1002 | 228 | auto from_max_int_digit_count = from_precision - from_scale; | 1003 | 228 | auto to_max_int_digit_count = to_precision - to_scale; | 1004 | 228 | bool narrow_integral = | 1005 | 228 | (to_max_int_digit_count < from_max_int_digit_count) || | 1006 | 228 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1007 | | // only in non-strict mode and may overflow, we set nullable | 1008 | 228 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1009 | | | 1010 | 228 | size_t size = col_from->size(); | 1011 | 228 | ColumnUInt8::MutablePtr col_null_map_to; | 1012 | 228 | NullMap::value_type* null_map_data = nullptr; | 1013 | 228 | if (narrow_integral) { | 1014 | 192 | col_null_map_to = ColumnUInt8::create(size, 0); | 1015 | 192 | null_map_data = col_null_map_to->get_data().data(); | 1016 | 192 | } | 1017 | 228 | CastParameters params; | 1018 | 228 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1019 | 228 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1020 | 228 | const auto& vec_from = col_from->get_data(); | 1021 | 228 | const auto* vec_from_data = vec_from.data(); | 1022 | 228 | auto& vec_to = col_to->get_data(); | 1023 | 228 | auto* vec_to_data = vec_to.data(); | 1024 | | | 1025 | 228 | using MaxFieldType = | 1026 | 228 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1027 | 228 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1028 | 228 | std::is_same_v<FromFieldType, Decimal128V3>), | 1029 | 228 | Decimal128V3, | 1030 | 228 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1031 | 228 | FromFieldType, ToFieldType>>; | 1032 | 228 | using MaxNativeType = typename MaxFieldType::NativeType; | 1033 | | | 1034 | 228 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1035 | 228 | bool multiply_may_overflow = false; | 1036 | 228 | if (to_scale > from_scale) { | 1037 | 76 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1038 | 76 | } | 1039 | | | 1040 | 228 | typename ToFieldType::NativeType max_result = | 1041 | 228 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1042 | 228 | typename ToFieldType::NativeType min_result = -max_result; | 1043 | | | 1044 | 228 | MaxNativeType multiplier {}; | 1045 | 228 | if (from_scale < to_scale) { | 1046 | 76 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1047 | 76 | from_scale); | 1048 | 152 | } else if (from_scale > to_scale) { | 1049 | 96 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1050 | 96 | to_scale); | 1051 | 96 | } | 1052 | 228 | RETURN_IF_ERROR(std::visit( | 1053 | 228 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1054 | 228 | for (size_t i = 0; i < size; i++) { | 1055 | 228 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1056 | 228 | multiply_may_overflow, narrow_integral>( | 1057 | 228 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1058 | 228 | to_precision, to_scale, min_result, max_result, multiplier, | 1059 | 228 | params)) { | 1060 | 228 | if (set_nullable) { | 1061 | 228 | null_map_data[i] = 1; | 1062 | 228 | } else { | 1063 | 228 | return params.status; | 1064 | 228 | } | 1065 | 228 | } | 1066 | 228 | } | 1067 | 228 | return Status::OK(); | 1068 | 228 | }, | 1069 | 228 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1070 | 228 | if (narrow_integral) { | 1071 | 192 | block.get_by_position(result).column = | 1072 | 192 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1073 | 192 | } else { | 1074 | 36 | block.get_by_position(result).column = std::move(col_to); | 1075 | 36 | } | 1076 | 228 | return Status::OK(); | 1077 | 228 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEENS2_ILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 980 | 36 | const NullMap::value_type* null_map = nullptr) const override { | 981 | 36 | using FromFieldType = typename FromDataType::FieldType; | 982 | 36 | using ToFieldType = typename ToDataType::FieldType; | 983 | 36 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 984 | 36 | const auto* col_from = | 985 | 36 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 986 | 36 | if (!col_from) { | 987 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 988 | 0 | named_from.column->get_name()); | 989 | 0 | } | 990 | | | 991 | 36 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 992 | 36 | UInt32 from_precision = from_decimal_type.get_precision(); | 993 | 36 | UInt32 from_scale = from_decimal_type.get_scale(); | 994 | | | 995 | 36 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 996 | 36 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 997 | 36 | UInt32 to_precision = to_decimal_type.get_precision(); | 998 | 36 | ToDataType::check_type_precision(to_precision); | 999 | 36 | UInt32 to_scale = to_decimal_type.get_scale(); | 1000 | 36 | ToDataType::check_type_scale(to_scale); | 1001 | | | 1002 | 36 | auto from_max_int_digit_count = from_precision - from_scale; | 1003 | 36 | auto to_max_int_digit_count = to_precision - to_scale; | 1004 | 36 | bool narrow_integral = | 1005 | 36 | (to_max_int_digit_count < from_max_int_digit_count) || | 1006 | 36 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1007 | | // only in non-strict mode and may overflow, we set nullable | 1008 | 36 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1009 | | | 1010 | 36 | size_t size = col_from->size(); | 1011 | 36 | ColumnUInt8::MutablePtr col_null_map_to; | 1012 | 36 | NullMap::value_type* null_map_data = nullptr; | 1013 | 36 | if (narrow_integral) { | 1014 | 36 | col_null_map_to = ColumnUInt8::create(size, 0); | 1015 | 36 | null_map_data = col_null_map_to->get_data().data(); | 1016 | 36 | } | 1017 | 36 | CastParameters params; | 1018 | 36 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1019 | 36 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1020 | 36 | const auto& vec_from = col_from->get_data(); | 1021 | 36 | const auto* vec_from_data = vec_from.data(); | 1022 | 36 | auto& vec_to = col_to->get_data(); | 1023 | 36 | auto* vec_to_data = vec_to.data(); | 1024 | | | 1025 | 36 | using MaxFieldType = | 1026 | 36 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1027 | 36 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1028 | 36 | std::is_same_v<FromFieldType, Decimal128V3>), | 1029 | 36 | Decimal128V3, | 1030 | 36 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1031 | 36 | FromFieldType, ToFieldType>>; | 1032 | 36 | using MaxNativeType = typename MaxFieldType::NativeType; | 1033 | | | 1034 | 36 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1035 | 36 | bool multiply_may_overflow = false; | 1036 | 36 | if (to_scale > from_scale) { | 1037 | 36 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1038 | 36 | } | 1039 | | | 1040 | 36 | typename ToFieldType::NativeType max_result = | 1041 | 36 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1042 | 36 | typename ToFieldType::NativeType min_result = -max_result; | 1043 | | | 1044 | 36 | MaxNativeType multiplier {}; | 1045 | 36 | if (from_scale < to_scale) { | 1046 | 36 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1047 | 36 | from_scale); | 1048 | 36 | } else if (from_scale > to_scale) { | 1049 | 0 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1050 | 0 | to_scale); | 1051 | 0 | } | 1052 | 36 | RETURN_IF_ERROR(std::visit( | 1053 | 36 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1054 | 36 | for (size_t i = 0; i < size; i++) { | 1055 | 36 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1056 | 36 | multiply_may_overflow, narrow_integral>( | 1057 | 36 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1058 | 36 | to_precision, to_scale, min_result, max_result, multiplier, | 1059 | 36 | params)) { | 1060 | 36 | if (set_nullable) { | 1061 | 36 | null_map_data[i] = 1; | 1062 | 36 | } else { | 1063 | 36 | return params.status; | 1064 | 36 | } | 1065 | 36 | } | 1066 | 36 | } | 1067 | 36 | return Status::OK(); | 1068 | 36 | }, | 1069 | 36 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1070 | 0 | if (narrow_integral) { | 1071 | 0 | block.get_by_position(result).column = | 1072 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1073 | 0 | } else { | 1074 | 0 | block.get_by_position(result).column = std::move(col_to); | 1075 | 0 | } | 1076 | 0 | return Status::OK(); | 1077 | 36 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEENS2_ILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 980 | 132 | const NullMap::value_type* null_map = nullptr) const override { | 981 | 132 | using FromFieldType = typename FromDataType::FieldType; | 982 | 132 | using ToFieldType = typename ToDataType::FieldType; | 983 | 132 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 984 | 132 | const auto* col_from = | 985 | 132 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 986 | 132 | if (!col_from) { | 987 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 988 | 0 | named_from.column->get_name()); | 989 | 0 | } | 990 | | | 991 | 132 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 992 | 132 | UInt32 from_precision = from_decimal_type.get_precision(); | 993 | 132 | UInt32 from_scale = from_decimal_type.get_scale(); | 994 | | | 995 | 132 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 996 | 132 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 997 | 132 | UInt32 to_precision = to_decimal_type.get_precision(); | 998 | 132 | ToDataType::check_type_precision(to_precision); | 999 | 132 | UInt32 to_scale = to_decimal_type.get_scale(); | 1000 | 132 | ToDataType::check_type_scale(to_scale); | 1001 | | | 1002 | 132 | auto from_max_int_digit_count = from_precision - from_scale; | 1003 | 132 | auto to_max_int_digit_count = to_precision - to_scale; | 1004 | 132 | bool narrow_integral = | 1005 | 132 | (to_max_int_digit_count < from_max_int_digit_count) || | 1006 | 132 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1007 | | // only in non-strict mode and may overflow, we set nullable | 1008 | 132 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1009 | | | 1010 | 132 | size_t size = col_from->size(); | 1011 | 132 | ColumnUInt8::MutablePtr col_null_map_to; | 1012 | 132 | NullMap::value_type* null_map_data = nullptr; | 1013 | 132 | if (narrow_integral) { | 1014 | 32 | col_null_map_to = ColumnUInt8::create(size, 0); | 1015 | 32 | null_map_data = col_null_map_to->get_data().data(); | 1016 | 32 | } | 1017 | 132 | CastParameters params; | 1018 | 132 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1019 | 132 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1020 | 132 | const auto& vec_from = col_from->get_data(); | 1021 | 132 | const auto* vec_from_data = vec_from.data(); | 1022 | 132 | auto& vec_to = col_to->get_data(); | 1023 | 132 | auto* vec_to_data = vec_to.data(); | 1024 | | | 1025 | 132 | using MaxFieldType = | 1026 | 132 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1027 | 132 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1028 | 132 | std::is_same_v<FromFieldType, Decimal128V3>), | 1029 | 132 | Decimal128V3, | 1030 | 132 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1031 | 132 | FromFieldType, ToFieldType>>; | 1032 | 132 | using MaxNativeType = typename MaxFieldType::NativeType; | 1033 | | | 1034 | 132 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1035 | 132 | bool multiply_may_overflow = false; | 1036 | 132 | if (to_scale > from_scale) { | 1037 | 70 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1038 | 70 | } | 1039 | | | 1040 | 132 | typename ToFieldType::NativeType max_result = | 1041 | 132 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1042 | 132 | typename ToFieldType::NativeType min_result = -max_result; | 1043 | | | 1044 | 132 | MaxNativeType multiplier {}; | 1045 | 132 | if (from_scale < to_scale) { | 1046 | 70 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1047 | 70 | from_scale); | 1048 | 70 | } else if (from_scale > to_scale) { | 1049 | 30 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1050 | 30 | to_scale); | 1051 | 30 | } | 1052 | 132 | RETURN_IF_ERROR(std::visit( | 1053 | 132 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1054 | 132 | for (size_t i = 0; i < size; i++) { | 1055 | 132 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1056 | 132 | multiply_may_overflow, narrow_integral>( | 1057 | 132 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1058 | 132 | to_precision, to_scale, min_result, max_result, multiplier, | 1059 | 132 | params)) { | 1060 | 132 | if (set_nullable) { | 1061 | 132 | null_map_data[i] = 1; | 1062 | 132 | } else { | 1063 | 132 | return params.status; | 1064 | 132 | } | 1065 | 132 | } | 1066 | 132 | } | 1067 | 132 | return Status::OK(); | 1068 | 132 | }, | 1069 | 132 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1070 | 132 | if (narrow_integral) { | 1071 | 32 | block.get_by_position(result).column = | 1072 | 32 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1073 | 100 | } else { | 1074 | 100 | block.get_by_position(result).column = std::move(col_to); | 1075 | 100 | } | 1076 | 132 | return Status::OK(); | 1077 | 132 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEENS2_ILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 980 | 60 | const NullMap::value_type* null_map = nullptr) const override { | 981 | 60 | using FromFieldType = typename FromDataType::FieldType; | 982 | 60 | using ToFieldType = typename ToDataType::FieldType; | 983 | 60 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 984 | 60 | const auto* col_from = | 985 | 60 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 986 | 60 | if (!col_from) { | 987 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 988 | 0 | named_from.column->get_name()); | 989 | 0 | } | 990 | | | 991 | 60 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 992 | 60 | UInt32 from_precision = from_decimal_type.get_precision(); | 993 | 60 | UInt32 from_scale = from_decimal_type.get_scale(); | 994 | | | 995 | 60 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 996 | 60 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 997 | 60 | UInt32 to_precision = to_decimal_type.get_precision(); | 998 | 60 | ToDataType::check_type_precision(to_precision); | 999 | 60 | UInt32 to_scale = to_decimal_type.get_scale(); | 1000 | 60 | ToDataType::check_type_scale(to_scale); | 1001 | | | 1002 | 60 | auto from_max_int_digit_count = from_precision - from_scale; | 1003 | 60 | auto to_max_int_digit_count = to_precision - to_scale; | 1004 | 60 | bool narrow_integral = | 1005 | 60 | (to_max_int_digit_count < from_max_int_digit_count) || | 1006 | 60 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1007 | | // only in non-strict mode and may overflow, we set nullable | 1008 | 60 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1009 | | | 1010 | 60 | size_t size = col_from->size(); | 1011 | 60 | ColumnUInt8::MutablePtr col_null_map_to; | 1012 | 60 | NullMap::value_type* null_map_data = nullptr; | 1013 | 60 | if (narrow_integral) { | 1014 | 60 | col_null_map_to = ColumnUInt8::create(size, 0); | 1015 | 60 | null_map_data = col_null_map_to->get_data().data(); | 1016 | 60 | } | 1017 | 60 | CastParameters params; | 1018 | 60 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1019 | 60 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1020 | 60 | const auto& vec_from = col_from->get_data(); | 1021 | 60 | const auto* vec_from_data = vec_from.data(); | 1022 | 60 | auto& vec_to = col_to->get_data(); | 1023 | 60 | auto* vec_to_data = vec_to.data(); | 1024 | | | 1025 | 60 | using MaxFieldType = | 1026 | 60 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1027 | 60 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1028 | 60 | std::is_same_v<FromFieldType, Decimal128V3>), | 1029 | 60 | Decimal128V3, | 1030 | 60 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1031 | 60 | FromFieldType, ToFieldType>>; | 1032 | 60 | using MaxNativeType = typename MaxFieldType::NativeType; | 1033 | | | 1034 | 60 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1035 | 60 | bool multiply_may_overflow = false; | 1036 | 60 | if (to_scale > from_scale) { | 1037 | 60 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1038 | 60 | } | 1039 | | | 1040 | 60 | typename ToFieldType::NativeType max_result = | 1041 | 60 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1042 | 60 | typename ToFieldType::NativeType min_result = -max_result; | 1043 | | | 1044 | 60 | MaxNativeType multiplier {}; | 1045 | 60 | if (from_scale < to_scale) { | 1046 | 60 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1047 | 60 | from_scale); | 1048 | 60 | } else if (from_scale > to_scale) { | 1049 | 0 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1050 | 0 | to_scale); | 1051 | 0 | } | 1052 | 60 | RETURN_IF_ERROR(std::visit( | 1053 | 60 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1054 | 60 | for (size_t i = 0; i < size; i++) { | 1055 | 60 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1056 | 60 | multiply_may_overflow, narrow_integral>( | 1057 | 60 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1058 | 60 | to_precision, to_scale, min_result, max_result, multiplier, | 1059 | 60 | params)) { | 1060 | 60 | if (set_nullable) { | 1061 | 60 | null_map_data[i] = 1; | 1062 | 60 | } else { | 1063 | 60 | return params.status; | 1064 | 60 | } | 1065 | 60 | } | 1066 | 60 | } | 1067 | 60 | return Status::OK(); | 1068 | 60 | }, | 1069 | 60 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1070 | 0 | if (narrow_integral) { | 1071 | 0 | block.get_by_position(result).column = | 1072 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1073 | 0 | } else { | 1074 | 0 | block.get_by_position(result).column = std::move(col_to); | 1075 | 0 | } | 1076 | 0 | return Status::OK(); | 1077 | 60 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEENS2_ILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 980 | 204 | const NullMap::value_type* null_map = nullptr) const override { | 981 | 204 | using FromFieldType = typename FromDataType::FieldType; | 982 | 204 | using ToFieldType = typename ToDataType::FieldType; | 983 | 204 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 984 | 204 | const auto* col_from = | 985 | 204 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 986 | 204 | if (!col_from) { | 987 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 988 | 0 | named_from.column->get_name()); | 989 | 0 | } | 990 | | | 991 | 204 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 992 | 204 | UInt32 from_precision = from_decimal_type.get_precision(); | 993 | 204 | UInt32 from_scale = from_decimal_type.get_scale(); | 994 | | | 995 | 204 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 996 | 204 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 997 | 204 | UInt32 to_precision = to_decimal_type.get_precision(); | 998 | 204 | ToDataType::check_type_precision(to_precision); | 999 | 204 | UInt32 to_scale = to_decimal_type.get_scale(); | 1000 | 204 | ToDataType::check_type_scale(to_scale); | 1001 | | | 1002 | 204 | auto from_max_int_digit_count = from_precision - from_scale; | 1003 | 204 | auto to_max_int_digit_count = to_precision - to_scale; | 1004 | 204 | bool narrow_integral = | 1005 | 204 | (to_max_int_digit_count < from_max_int_digit_count) || | 1006 | 204 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1007 | | // only in non-strict mode and may overflow, we set nullable | 1008 | 204 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1009 | | | 1010 | 204 | size_t size = col_from->size(); | 1011 | 204 | ColumnUInt8::MutablePtr col_null_map_to; | 1012 | 204 | NullMap::value_type* null_map_data = nullptr; | 1013 | 204 | if (narrow_integral) { | 1014 | 56 | col_null_map_to = ColumnUInt8::create(size, 0); | 1015 | 56 | null_map_data = col_null_map_to->get_data().data(); | 1016 | 56 | } | 1017 | 204 | CastParameters params; | 1018 | 204 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1019 | 204 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1020 | 204 | const auto& vec_from = col_from->get_data(); | 1021 | 204 | const auto* vec_from_data = vec_from.data(); | 1022 | 204 | auto& vec_to = col_to->get_data(); | 1023 | 204 | auto* vec_to_data = vec_to.data(); | 1024 | | | 1025 | 204 | using MaxFieldType = | 1026 | 204 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1027 | 204 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1028 | 204 | std::is_same_v<FromFieldType, Decimal128V3>), | 1029 | 204 | Decimal128V3, | 1030 | 204 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1031 | 204 | FromFieldType, ToFieldType>>; | 1032 | 204 | using MaxNativeType = typename MaxFieldType::NativeType; | 1033 | | | 1034 | 204 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1035 | 204 | bool multiply_may_overflow = false; | 1036 | 204 | if (to_scale > from_scale) { | 1037 | 99 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1038 | 99 | } | 1039 | | | 1040 | 204 | typename ToFieldType::NativeType max_result = | 1041 | 204 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1042 | 204 | typename ToFieldType::NativeType min_result = -max_result; | 1043 | | | 1044 | 204 | MaxNativeType multiplier {}; | 1045 | 204 | if (from_scale < to_scale) { | 1046 | 99 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1047 | 99 | from_scale); | 1048 | 105 | } else if (from_scale > to_scale) { | 1049 | 56 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1050 | 56 | to_scale); | 1051 | 56 | } | 1052 | 204 | RETURN_IF_ERROR(std::visit( | 1053 | 204 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1054 | 204 | for (size_t i = 0; i < size; i++) { | 1055 | 204 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1056 | 204 | multiply_may_overflow, narrow_integral>( | 1057 | 204 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1058 | 204 | to_precision, to_scale, min_result, max_result, multiplier, | 1059 | 204 | params)) { | 1060 | 204 | if (set_nullable) { | 1061 | 204 | null_map_data[i] = 1; | 1062 | 204 | } else { | 1063 | 204 | return params.status; | 1064 | 204 | } | 1065 | 204 | } | 1066 | 204 | } | 1067 | 204 | return Status::OK(); | 1068 | 204 | }, | 1069 | 204 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1070 | 204 | if (narrow_integral) { | 1071 | 56 | block.get_by_position(result).column = | 1072 | 56 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1073 | 148 | } else { | 1074 | 148 | block.get_by_position(result).column = std::move(col_to); | 1075 | 148 | } | 1076 | 204 | return Status::OK(); | 1077 | 204 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEES4_E12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 980 | 92 | const NullMap::value_type* null_map = nullptr) const override { | 981 | 92 | using FromFieldType = typename FromDataType::FieldType; | 982 | 92 | using ToFieldType = typename ToDataType::FieldType; | 983 | 92 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 984 | 92 | const auto* col_from = | 985 | 92 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 986 | 92 | if (!col_from) { | 987 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 988 | 0 | named_from.column->get_name()); | 989 | 0 | } | 990 | | | 991 | 92 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 992 | 92 | UInt32 from_precision = from_decimal_type.get_precision(); | 993 | 92 | UInt32 from_scale = from_decimal_type.get_scale(); | 994 | | | 995 | 92 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 996 | 92 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 997 | 92 | UInt32 to_precision = to_decimal_type.get_precision(); | 998 | 92 | ToDataType::check_type_precision(to_precision); | 999 | 92 | UInt32 to_scale = to_decimal_type.get_scale(); | 1000 | 92 | ToDataType::check_type_scale(to_scale); | 1001 | | | 1002 | 92 | auto from_max_int_digit_count = from_precision - from_scale; | 1003 | 92 | auto to_max_int_digit_count = to_precision - to_scale; | 1004 | 92 | bool narrow_integral = | 1005 | 92 | (to_max_int_digit_count < from_max_int_digit_count) || | 1006 | 92 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1007 | | // only in non-strict mode and may overflow, we set nullable | 1008 | 92 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1009 | | | 1010 | 92 | size_t size = col_from->size(); | 1011 | 92 | ColumnUInt8::MutablePtr col_null_map_to; | 1012 | 92 | NullMap::value_type* null_map_data = nullptr; | 1013 | 92 | if (narrow_integral) { | 1014 | 92 | col_null_map_to = ColumnUInt8::create(size, 0); | 1015 | 92 | null_map_data = col_null_map_to->get_data().data(); | 1016 | 92 | } | 1017 | 92 | CastParameters params; | 1018 | 92 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1019 | 92 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1020 | 92 | const auto& vec_from = col_from->get_data(); | 1021 | 92 | const auto* vec_from_data = vec_from.data(); | 1022 | 92 | auto& vec_to = col_to->get_data(); | 1023 | 92 | auto* vec_to_data = vec_to.data(); | 1024 | | | 1025 | 92 | using MaxFieldType = | 1026 | 92 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1027 | 92 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1028 | 92 | std::is_same_v<FromFieldType, Decimal128V3>), | 1029 | 92 | Decimal128V3, | 1030 | 92 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1031 | 92 | FromFieldType, ToFieldType>>; | 1032 | 92 | using MaxNativeType = typename MaxFieldType::NativeType; | 1033 | | | 1034 | 92 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1035 | 92 | bool multiply_may_overflow = false; | 1036 | 92 | if (to_scale > from_scale) { | 1037 | 66 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1038 | 66 | } | 1039 | | | 1040 | 92 | typename ToFieldType::NativeType max_result = | 1041 | 92 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1042 | 92 | typename ToFieldType::NativeType min_result = -max_result; | 1043 | | | 1044 | 92 | MaxNativeType multiplier {}; | 1045 | 92 | if (from_scale < to_scale) { | 1046 | 66 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1047 | 66 | from_scale); | 1048 | 66 | } else if (from_scale > to_scale) { | 1049 | 20 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1050 | 20 | to_scale); | 1051 | 20 | } | 1052 | 92 | RETURN_IF_ERROR(std::visit( | 1053 | 92 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1054 | 92 | for (size_t i = 0; i < size; i++) { | 1055 | 92 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1056 | 92 | multiply_may_overflow, narrow_integral>( | 1057 | 92 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1058 | 92 | to_precision, to_scale, min_result, max_result, multiplier, | 1059 | 92 | params)) { | 1060 | 92 | if (set_nullable) { | 1061 | 92 | null_map_data[i] = 1; | 1062 | 92 | } else { | 1063 | 92 | return params.status; | 1064 | 92 | } | 1065 | 92 | } | 1066 | 92 | } | 1067 | 92 | return Status::OK(); | 1068 | 92 | }, | 1069 | 92 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1070 | 0 | if (narrow_integral) { | 1071 | 0 | block.get_by_position(result).column = | 1072 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1073 | 0 | } else { | 1074 | 0 | block.get_by_position(result).column = std::move(col_to); | 1075 | 0 | } | 1076 | 0 | return Status::OK(); | 1077 | 92 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEES4_E12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 980 | 180 | const NullMap::value_type* null_map = nullptr) const override { | 981 | 180 | using FromFieldType = typename FromDataType::FieldType; | 982 | 180 | using ToFieldType = typename ToDataType::FieldType; | 983 | 180 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 984 | 180 | const auto* col_from = | 985 | 180 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 986 | 180 | if (!col_from) { | 987 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 988 | 0 | named_from.column->get_name()); | 989 | 0 | } | 990 | | | 991 | 180 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 992 | 180 | UInt32 from_precision = from_decimal_type.get_precision(); | 993 | 180 | UInt32 from_scale = from_decimal_type.get_scale(); | 994 | | | 995 | 180 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 996 | 180 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 997 | 180 | UInt32 to_precision = to_decimal_type.get_precision(); | 998 | 180 | ToDataType::check_type_precision(to_precision); | 999 | 180 | UInt32 to_scale = to_decimal_type.get_scale(); | 1000 | 180 | ToDataType::check_type_scale(to_scale); | 1001 | | | 1002 | 180 | auto from_max_int_digit_count = from_precision - from_scale; | 1003 | 180 | auto to_max_int_digit_count = to_precision - to_scale; | 1004 | 180 | bool narrow_integral = | 1005 | 180 | (to_max_int_digit_count < from_max_int_digit_count) || | 1006 | 180 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1007 | | // only in non-strict mode and may overflow, we set nullable | 1008 | 180 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1009 | | | 1010 | 180 | size_t size = col_from->size(); | 1011 | 180 | ColumnUInt8::MutablePtr col_null_map_to; | 1012 | 180 | NullMap::value_type* null_map_data = nullptr; | 1013 | 180 | if (narrow_integral) { | 1014 | 104 | col_null_map_to = ColumnUInt8::create(size, 0); | 1015 | 104 | null_map_data = col_null_map_to->get_data().data(); | 1016 | 104 | } | 1017 | 180 | CastParameters params; | 1018 | 180 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1019 | 180 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1020 | 180 | const auto& vec_from = col_from->get_data(); | 1021 | 180 | const auto* vec_from_data = vec_from.data(); | 1022 | 180 | auto& vec_to = col_to->get_data(); | 1023 | 180 | auto* vec_to_data = vec_to.data(); | 1024 | | | 1025 | 180 | using MaxFieldType = | 1026 | 180 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1027 | 180 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1028 | 180 | std::is_same_v<FromFieldType, Decimal128V3>), | 1029 | 180 | Decimal128V3, | 1030 | 180 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1031 | 180 | FromFieldType, ToFieldType>>; | 1032 | 180 | using MaxNativeType = typename MaxFieldType::NativeType; | 1033 | | | 1034 | 180 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1035 | 180 | bool multiply_may_overflow = false; | 1036 | 180 | if (to_scale > from_scale) { | 1037 | 86 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1038 | 86 | } | 1039 | | | 1040 | 180 | typename ToFieldType::NativeType max_result = | 1041 | 180 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1042 | 180 | typename ToFieldType::NativeType min_result = -max_result; | 1043 | | | 1044 | 180 | MaxNativeType multiplier {}; | 1045 | 180 | if (from_scale < to_scale) { | 1046 | 86 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1047 | 86 | from_scale); | 1048 | 94 | } else if (from_scale > to_scale) { | 1049 | 68 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1050 | 68 | to_scale); | 1051 | 68 | } | 1052 | 180 | RETURN_IF_ERROR(std::visit( | 1053 | 180 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1054 | 180 | for (size_t i = 0; i < size; i++) { | 1055 | 180 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1056 | 180 | multiply_may_overflow, narrow_integral>( | 1057 | 180 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1058 | 180 | to_precision, to_scale, min_result, max_result, multiplier, | 1059 | 180 | params)) { | 1060 | 180 | if (set_nullable) { | 1061 | 180 | null_map_data[i] = 1; | 1062 | 180 | } else { | 1063 | 180 | return params.status; | 1064 | 180 | } | 1065 | 180 | } | 1066 | 180 | } | 1067 | 180 | return Status::OK(); | 1068 | 180 | }, | 1069 | 180 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1070 | 180 | if (narrow_integral) { | 1071 | 104 | block.get_by_position(result).column = | 1072 | 104 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1073 | 104 | } else { | 1074 | 76 | block.get_by_position(result).column = std::move(col_to); | 1075 | 76 | } | 1076 | 180 | return Status::OK(); | 1077 | 180 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEENS2_ILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 980 | 153 | const NullMap::value_type* null_map = nullptr) const override { | 981 | 153 | using FromFieldType = typename FromDataType::FieldType; | 982 | 153 | using ToFieldType = typename ToDataType::FieldType; | 983 | 153 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 984 | 153 | const auto* col_from = | 985 | 153 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 986 | 153 | if (!col_from) { | 987 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 988 | 0 | named_from.column->get_name()); | 989 | 0 | } | 990 | | | 991 | 153 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 992 | 153 | UInt32 from_precision = from_decimal_type.get_precision(); | 993 | 153 | UInt32 from_scale = from_decimal_type.get_scale(); | 994 | | | 995 | 153 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 996 | 153 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 997 | 153 | UInt32 to_precision = to_decimal_type.get_precision(); | 998 | 153 | ToDataType::check_type_precision(to_precision); | 999 | 153 | UInt32 to_scale = to_decimal_type.get_scale(); | 1000 | 153 | ToDataType::check_type_scale(to_scale); | 1001 | | | 1002 | 153 | auto from_max_int_digit_count = from_precision - from_scale; | 1003 | 153 | auto to_max_int_digit_count = to_precision - to_scale; | 1004 | 153 | bool narrow_integral = | 1005 | 153 | (to_max_int_digit_count < from_max_int_digit_count) || | 1006 | 153 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1007 | | // only in non-strict mode and may overflow, we set nullable | 1008 | 153 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1009 | | | 1010 | 153 | size_t size = col_from->size(); | 1011 | 153 | ColumnUInt8::MutablePtr col_null_map_to; | 1012 | 153 | NullMap::value_type* null_map_data = nullptr; | 1013 | 153 | if (narrow_integral) { | 1014 | 153 | col_null_map_to = ColumnUInt8::create(size, 0); | 1015 | 153 | null_map_data = col_null_map_to->get_data().data(); | 1016 | 153 | } | 1017 | 153 | CastParameters params; | 1018 | 153 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1019 | 153 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1020 | 153 | const auto& vec_from = col_from->get_data(); | 1021 | 153 | const auto* vec_from_data = vec_from.data(); | 1022 | 153 | auto& vec_to = col_to->get_data(); | 1023 | 153 | auto* vec_to_data = vec_to.data(); | 1024 | | | 1025 | 153 | using MaxFieldType = | 1026 | 153 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1027 | 153 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1028 | 153 | std::is_same_v<FromFieldType, Decimal128V3>), | 1029 | 153 | Decimal128V3, | 1030 | 153 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1031 | 153 | FromFieldType, ToFieldType>>; | 1032 | 153 | using MaxNativeType = typename MaxFieldType::NativeType; | 1033 | | | 1034 | 153 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1035 | 153 | bool multiply_may_overflow = false; | 1036 | 153 | if (to_scale > from_scale) { | 1037 | 60 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1038 | 60 | } | 1039 | | | 1040 | 153 | typename ToFieldType::NativeType max_result = | 1041 | 153 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1042 | 153 | typename ToFieldType::NativeType min_result = -max_result; | 1043 | | | 1044 | 153 | MaxNativeType multiplier {}; | 1045 | 153 | if (from_scale < to_scale) { | 1046 | 60 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1047 | 60 | from_scale); | 1048 | 93 | } else if (from_scale > to_scale) { | 1049 | 66 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1050 | 66 | to_scale); | 1051 | 66 | } | 1052 | 153 | RETURN_IF_ERROR(std::visit( | 1053 | 153 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1054 | 153 | for (size_t i = 0; i < size; i++) { | 1055 | 153 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1056 | 153 | multiply_may_overflow, narrow_integral>( | 1057 | 153 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1058 | 153 | to_precision, to_scale, min_result, max_result, multiplier, | 1059 | 153 | params)) { | 1060 | 153 | if (set_nullable) { | 1061 | 153 | null_map_data[i] = 1; | 1062 | 153 | } else { | 1063 | 153 | return params.status; | 1064 | 153 | } | 1065 | 153 | } | 1066 | 153 | } | 1067 | 153 | return Status::OK(); | 1068 | 153 | }, | 1069 | 153 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1070 | 0 | if (narrow_integral) { | 1071 | 0 | block.get_by_position(result).column = | 1072 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1073 | 0 | } else { | 1074 | 0 | block.get_by_position(result).column = std::move(col_to); | 1075 | 0 | } | 1076 | 0 | return Status::OK(); | 1077 | 153 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEENS2_ILS3_30EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 980 | 228 | const NullMap::value_type* null_map = nullptr) const override { | 981 | 228 | using FromFieldType = typename FromDataType::FieldType; | 982 | 228 | using ToFieldType = typename ToDataType::FieldType; | 983 | 228 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 984 | 228 | const auto* col_from = | 985 | 228 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 986 | 228 | if (!col_from) { | 987 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 988 | 0 | named_from.column->get_name()); | 989 | 0 | } | 990 | | | 991 | 228 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 992 | 228 | UInt32 from_precision = from_decimal_type.get_precision(); | 993 | 228 | UInt32 from_scale = from_decimal_type.get_scale(); | 994 | | | 995 | 228 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 996 | 228 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 997 | 228 | UInt32 to_precision = to_decimal_type.get_precision(); | 998 | 228 | ToDataType::check_type_precision(to_precision); | 999 | 228 | UInt32 to_scale = to_decimal_type.get_scale(); | 1000 | 228 | ToDataType::check_type_scale(to_scale); | 1001 | | | 1002 | 228 | auto from_max_int_digit_count = from_precision - from_scale; | 1003 | 228 | auto to_max_int_digit_count = to_precision - to_scale; | 1004 | 228 | bool narrow_integral = | 1005 | 228 | (to_max_int_digit_count < from_max_int_digit_count) || | 1006 | 228 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1007 | | // only in non-strict mode and may overflow, we set nullable | 1008 | 228 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1009 | | | 1010 | 228 | size_t size = col_from->size(); | 1011 | 228 | ColumnUInt8::MutablePtr col_null_map_to; | 1012 | 228 | NullMap::value_type* null_map_data = nullptr; | 1013 | 228 | if (narrow_integral) { | 1014 | 192 | col_null_map_to = ColumnUInt8::create(size, 0); | 1015 | 192 | null_map_data = col_null_map_to->get_data().data(); | 1016 | 192 | } | 1017 | 228 | CastParameters params; | 1018 | 228 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1019 | 228 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1020 | 228 | const auto& vec_from = col_from->get_data(); | 1021 | 228 | const auto* vec_from_data = vec_from.data(); | 1022 | 228 | auto& vec_to = col_to->get_data(); | 1023 | 228 | auto* vec_to_data = vec_to.data(); | 1024 | | | 1025 | 228 | using MaxFieldType = | 1026 | 228 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1027 | 228 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1028 | 228 | std::is_same_v<FromFieldType, Decimal128V3>), | 1029 | 228 | Decimal128V3, | 1030 | 228 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1031 | 228 | FromFieldType, ToFieldType>>; | 1032 | 228 | using MaxNativeType = typename MaxFieldType::NativeType; | 1033 | | | 1034 | 228 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1035 | 228 | bool multiply_may_overflow = false; | 1036 | 228 | if (to_scale > from_scale) { | 1037 | 76 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1038 | 76 | } | 1039 | | | 1040 | 228 | typename ToFieldType::NativeType max_result = | 1041 | 228 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1042 | 228 | typename ToFieldType::NativeType min_result = -max_result; | 1043 | | | 1044 | 228 | MaxNativeType multiplier {}; | 1045 | 228 | if (from_scale < to_scale) { | 1046 | 76 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1047 | 76 | from_scale); | 1048 | 152 | } else if (from_scale > to_scale) { | 1049 | 94 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1050 | 94 | to_scale); | 1051 | 94 | } | 1052 | 228 | RETURN_IF_ERROR(std::visit( | 1053 | 228 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1054 | 228 | for (size_t i = 0; i < size; i++) { | 1055 | 228 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1056 | 228 | multiply_may_overflow, narrow_integral>( | 1057 | 228 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1058 | 228 | to_precision, to_scale, min_result, max_result, multiplier, | 1059 | 228 | params)) { | 1060 | 228 | if (set_nullable) { | 1061 | 228 | null_map_data[i] = 1; | 1062 | 228 | } else { | 1063 | 228 | return params.status; | 1064 | 228 | } | 1065 | 228 | } | 1066 | 228 | } | 1067 | 228 | return Status::OK(); | 1068 | 228 | }, | 1069 | 228 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1070 | 228 | if (narrow_integral) { | 1071 | 192 | block.get_by_position(result).column = | 1072 | 192 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1073 | 192 | } else { | 1074 | 36 | block.get_by_position(result).column = std::move(col_to); | 1075 | 36 | } | 1076 | 228 | return Status::OK(); | 1077 | 228 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEENS2_ILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 980 | 36 | const NullMap::value_type* null_map = nullptr) const override { | 981 | 36 | using FromFieldType = typename FromDataType::FieldType; | 982 | 36 | using ToFieldType = typename ToDataType::FieldType; | 983 | 36 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 984 | 36 | const auto* col_from = | 985 | 36 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 986 | 36 | if (!col_from) { | 987 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 988 | 0 | named_from.column->get_name()); | 989 | 0 | } | 990 | | | 991 | 36 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 992 | 36 | UInt32 from_precision = from_decimal_type.get_precision(); | 993 | 36 | UInt32 from_scale = from_decimal_type.get_scale(); | 994 | | | 995 | 36 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 996 | 36 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 997 | 36 | UInt32 to_precision = to_decimal_type.get_precision(); | 998 | 36 | ToDataType::check_type_precision(to_precision); | 999 | 36 | UInt32 to_scale = to_decimal_type.get_scale(); | 1000 | 36 | ToDataType::check_type_scale(to_scale); | 1001 | | | 1002 | 36 | auto from_max_int_digit_count = from_precision - from_scale; | 1003 | 36 | auto to_max_int_digit_count = to_precision - to_scale; | 1004 | 36 | bool narrow_integral = | 1005 | 36 | (to_max_int_digit_count < from_max_int_digit_count) || | 1006 | 36 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1007 | | // only in non-strict mode and may overflow, we set nullable | 1008 | 36 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1009 | | | 1010 | 36 | size_t size = col_from->size(); | 1011 | 36 | ColumnUInt8::MutablePtr col_null_map_to; | 1012 | 36 | NullMap::value_type* null_map_data = nullptr; | 1013 | 36 | if (narrow_integral) { | 1014 | 36 | col_null_map_to = ColumnUInt8::create(size, 0); | 1015 | 36 | null_map_data = col_null_map_to->get_data().data(); | 1016 | 36 | } | 1017 | 36 | CastParameters params; | 1018 | 36 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1019 | 36 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1020 | 36 | const auto& vec_from = col_from->get_data(); | 1021 | 36 | const auto* vec_from_data = vec_from.data(); | 1022 | 36 | auto& vec_to = col_to->get_data(); | 1023 | 36 | auto* vec_to_data = vec_to.data(); | 1024 | | | 1025 | 36 | using MaxFieldType = | 1026 | 36 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1027 | 36 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1028 | 36 | std::is_same_v<FromFieldType, Decimal128V3>), | 1029 | 36 | Decimal128V3, | 1030 | 36 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1031 | 36 | FromFieldType, ToFieldType>>; | 1032 | 36 | using MaxNativeType = typename MaxFieldType::NativeType; | 1033 | | | 1034 | 36 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1035 | 36 | bool multiply_may_overflow = false; | 1036 | 36 | if (to_scale > from_scale) { | 1037 | 36 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1038 | 36 | } | 1039 | | | 1040 | 36 | typename ToFieldType::NativeType max_result = | 1041 | 36 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1042 | 36 | typename ToFieldType::NativeType min_result = -max_result; | 1043 | | | 1044 | 36 | MaxNativeType multiplier {}; | 1045 | 36 | if (from_scale < to_scale) { | 1046 | 36 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1047 | 36 | from_scale); | 1048 | 36 | } else if (from_scale > to_scale) { | 1049 | 0 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1050 | 0 | to_scale); | 1051 | 0 | } | 1052 | 36 | RETURN_IF_ERROR(std::visit( | 1053 | 36 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1054 | 36 | for (size_t i = 0; i < size; i++) { | 1055 | 36 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1056 | 36 | multiply_may_overflow, narrow_integral>( | 1057 | 36 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1058 | 36 | to_precision, to_scale, min_result, max_result, multiplier, | 1059 | 36 | params)) { | 1060 | 36 | if (set_nullable) { | 1061 | 36 | null_map_data[i] = 1; | 1062 | 36 | } else { | 1063 | 36 | return params.status; | 1064 | 36 | } | 1065 | 36 | } | 1066 | 36 | } | 1067 | 36 | return Status::OK(); | 1068 | 36 | }, | 1069 | 36 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1070 | 0 | if (narrow_integral) { | 1071 | 0 | block.get_by_position(result).column = | 1072 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1073 | 0 | } else { | 1074 | 0 | block.get_by_position(result).column = std::move(col_to); | 1075 | 0 | } | 1076 | 0 | return Status::OK(); | 1077 | 36 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE28EEENS2_ILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 980 | 132 | const NullMap::value_type* null_map = nullptr) const override { | 981 | 132 | using FromFieldType = typename FromDataType::FieldType; | 982 | 132 | using ToFieldType = typename ToDataType::FieldType; | 983 | 132 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 984 | 132 | const auto* col_from = | 985 | 132 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 986 | 132 | if (!col_from) { | 987 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 988 | 0 | named_from.column->get_name()); | 989 | 0 | } | 990 | | | 991 | 132 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 992 | 132 | UInt32 from_precision = from_decimal_type.get_precision(); | 993 | 132 | UInt32 from_scale = from_decimal_type.get_scale(); | 994 | | | 995 | 132 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 996 | 132 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 997 | 132 | UInt32 to_precision = to_decimal_type.get_precision(); | 998 | 132 | ToDataType::check_type_precision(to_precision); | 999 | 132 | UInt32 to_scale = to_decimal_type.get_scale(); | 1000 | 132 | ToDataType::check_type_scale(to_scale); | 1001 | | | 1002 | 132 | auto from_max_int_digit_count = from_precision - from_scale; | 1003 | 132 | auto to_max_int_digit_count = to_precision - to_scale; | 1004 | 132 | bool narrow_integral = | 1005 | 132 | (to_max_int_digit_count < from_max_int_digit_count) || | 1006 | 132 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1007 | | // only in non-strict mode and may overflow, we set nullable | 1008 | 132 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1009 | | | 1010 | 132 | size_t size = col_from->size(); | 1011 | 132 | ColumnUInt8::MutablePtr col_null_map_to; | 1012 | 132 | NullMap::value_type* null_map_data = nullptr; | 1013 | 132 | if (narrow_integral) { | 1014 | 32 | col_null_map_to = ColumnUInt8::create(size, 0); | 1015 | 32 | null_map_data = col_null_map_to->get_data().data(); | 1016 | 32 | } | 1017 | 132 | CastParameters params; | 1018 | 132 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1019 | 132 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1020 | 132 | const auto& vec_from = col_from->get_data(); | 1021 | 132 | const auto* vec_from_data = vec_from.data(); | 1022 | 132 | auto& vec_to = col_to->get_data(); | 1023 | 132 | auto* vec_to_data = vec_to.data(); | 1024 | | | 1025 | 132 | using MaxFieldType = | 1026 | 132 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1027 | 132 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1028 | 132 | std::is_same_v<FromFieldType, Decimal128V3>), | 1029 | 132 | Decimal128V3, | 1030 | 132 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1031 | 132 | FromFieldType, ToFieldType>>; | 1032 | 132 | using MaxNativeType = typename MaxFieldType::NativeType; | 1033 | | | 1034 | 132 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1035 | 132 | bool multiply_may_overflow = false; | 1036 | 132 | if (to_scale > from_scale) { | 1037 | 70 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1038 | 70 | } | 1039 | | | 1040 | 132 | typename ToFieldType::NativeType max_result = | 1041 | 132 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1042 | 132 | typename ToFieldType::NativeType min_result = -max_result; | 1043 | | | 1044 | 132 | MaxNativeType multiplier {}; | 1045 | 132 | if (from_scale < to_scale) { | 1046 | 70 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1047 | 70 | from_scale); | 1048 | 70 | } else if (from_scale > to_scale) { | 1049 | 30 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1050 | 30 | to_scale); | 1051 | 30 | } | 1052 | 132 | RETURN_IF_ERROR(std::visit( | 1053 | 132 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1054 | 132 | for (size_t i = 0; i < size; i++) { | 1055 | 132 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1056 | 132 | multiply_may_overflow, narrow_integral>( | 1057 | 132 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1058 | 132 | to_precision, to_scale, min_result, max_result, multiplier, | 1059 | 132 | params)) { | 1060 | 132 | if (set_nullable) { | 1061 | 132 | null_map_data[i] = 1; | 1062 | 132 | } else { | 1063 | 132 | return params.status; | 1064 | 132 | } | 1065 | 132 | } | 1066 | 132 | } | 1067 | 132 | return Status::OK(); | 1068 | 132 | }, | 1069 | 132 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1070 | 132 | if (narrow_integral) { | 1071 | 32 | block.get_by_position(result).column = | 1072 | 32 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1073 | 100 | } else { | 1074 | 100 | block.get_by_position(result).column = std::move(col_to); | 1075 | 100 | } | 1076 | 132 | return Status::OK(); | 1077 | 132 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEENS2_ILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 980 | 60 | const NullMap::value_type* null_map = nullptr) const override { | 981 | 60 | using FromFieldType = typename FromDataType::FieldType; | 982 | 60 | using ToFieldType = typename ToDataType::FieldType; | 983 | 60 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 984 | 60 | const auto* col_from = | 985 | 60 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 986 | 60 | if (!col_from) { | 987 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 988 | 0 | named_from.column->get_name()); | 989 | 0 | } | 990 | | | 991 | 60 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 992 | 60 | UInt32 from_precision = from_decimal_type.get_precision(); | 993 | 60 | UInt32 from_scale = from_decimal_type.get_scale(); | 994 | | | 995 | 60 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 996 | 60 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 997 | 60 | UInt32 to_precision = to_decimal_type.get_precision(); | 998 | 60 | ToDataType::check_type_precision(to_precision); | 999 | 60 | UInt32 to_scale = to_decimal_type.get_scale(); | 1000 | 60 | ToDataType::check_type_scale(to_scale); | 1001 | | | 1002 | 60 | auto from_max_int_digit_count = from_precision - from_scale; | 1003 | 60 | auto to_max_int_digit_count = to_precision - to_scale; | 1004 | 60 | bool narrow_integral = | 1005 | 60 | (to_max_int_digit_count < from_max_int_digit_count) || | 1006 | 60 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1007 | | // only in non-strict mode and may overflow, we set nullable | 1008 | 60 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1009 | | | 1010 | 60 | size_t size = col_from->size(); | 1011 | 60 | ColumnUInt8::MutablePtr col_null_map_to; | 1012 | 60 | NullMap::value_type* null_map_data = nullptr; | 1013 | 60 | if (narrow_integral) { | 1014 | 60 | col_null_map_to = ColumnUInt8::create(size, 0); | 1015 | 60 | null_map_data = col_null_map_to->get_data().data(); | 1016 | 60 | } | 1017 | 60 | CastParameters params; | 1018 | 60 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1019 | 60 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1020 | 60 | const auto& vec_from = col_from->get_data(); | 1021 | 60 | const auto* vec_from_data = vec_from.data(); | 1022 | 60 | auto& vec_to = col_to->get_data(); | 1023 | 60 | auto* vec_to_data = vec_to.data(); | 1024 | | | 1025 | 60 | using MaxFieldType = | 1026 | 60 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1027 | 60 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1028 | 60 | std::is_same_v<FromFieldType, Decimal128V3>), | 1029 | 60 | Decimal128V3, | 1030 | 60 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1031 | 60 | FromFieldType, ToFieldType>>; | 1032 | 60 | using MaxNativeType = typename MaxFieldType::NativeType; | 1033 | | | 1034 | 60 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1035 | 60 | bool multiply_may_overflow = false; | 1036 | 60 | if (to_scale > from_scale) { | 1037 | 60 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1038 | 60 | } | 1039 | | | 1040 | 60 | typename ToFieldType::NativeType max_result = | 1041 | 60 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1042 | 60 | typename ToFieldType::NativeType min_result = -max_result; | 1043 | | | 1044 | 60 | MaxNativeType multiplier {}; | 1045 | 60 | if (from_scale < to_scale) { | 1046 | 60 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1047 | 60 | from_scale); | 1048 | 60 | } else if (from_scale > to_scale) { | 1049 | 0 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1050 | 0 | to_scale); | 1051 | 0 | } | 1052 | 60 | RETURN_IF_ERROR(std::visit( | 1053 | 60 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1054 | 60 | for (size_t i = 0; i < size; i++) { | 1055 | 60 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1056 | 60 | multiply_may_overflow, narrow_integral>( | 1057 | 60 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1058 | 60 | to_precision, to_scale, min_result, max_result, multiplier, | 1059 | 60 | params)) { | 1060 | 60 | if (set_nullable) { | 1061 | 60 | null_map_data[i] = 1; | 1062 | 60 | } else { | 1063 | 60 | return params.status; | 1064 | 60 | } | 1065 | 60 | } | 1066 | 60 | } | 1067 | 60 | return Status::OK(); | 1068 | 60 | }, | 1069 | 60 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1070 | 0 | if (narrow_integral) { | 1071 | 0 | block.get_by_position(result).column = | 1072 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1073 | 0 | } else { | 1074 | 0 | block.get_by_position(result).column = std::move(col_to); | 1075 | 0 | } | 1076 | 0 | return Status::OK(); | 1077 | 60 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE29EEENS2_ILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 980 | 204 | const NullMap::value_type* null_map = nullptr) const override { | 981 | 204 | using FromFieldType = typename FromDataType::FieldType; | 982 | 204 | using ToFieldType = typename ToDataType::FieldType; | 983 | 204 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 984 | 204 | const auto* col_from = | 985 | 204 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 986 | 204 | if (!col_from) { | 987 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 988 | 0 | named_from.column->get_name()); | 989 | 0 | } | 990 | | | 991 | 204 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 992 | 204 | UInt32 from_precision = from_decimal_type.get_precision(); | 993 | 204 | UInt32 from_scale = from_decimal_type.get_scale(); | 994 | | | 995 | 204 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 996 | 204 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 997 | 204 | UInt32 to_precision = to_decimal_type.get_precision(); | 998 | 204 | ToDataType::check_type_precision(to_precision); | 999 | 204 | UInt32 to_scale = to_decimal_type.get_scale(); | 1000 | 204 | ToDataType::check_type_scale(to_scale); | 1001 | | | 1002 | 204 | auto from_max_int_digit_count = from_precision - from_scale; | 1003 | 204 | auto to_max_int_digit_count = to_precision - to_scale; | 1004 | 204 | bool narrow_integral = | 1005 | 204 | (to_max_int_digit_count < from_max_int_digit_count) || | 1006 | 204 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1007 | | // only in non-strict mode and may overflow, we set nullable | 1008 | 204 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1009 | | | 1010 | 204 | size_t size = col_from->size(); | 1011 | 204 | ColumnUInt8::MutablePtr col_null_map_to; | 1012 | 204 | NullMap::value_type* null_map_data = nullptr; | 1013 | 204 | if (narrow_integral) { | 1014 | 56 | col_null_map_to = ColumnUInt8::create(size, 0); | 1015 | 56 | null_map_data = col_null_map_to->get_data().data(); | 1016 | 56 | } | 1017 | 204 | CastParameters params; | 1018 | 204 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1019 | 204 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1020 | 204 | const auto& vec_from = col_from->get_data(); | 1021 | 204 | const auto* vec_from_data = vec_from.data(); | 1022 | 204 | auto& vec_to = col_to->get_data(); | 1023 | 204 | auto* vec_to_data = vec_to.data(); | 1024 | | | 1025 | 204 | using MaxFieldType = | 1026 | 204 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1027 | 204 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1028 | 204 | std::is_same_v<FromFieldType, Decimal128V3>), | 1029 | 204 | Decimal128V3, | 1030 | 204 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1031 | 204 | FromFieldType, ToFieldType>>; | 1032 | 204 | using MaxNativeType = typename MaxFieldType::NativeType; | 1033 | | | 1034 | 204 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1035 | 204 | bool multiply_may_overflow = false; | 1036 | 204 | if (to_scale > from_scale) { | 1037 | 100 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1038 | 100 | } | 1039 | | | 1040 | 204 | typename ToFieldType::NativeType max_result = | 1041 | 204 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1042 | 204 | typename ToFieldType::NativeType min_result = -max_result; | 1043 | | | 1044 | 204 | MaxNativeType multiplier {}; | 1045 | 204 | if (from_scale < to_scale) { | 1046 | 100 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1047 | 100 | from_scale); | 1048 | 104 | } else if (from_scale > to_scale) { | 1049 | 56 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1050 | 56 | to_scale); | 1051 | 56 | } | 1052 | 204 | RETURN_IF_ERROR(std::visit( | 1053 | 204 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1054 | 204 | for (size_t i = 0; i < size; i++) { | 1055 | 204 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1056 | 204 | multiply_may_overflow, narrow_integral>( | 1057 | 204 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1058 | 204 | to_precision, to_scale, min_result, max_result, multiplier, | 1059 | 204 | params)) { | 1060 | 204 | if (set_nullable) { | 1061 | 204 | null_map_data[i] = 1; | 1062 | 204 | } else { | 1063 | 204 | return params.status; | 1064 | 204 | } | 1065 | 204 | } | 1066 | 204 | } | 1067 | 204 | return Status::OK(); | 1068 | 204 | }, | 1069 | 204 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1070 | 204 | if (narrow_integral) { | 1071 | 56 | block.get_by_position(result).column = | 1072 | 56 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1073 | 148 | } else { | 1074 | 148 | block.get_by_position(result).column = std::move(col_to); | 1075 | 148 | } | 1076 | 204 | return Status::OK(); | 1077 | 204 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEENS2_ILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 980 | 60 | const NullMap::value_type* null_map = nullptr) const override { | 981 | 60 | using FromFieldType = typename FromDataType::FieldType; | 982 | 60 | using ToFieldType = typename ToDataType::FieldType; | 983 | 60 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 984 | 60 | const auto* col_from = | 985 | 60 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 986 | 60 | if (!col_from) { | 987 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 988 | 0 | named_from.column->get_name()); | 989 | 0 | } | 990 | | | 991 | 60 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 992 | 60 | UInt32 from_precision = from_decimal_type.get_precision(); | 993 | 60 | UInt32 from_scale = from_decimal_type.get_scale(); | 994 | | | 995 | 60 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 996 | 60 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 997 | 60 | UInt32 to_precision = to_decimal_type.get_precision(); | 998 | 60 | ToDataType::check_type_precision(to_precision); | 999 | 60 | UInt32 to_scale = to_decimal_type.get_scale(); | 1000 | 60 | ToDataType::check_type_scale(to_scale); | 1001 | | | 1002 | 60 | auto from_max_int_digit_count = from_precision - from_scale; | 1003 | 60 | auto to_max_int_digit_count = to_precision - to_scale; | 1004 | 60 | bool narrow_integral = | 1005 | 60 | (to_max_int_digit_count < from_max_int_digit_count) || | 1006 | 60 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1007 | | // only in non-strict mode and may overflow, we set nullable | 1008 | 60 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1009 | | | 1010 | 60 | size_t size = col_from->size(); | 1011 | 60 | ColumnUInt8::MutablePtr col_null_map_to; | 1012 | 60 | NullMap::value_type* null_map_data = nullptr; | 1013 | 60 | if (narrow_integral) { | 1014 | 60 | col_null_map_to = ColumnUInt8::create(size, 0); | 1015 | 60 | null_map_data = col_null_map_to->get_data().data(); | 1016 | 60 | } | 1017 | 60 | CastParameters params; | 1018 | 60 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1019 | 60 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1020 | 60 | const auto& vec_from = col_from->get_data(); | 1021 | 60 | const auto* vec_from_data = vec_from.data(); | 1022 | 60 | auto& vec_to = col_to->get_data(); | 1023 | 60 | auto* vec_to_data = vec_to.data(); | 1024 | | | 1025 | 60 | using MaxFieldType = | 1026 | 60 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1027 | 60 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1028 | 60 | std::is_same_v<FromFieldType, Decimal128V3>), | 1029 | 60 | Decimal128V3, | 1030 | 60 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1031 | 60 | FromFieldType, ToFieldType>>; | 1032 | 60 | using MaxNativeType = typename MaxFieldType::NativeType; | 1033 | | | 1034 | 60 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1035 | 60 | bool multiply_may_overflow = false; | 1036 | 60 | if (to_scale > from_scale) { | 1037 | 60 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1038 | 60 | } | 1039 | | | 1040 | 60 | typename ToFieldType::NativeType max_result = | 1041 | 60 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1042 | 60 | typename ToFieldType::NativeType min_result = -max_result; | 1043 | | | 1044 | 60 | MaxNativeType multiplier {}; | 1045 | 60 | if (from_scale < to_scale) { | 1046 | 60 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1047 | 60 | from_scale); | 1048 | 60 | } else if (from_scale > to_scale) { | 1049 | 0 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1050 | 0 | to_scale); | 1051 | 0 | } | 1052 | 60 | RETURN_IF_ERROR(std::visit( | 1053 | 60 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1054 | 60 | for (size_t i = 0; i < size; i++) { | 1055 | 60 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1056 | 60 | multiply_may_overflow, narrow_integral>( | 1057 | 60 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1058 | 60 | to_precision, to_scale, min_result, max_result, multiplier, | 1059 | 60 | params)) { | 1060 | 60 | if (set_nullable) { | 1061 | 60 | null_map_data[i] = 1; | 1062 | 60 | } else { | 1063 | 60 | return params.status; | 1064 | 60 | } | 1065 | 60 | } | 1066 | 60 | } | 1067 | 60 | return Status::OK(); | 1068 | 60 | }, | 1069 | 60 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1070 | 0 | if (narrow_integral) { | 1071 | 0 | block.get_by_position(result).column = | 1072 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1073 | 0 | } else { | 1074 | 0 | block.get_by_position(result).column = std::move(col_to); | 1075 | 0 | } | 1076 | 0 | return Status::OK(); | 1077 | 60 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE30EEENS2_ILS3_35EEEE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 980 | 204 | const NullMap::value_type* null_map = nullptr) const override { | 981 | 204 | using FromFieldType = typename FromDataType::FieldType; | 982 | 204 | using ToFieldType = typename ToDataType::FieldType; | 983 | 204 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 984 | 204 | const auto* col_from = | 985 | 204 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 986 | 204 | if (!col_from) { | 987 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 988 | 0 | named_from.column->get_name()); | 989 | 0 | } | 990 | | | 991 | 204 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 992 | 204 | UInt32 from_precision = from_decimal_type.get_precision(); | 993 | 204 | UInt32 from_scale = from_decimal_type.get_scale(); | 994 | | | 995 | 204 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 996 | 204 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 997 | 204 | UInt32 to_precision = to_decimal_type.get_precision(); | 998 | 204 | ToDataType::check_type_precision(to_precision); | 999 | 204 | UInt32 to_scale = to_decimal_type.get_scale(); | 1000 | 204 | ToDataType::check_type_scale(to_scale); | 1001 | | | 1002 | 204 | auto from_max_int_digit_count = from_precision - from_scale; | 1003 | 204 | auto to_max_int_digit_count = to_precision - to_scale; | 1004 | 204 | bool narrow_integral = | 1005 | 204 | (to_max_int_digit_count < from_max_int_digit_count) || | 1006 | 204 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1007 | | // only in non-strict mode and may overflow, we set nullable | 1008 | 204 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1009 | | | 1010 | 204 | size_t size = col_from->size(); | 1011 | 204 | ColumnUInt8::MutablePtr col_null_map_to; | 1012 | 204 | NullMap::value_type* null_map_data = nullptr; | 1013 | 204 | if (narrow_integral) { | 1014 | 56 | col_null_map_to = ColumnUInt8::create(size, 0); | 1015 | 56 | null_map_data = col_null_map_to->get_data().data(); | 1016 | 56 | } | 1017 | 204 | CastParameters params; | 1018 | 204 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1019 | 204 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1020 | 204 | const auto& vec_from = col_from->get_data(); | 1021 | 204 | const auto* vec_from_data = vec_from.data(); | 1022 | 204 | auto& vec_to = col_to->get_data(); | 1023 | 204 | auto* vec_to_data = vec_to.data(); | 1024 | | | 1025 | 204 | using MaxFieldType = | 1026 | 204 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1027 | 204 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1028 | 204 | std::is_same_v<FromFieldType, Decimal128V3>), | 1029 | 204 | Decimal128V3, | 1030 | 204 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1031 | 204 | FromFieldType, ToFieldType>>; | 1032 | 204 | using MaxNativeType = typename MaxFieldType::NativeType; | 1033 | | | 1034 | 204 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1035 | 204 | bool multiply_may_overflow = false; | 1036 | 204 | if (to_scale > from_scale) { | 1037 | 99 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1038 | 99 | } | 1039 | | | 1040 | 204 | typename ToFieldType::NativeType max_result = | 1041 | 204 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1042 | 204 | typename ToFieldType::NativeType min_result = -max_result; | 1043 | | | 1044 | 204 | MaxNativeType multiplier {}; | 1045 | 204 | if (from_scale < to_scale) { | 1046 | 99 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1047 | 99 | from_scale); | 1048 | 105 | } else if (from_scale > to_scale) { | 1049 | 56 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1050 | 56 | to_scale); | 1051 | 56 | } | 1052 | 204 | RETURN_IF_ERROR(std::visit( | 1053 | 204 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1054 | 204 | for (size_t i = 0; i < size; i++) { | 1055 | 204 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1056 | 204 | multiply_may_overflow, narrow_integral>( | 1057 | 204 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1058 | 204 | to_precision, to_scale, min_result, max_result, multiplier, | 1059 | 204 | params)) { | 1060 | 204 | if (set_nullable) { | 1061 | 204 | null_map_data[i] = 1; | 1062 | 204 | } else { | 1063 | 204 | return params.status; | 1064 | 204 | } | 1065 | 204 | } | 1066 | 204 | } | 1067 | 204 | return Status::OK(); | 1068 | 204 | }, | 1069 | 204 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1070 | 204 | if (narrow_integral) { | 1071 | 56 | block.get_by_position(result).column = | 1072 | 56 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1073 | 148 | } else { | 1074 | 148 | block.get_by_position(result).column = std::move(col_to); | 1075 | 148 | } | 1076 | 204 | return Status::OK(); | 1077 | 204 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE0ENS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEES4_E12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 980 | 92 | const NullMap::value_type* null_map = nullptr) const override { | 981 | 92 | using FromFieldType = typename FromDataType::FieldType; | 982 | 92 | using ToFieldType = typename ToDataType::FieldType; | 983 | 92 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 984 | 92 | const auto* col_from = | 985 | 92 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 986 | 92 | if (!col_from) { | 987 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 988 | 0 | named_from.column->get_name()); | 989 | 0 | } | 990 | | | 991 | 92 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 992 | 92 | UInt32 from_precision = from_decimal_type.get_precision(); | 993 | 92 | UInt32 from_scale = from_decimal_type.get_scale(); | 994 | | | 995 | 92 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 996 | 92 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 997 | 92 | UInt32 to_precision = to_decimal_type.get_precision(); | 998 | 92 | ToDataType::check_type_precision(to_precision); | 999 | 92 | UInt32 to_scale = to_decimal_type.get_scale(); | 1000 | 92 | ToDataType::check_type_scale(to_scale); | 1001 | | | 1002 | 92 | auto from_max_int_digit_count = from_precision - from_scale; | 1003 | 92 | auto to_max_int_digit_count = to_precision - to_scale; | 1004 | 92 | bool narrow_integral = | 1005 | 92 | (to_max_int_digit_count < from_max_int_digit_count) || | 1006 | 92 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1007 | | // only in non-strict mode and may overflow, we set nullable | 1008 | 92 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1009 | | | 1010 | 92 | size_t size = col_from->size(); | 1011 | 92 | ColumnUInt8::MutablePtr col_null_map_to; | 1012 | 92 | NullMap::value_type* null_map_data = nullptr; | 1013 | 92 | if (narrow_integral) { | 1014 | 92 | col_null_map_to = ColumnUInt8::create(size, 0); | 1015 | 92 | null_map_data = col_null_map_to->get_data().data(); | 1016 | 92 | } | 1017 | 92 | CastParameters params; | 1018 | 92 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1019 | 92 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1020 | 92 | const auto& vec_from = col_from->get_data(); | 1021 | 92 | const auto* vec_from_data = vec_from.data(); | 1022 | 92 | auto& vec_to = col_to->get_data(); | 1023 | 92 | auto* vec_to_data = vec_to.data(); | 1024 | | | 1025 | 92 | using MaxFieldType = | 1026 | 92 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1027 | 92 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1028 | 92 | std::is_same_v<FromFieldType, Decimal128V3>), | 1029 | 92 | Decimal128V3, | 1030 | 92 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1031 | 92 | FromFieldType, ToFieldType>>; | 1032 | 92 | using MaxNativeType = typename MaxFieldType::NativeType; | 1033 | | | 1034 | 92 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1035 | 92 | bool multiply_may_overflow = false; | 1036 | 92 | if (to_scale > from_scale) { | 1037 | 66 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1038 | 66 | } | 1039 | | | 1040 | 92 | typename ToFieldType::NativeType max_result = | 1041 | 92 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1042 | 92 | typename ToFieldType::NativeType min_result = -max_result; | 1043 | | | 1044 | 92 | MaxNativeType multiplier {}; | 1045 | 92 | if (from_scale < to_scale) { | 1046 | 66 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1047 | 66 | from_scale); | 1048 | 66 | } else if (from_scale > to_scale) { | 1049 | 20 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1050 | 20 | to_scale); | 1051 | 20 | } | 1052 | 92 | RETURN_IF_ERROR(std::visit( | 1053 | 92 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1054 | 92 | for (size_t i = 0; i < size; i++) { | 1055 | 92 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1056 | 92 | multiply_may_overflow, narrow_integral>( | 1057 | 92 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1058 | 92 | to_precision, to_scale, min_result, max_result, multiplier, | 1059 | 92 | params)) { | 1060 | 92 | if (set_nullable) { | 1061 | 92 | null_map_data[i] = 1; | 1062 | 92 | } else { | 1063 | 92 | return params.status; | 1064 | 92 | } | 1065 | 92 | } | 1066 | 92 | } | 1067 | 92 | return Status::OK(); | 1068 | 92 | }, | 1069 | 92 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1070 | 0 | if (narrow_integral) { | 1071 | 0 | block.get_by_position(result).column = | 1072 | 0 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1073 | 0 | } else { | 1074 | 0 | block.get_by_position(result).column = std::move(col_to); | 1075 | 0 | } | 1076 | 0 | return Status::OK(); | 1077 | 92 | } |
_ZNK5doris10CastToImplILNS_12CastModeTypeE1ENS_15DataTypeDecimalILNS_13PrimitiveTypeE35EEES4_E12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmPKh Line | Count | Source | 980 | 180 | const NullMap::value_type* null_map = nullptr) const override { | 981 | 180 | using FromFieldType = typename FromDataType::FieldType; | 982 | 180 | using ToFieldType = typename ToDataType::FieldType; | 983 | 180 | const ColumnWithTypeAndName& named_from = block.get_by_position(arguments[0]); | 984 | 180 | const auto* col_from = | 985 | 180 | check_and_get_column<typename FromDataType::ColumnType>(named_from.column.get()); | 986 | 180 | if (!col_from) { | 987 | 0 | return Status::RuntimeError("Illegal column {} of first argument of function cast", | 988 | 0 | named_from.column->get_name()); | 989 | 0 | } | 990 | | | 991 | 180 | const auto& from_decimal_type = assert_cast<const FromDataType&>(*named_from.type); | 992 | 180 | UInt32 from_precision = from_decimal_type.get_precision(); | 993 | 180 | UInt32 from_scale = from_decimal_type.get_scale(); | 994 | | | 995 | 180 | const ColumnWithTypeAndName& named_to = block.get_by_position(result); | 996 | 180 | const auto& to_decimal_type = assert_cast<const ToDataType&>(*named_to.type); | 997 | 180 | UInt32 to_precision = to_decimal_type.get_precision(); | 998 | 180 | ToDataType::check_type_precision(to_precision); | 999 | 180 | UInt32 to_scale = to_decimal_type.get_scale(); | 1000 | 180 | ToDataType::check_type_scale(to_scale); | 1001 | | | 1002 | 180 | auto from_max_int_digit_count = from_precision - from_scale; | 1003 | 180 | auto to_max_int_digit_count = to_precision - to_scale; | 1004 | 180 | bool narrow_integral = | 1005 | 180 | (to_max_int_digit_count < from_max_int_digit_count) || | 1006 | 180 | (to_max_int_digit_count == from_max_int_digit_count && to_scale < from_scale); | 1007 | | // only in non-strict mode and may overflow, we set nullable | 1008 | 180 | bool set_nullable = (CastMode == CastModeType::NonStrictMode) && narrow_integral; | 1009 | | | 1010 | 180 | size_t size = col_from->size(); | 1011 | 180 | ColumnUInt8::MutablePtr col_null_map_to; | 1012 | 180 | NullMap::value_type* null_map_data = nullptr; | 1013 | 180 | if (narrow_integral) { | 1014 | 104 | col_null_map_to = ColumnUInt8::create(size, 0); | 1015 | 104 | null_map_data = col_null_map_to->get_data().data(); | 1016 | 104 | } | 1017 | 180 | CastParameters params; | 1018 | 180 | params.is_strict = (CastMode == CastModeType::StrictMode); | 1019 | 180 | auto col_to = ToDataType::ColumnType::create(size, to_scale); | 1020 | 180 | const auto& vec_from = col_from->get_data(); | 1021 | 180 | const auto* vec_from_data = vec_from.data(); | 1022 | 180 | auto& vec_to = col_to->get_data(); | 1023 | 180 | auto* vec_to_data = vec_to.data(); | 1024 | | | 1025 | 180 | using MaxFieldType = | 1026 | 180 | std::conditional_t<(sizeof(FromFieldType) == sizeof(ToFieldType)) && | 1027 | 180 | (std::is_same_v<ToFieldType, Decimal128V3> || | 1028 | 180 | std::is_same_v<FromFieldType, Decimal128V3>), | 1029 | 180 | Decimal128V3, | 1030 | 180 | std::conditional_t<(sizeof(FromFieldType) > sizeof(ToFieldType)), | 1031 | 180 | FromFieldType, ToFieldType>>; | 1032 | 180 | using MaxNativeType = typename MaxFieldType::NativeType; | 1033 | | | 1034 | 180 | UInt32 to_max_digits = NumberTraits::max_ascii_len<typename ToFieldType::NativeType>(); | 1035 | 180 | bool multiply_may_overflow = false; | 1036 | 180 | if (to_scale > from_scale) { | 1037 | 86 | multiply_may_overflow = (from_precision + to_scale - from_scale) >= to_max_digits; | 1038 | 86 | } | 1039 | | | 1040 | 180 | typename ToFieldType::NativeType max_result = | 1041 | 180 | DataTypeDecimal<ToFieldType::PType>::get_max_digits_number(to_precision); | 1042 | 180 | typename ToFieldType::NativeType min_result = -max_result; | 1043 | | | 1044 | 180 | MaxNativeType multiplier {}; | 1045 | 180 | if (from_scale < to_scale) { | 1046 | 86 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(to_scale - | 1047 | 86 | from_scale); | 1048 | 94 | } else if (from_scale > to_scale) { | 1049 | 68 | multiplier = DataTypeDecimal<MaxFieldType::PType>::get_scale_multiplier(from_scale - | 1050 | 68 | to_scale); | 1051 | 68 | } | 1052 | 180 | RETURN_IF_ERROR(std::visit( | 1053 | 180 | [&](auto multiply_may_overflow, auto narrow_integral) { | 1054 | 180 | for (size_t i = 0; i < size; i++) { | 1055 | 180 | if (!CastToDecimal::_from_decimal<FromFieldType, ToFieldType, | 1056 | 180 | multiply_may_overflow, narrow_integral>( | 1057 | 180 | vec_from_data[i], from_precision, from_scale, vec_to_data[i], | 1058 | 180 | to_precision, to_scale, min_result, max_result, multiplier, | 1059 | 180 | params)) { | 1060 | 180 | if (set_nullable) { | 1061 | 180 | null_map_data[i] = 1; | 1062 | 180 | } else { | 1063 | 180 | return params.status; | 1064 | 180 | } | 1065 | 180 | } | 1066 | 180 | } | 1067 | 180 | return Status::OK(); | 1068 | 180 | }, | 1069 | 180 | make_bool_variant(multiply_may_overflow), make_bool_variant(narrow_integral))); | 1070 | 180 | if (narrow_integral) { | 1071 | 104 | block.get_by_position(result).column = | 1072 | 104 | ColumnNullable::create(std::move(col_to), std::move(col_null_map_to)); | 1073 | 104 | } else { | 1074 | 76 | block.get_by_position(result).column = std::move(col_to); | 1075 | 76 | } | 1076 | 180 | return Status::OK(); | 1077 | 180 | } |
|
1078 | | }; |
1079 | | |
1080 | | } // namespace doris |